May 12, 2019

WebGoat write up(Cross-Site Request Forgeries 8 Login CSRF attack)

To comply with the rule, in this write up, some hints related to this challenge only will be mentioned.

룰을 준수하기 위해, 여기서는 챌린지와과 관련된 몇 가지 힌트만이 언급됩니다.

(8) Login CSRF attack
(8) 로그인 CSRF 공격.

In a login CSRF attack, the attacker forges a login request to an honest site using the attacker's username and password at that site. If the forgery succeeds, the honest server responds with a Set-Cookie header that instructs the browser to mutate its state by storing a session cookie, logging the user into the honest site as the attacker. This session cookie is used to bind subsequent requests to the user's session and hence to the attacker's authentication credentials. Login CSRF attacks can have serious consequences, for example see the picture below where an attacker created an account at google.com the victim visits the malicious website and the user is logged in as the attacker. The attacker could then later on gather information about the activities of the user.

로그인 CSRF 공격 시, 공격자는 자신의 ID/PW를 이용하여 희생자로 하여금 로그인 요청 메시지를 전송하게 만든다. 만약 공격이 성공하면, 서버는 헤더에 "Set-Cookie" 항목을 포함하여 희생자에게 응답하는데, 이것은 브라우저가 세션 쿠키를 저장하도록 지시하는 역할을 한다. 그러면 희생자는 공격자의 계정으로 로그인 되는 것이다. 이 세션 쿠키는, 이후의 요청 메시지를 대상으로, 희생자의 세션과 공격자의 인증 정보를 묶을 때 사용된다. 로그인 CSRF 공격은 심각한 결과를 초래할 수 있다. 예를 들어, 아래 그림과 같이 공격자는 google.com에서 계정을 만들었다고 가정한다. 이어서 희생자는 악성 사이트를 방문하고, 공격자의 계정으로 로그인하게 된다. 그러면 공격자는 희생자의 활동 이력을 수집할 수 있게 된다.

For more information read the following paper.
세부 정보는 아래 링크를 참조하라.

http://seclab.stanford.edu/websec/csrf/csrf.pdf

In this assignment try to see if WebGoat is also vulnerable for a login CSRF attack. Leave this tab open and in another tab create a user based on your own username prefixed with csrf-. So if your username is tom you must create a new user called csrf-tom.

WebGoat가 로그인 CSRF 공격에 취약한지 확인하라. 이 탭은 그대로 두고 새 탭을 연 뒤, "csrf-" 접두어가 붙은 새로운 계정을 생성한다. 만약 계정명이 "tom" 이라면 "csrf-tom"이 될 것이다.

Login as the new user. This is what an attacker would do using CSRF. Then click the button in the original tab. Because you are logged in as a different user, the attacker learns that you clicked the button.

새로 생성한 계정으로 희생자가 로그인 하도록 만들어라. 이것은 공격자가 CSRF를 수행하는 방식이다. 그리고 기존의 열어두었던 탭으로 돌아와 아래의 버튼을 클릭하라. 새 계정으로 로그인되었다면 공격자는 아래 버튼의 클릭 여부를 확인할 수 있다.

the clue of WebGoat write up(Cross-Site Request Forgeries 8 Login CSRF attack)

Now we need to create a malicious page that the victim will visit. Create an HTML file on the desktop and enter the above source code. The main point is to send a request to the login page with the POST method, which contains the newly created account name and password. The JavaScript code below means sending the information written in the form to the server.

이제 희생자가 방문하게 될 악성 페이지를 만들어야 한다. 바탕화면 등에 HTML 파일을 하나 만들어 위의 소스코드를 입력한다. 주요 내용은 POST 메소드로 로그인 페이지에 요청을 전송하는 것인데, 여기에는 공격자자 새로 생성한 계정명과 비밀번호가 심어져 있다. 그 아래 자바스크립트 코드는, 위 폼에 입력된 정보를 서버로 전송한다는 내용이다.

the result of WebGoat write up(Cross-Site Request Forgeries 8 Login CSRF attack)