본문 바로가기

Web Hacking/Wargame

portswigger : Modifying serialized objects

문제 링크

https://portswigger.net/web-security/deserialization/exploiting/lab-deserialization-modifying-serialized-objects

 

Lab: Modifying serialized objects | Web Security Academy

This lab uses a serialization-based session mechanism and is vulnerable to privilege escalation as a result. To solve the lab, edit the serialized object in ...

portswigger.net

 

 

풀이

그림 1

 

wiener 계정으로 로그인 시, 위 그림 1과 같이 세션이 생성된다. 

 

그림 2

 

해당 객체를 base64 디코딩해보니, 위 그림 2와 같이 직렬화된 객체를 볼 수 있었다. 

 

O:4:"User":2:{s:8:"username";s:6:"wiener";s:5:"admin";b:0;}7

 

처음 위 직렬화된 객체를 아래와 같이 올바르지 않게 수정했었다. 

 

O:4:"User":2:{s:8:"username";s:6:"admin";s:5:"admin";b:0;}7

 

위 잘못된 값을 다시 base64 encoding하여 세션 값을 할당했을 때 결과는 아래와 같았다. 

 

그림 3

 

위 그림 3과 같이 역직렬화 할 수 없다는 에러 메시지가 반환되었다. 

 

O:4:"User":2:{s:8:"username";s:6:"wiener";s:5:"admin";b:1;}7

 

그래서 위와 같이 알맞게 객체 속성 값을 수정해주었고, 결과는 아래와 같이 Admin Panel에 접근할 수 있었다. 

 

그림 4