반응형
Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | ||||
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |
Tags
- ctf-d
- 보고서
- union sql injection
- Import/Export Wordpress Users
- xcz
- 암호학
- Whitespace Programming
- scapy
- LifterLMS
- forensic
- multimedia
- 네트워크
- strcmp 취약점
- 포렌식
- QR코드
- steghide
- Python
- reversing
- zap 파일
- 주요정보통신기반시설 기술적 취약점 분석 평가 상세 가이드
- Stored Cross-Site Scripting
- DOS
- CVE
- 스테가노그래피
- wargame.kr
- volvolatility
- CSV Injection
- 취약점 진단
- Wordpress
- zip 파일 구조
Archives
- Today
- Total
광팔이 보안이야기
[Wargame.kr] strcmp 본문
반응형
Start를 누르면 wargame.kr:8080/strcmp/ 사이트로 넘어가진다.
strcmp 함수를 우회할 수 있으면 플래그를 얻습니다. 우회해야겠다...
else if(isset($_POST['password'])){
sleep(1); // do not brute force!
if (strcmp($_POST['password'], $password) == 0) {
echo "Congratulations! Flag is <b>" . auth_code("strcmp") ."</b>";
exit();
} else {
echo "Wrong password..";
if 문을 보면 strcmp 함수가 있다. strcmp 함수는 첫 번째와 두 번째 값이 같을 때 0을 출력한다.
즉 $_POST['password'] 와 $password 값이 같으면 된다.
그럼 플래그 값을 얻을 수 있다.
$password = sha1(md5(rand().file_get_contents("/var/lib/dummy_file")).rand());
하지만 $password의 값은 암호화되고 있다.
암호화 값을 맞춘다는 건 쉽지 않다. 문제에서 strcmp 함수의 취약점을 이용하라 했으니 한번 이용해보자.
strcmp 함수의 취약점은 if(strcmp(String,Array()==0) 이런 취약점이 있다.
if (strcmp($_POST['password'], $password[]) == 0)
password를 배열로 만들어주면 취약점이 완성된다.
배열로 만들어주고 입력 칸에 아무거나 넣어주면 플래그를 얻을 수 있다.
플래그 값 : 82f65dc251ed45b5f79702fa8db0dcaa16856309
반응형
'Wargame > Wargame.kr' 카테고리의 다른 글
[Wargame.kr] fly me to the moon (0) | 2021.02.18 |
---|---|
[Wargame.kr] WTF_CODE (0) | 2021.02.18 |
[Wargame.kr] login filtering (0) | 2021.02.18 |
[Wargame.kr] QR CODE PUZZLE (0) | 2021.02.18 |
[Wargame.kr] flee button (0) | 2021.02.18 |
Comments