what is csrf

최대 1 분 소요

what is csrf

CSRF == Cross Site Request Forgery
크로스 사이트 요청 위조
보안 취약점 예방책

that occurs when an attacker tricks a user’s browser into making an unintended request to a website where the user is authenticated 공격자가 브라우저를 속여 공격하는 방식 (상태값 병경 (계정 정보 변경, 폼값 전송 …)

공격방식

  1. 피싱 사이트 생성 후 사용자에게 제공
  2. 사용자는 해당 피싱사이트에 접속(가짜 사이트인지 인지하지 못한 상태로)
  3. 공격자는 피해자의 인증된 세션을 악용해 웹 사이트에 사용자로 둔갑해 정상적인 요청을 보냄
  4. 피해자는 이미 인증을 받았기 때문에 웹사이트는 요청이 공격자의 사이트에서 시작됨을 인지하지 못함
  5. 공격자는 성공적으로 피해자의 신분으로 악의적인 행위를 할 수 있음

예방책

위 공격에 예방을 위해 웹사이트들은 CSRF 토큰을 사용
이 토큰들은 각 세션마다 고유하며 요청에 클라이언트 및 서버정보가 포함됨
서버는 매 요청마다 해당토큰을 확인함 originated한지 신뢰할 수 있는지

TMI

In Spring Security, CSRF protection is enabled by default. It generates a unique token for each session and includes it in forms submitted to the server. Upon receiving a request, Spring Security validates the token to ensure it matches the expected value for the session. If the token is missing or invalid, Spring Security rejects the request, thus preventing CSRF attacks.

spring security 시 default 사용 가능하며 세션별 고유토큰을 생성하고 검증한다.

카테고리:

업데이트: