Authentication cookies are used for services that require authentication. When a user logs in with a personal username and password, the server verifies the provided credentials. If they are valid, it creates a session.
인증 쿠키는 인증이 필요한 서비스에서 사용된다. 사용자가 개인 아이디와 패스워드로 로그인하면 서버는 제공된 증명을 확인한다. 유효한 경우 서버는 세션을 생성한다.
Typically, each session is assigned a unique ID that identifies the user’s session. When the server sends a response back to the user, it includes a "Set-Cookie" header that contains, among other things, the cookie name and value.
일반적으로 각 세션은 사용자의 세션을 식별하는 고유한 ID를 할당 받는다. 서버가 사용자에게 응답을 보낼 때 "Set-Cookie" 헤더에 쿠키의 이름과 값 등을 포함한다.
The authentication cookie is usually stored on both the client and server sides.
인증 쿠키는 보통 클라이언트와 서버 양쪽에 저장된다.
On one hand, storing the cookie on the client side means it can be susceptible to theft through exploiting certain vulnerabilities or interception via man-in-the-middle attacks or XSS. On the other hand, the cookie values can be guessed if the algorithm used to generate the cookie is obtained.
한편, 쿠키가 클라이언트 측에 저장되면 특정 취약점이나 중간자 공격, XSS에 취약할 수 있다. 또한 쿠키 생성에 사용된 알고리즘이 유출되면 쿠키 값을 추측할 수도 있다.
Many applications will automatically log in a user if the correct authentication cookie is provided.
많은 Application은 올바른 인증 쿠키가 제공되면 자동으로 사용자를 로그인 시킨다.
The user should not be able to guess the cookie generation algorithm and bypass the authentication mechanism by logging in as a different user.
사용자가 쿠키 생성 알고리즘을 추측해 인증 매커니즘을 우회하고 다른 사용자로 로그인하지 못하도록 해야 한다.
It is crucial for the security of the authentication system that the cookie generation algorithm remains secure and not easily guessable. If an attacker can predict or determine the algorithm, they may be able to generate valid authentication cookies for different users, thereby bypassing the authentication mechanism and impersonating other users.
쿠키 생성 알고리즘을 안전하고 쉽게 추측할 수 없도록 하는 것이 인증 시스템의 보안에 매우 중요하다. 공격자가 알고리즘을 예측하거나 알아낼 수 있다면 다른 사용자에 대한 유효한 인증 쿠키를 생성할 수 있으므로 인증 매커니즘을 우회해 다른 사용자를 가장할 수 있다.
To mitigate this risk, it is essential to employ robust and cryptographically secure algorithms for generating authentication cookies. These algorithms should use strong randomization and hashing techniques to ensure the uniqueness and unpredictability of the generated cookies.
이러한 위험을 완화시키기 위해 인증 쿠키를 생성할 때 암호학적으로 안전하고 강력한 알고리즘을 사용하는 것이 필수적이다. 이러한 알고리즘은 강력한 무작위성과 해싱 기술을 사용해 생성된 쿠키의 고유성과 예측 불가능성을 보장해야 한다.
Additionally, implementing measures such as session expiration and regular rotation of authentication cookies can further enhance security. By frequently changing the cookie values and enforcing session timeouts, the window of opportunity for attackers to exploit any potential vulnerabilities is significantly reduced.
추가적으로 세션 만료 및 인증 쿠키의 정기적인 회전을 구현하는 등의 조치를 통해 보안을 더욱 강화할 수 있다. 쿠키의 값을 자주 변경하고 세션 초과 시간을 강제하여 공격자가 잠재적인 취약점을 악용할 수 있는 기회를 크게 줄일 수 있다.
Overall, protecting the confidentiality and integrity of the authentication cookie generation algorithm is paramount to prevent unauthorized access and maintain the integrity of the authentication mechanism.
결론적으로 인증 쿠키 생성 알고리즘의 기밀성과 무결성을 보호하는 것이 무단 접근을 방지하고 인증 매커니즘의 무결성을 유지하는 데 필수적이다.
Attempt to bypass the authentication mechanism by spoofing an authentication cookie.
인증 쿠키를 스푸핑하여 인증 매커니즘 우회를 시도해라.
Notes about the login system
When a valid authentication cookie is received, the system will automatically log in the user.
If a cookie is not sent, but the provided credentials are correct, the system will generate an authentication cookie.
Login attempts will be denied under any other circumstances.
유효한 인증 쿠키가 수신되면 시스템은 사용자를 자동으로 로그인 시킨다.
쿠키가 전송되지 않았으나 제공된 자격 증명이 올바른 경우 시스템은 인증 쿠키를 생성한다.
다른 모든 상황에서는 로그인 시도가 거부된다.
Please pay close attention to the feedback messages you receive during the attacks.
공격 중 수신한 피드백 메세지에 주의를 기울여라.
Known credentials:
user name password
webgoat webgoat
admin admin
Goal
Once you have a clear understanding of how the authentication cookie is generated, attempt to spoof the cookie and log in as Tom.
인증 쿠키가 어떻게 생성되는지 명확히 이해한 후, 쿠키를 스푸핑하여 Tom으로 로그인해라.
주어진 두 계정으로 로그인 했을 때 생성되는 쿠키를 확인했다.
Set-Cookie: spoof_auth="NjU0OTQ3NjU1YTQzNmI3NjQ4NjM3NDYxNmY2NzYyNjU3Nw==";
Set-Cookie: spoof_auth=NjU0OTQ3NjU1YTQzNmI3NjQ4NjM2ZTY5NmQ2NDYx;
우선 "=="로 끝나는 것으로 보아 Base64가 적용되었을 수 있겠다는 생각이 든다.
echo "NjU0OTQ3NjU1YTQzNmI3NjQ4NjM3NDYxNmY2NzYyNjU3Nw==" | base64 --decode
654947655a436b76486374616f67626577%
echo "NjU0OTQ3NjU1YTQzNmI3NjQ4NjM2ZTY5NmQ2NDYx" | base64 --decode
654947655a436b7648636e696d6461%
숫자와 문자가 섞여 있고, 문자의 경우 e를 넘지 않으니 문자를 hex 인코딩 처리했을 가능성을 생각해볼 수 있다.
echo "654947655a436b76486374616f67626577" | xxd -r -p
eIGeZCkvHctaogbew%
echo "654947655a436b7648636e696d6461" | xxd -r -p
eIGeZCkvHcnimda%
앞쪽 값(eIGeZCkvHc
)은 동일하고 뒷 문자는 아이디를 거꾸로 사용했다. 만약 동일한 앞쪽 값이 Tom 계정에도 동일하게 사용된다면 Tom 계정의 쿠키 값은 eIGeZCkvHcmot
를 hex 인코딩한 후 이를 Base64로 인코딩한 값일 것이다.
echo -n eIGeZCkvHcmot | xxd -p
NjU0OTQ3NjU1YTQzNmI3NjQ4NjM2ZDZmNzQK
echo -n 654947655a436b7648636d6f74 | base64
NjU0OTQ3NjU1YTQzNmI3NjQ4NjM2ZDZmNzQ=
개행 문자 때문에 잘못된 값이 나오는 것을 방지하기 위해
echo -n
옵션을 추가했다.