첫 우선 첫 화면은 이러하다.
그래서 index.phps를 눌러 들어가보니
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 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 | <?php if(!$_COOKIE[user]) { $val_id="guest"; $val_pw="123qwe"; for($i=0;$i<20;$i++) { $val_id=base64_encode($val_id); $val_pw=base64_encode($val_pw); } $val_id=str_replace("1","!",$val_id); $val_id=str_replace("2","@",$val_id); $val_id=str_replace("3","$",$val_id); $val_id=str_replace("4","^",$val_id); $val_id=str_replace("5","&",$val_id); $val_id=str_replace("6","*",$val_id); $val_id=str_replace("7","(",$val_id); $val_id=str_replace("8",")",$val_id); $val_pw=str_replace("1","!",$val_pw); $val_pw=str_replace("2","@",$val_pw); $val_pw=str_replace("3","$",$val_pw); $val_pw=str_replace("4","^",$val_pw); $val_pw=str_replace("5","&",$val_pw); $val_pw=str_replace("6","*",$val_pw); $val_pw=str_replace("7","(",$val_pw); $val_pw=str_replace("8",")",$val_pw); Setcookie("user",$val_id); Setcookie("password",$val_pw); echo("<meta http-equiv=refresh content=0>"); } ?> <html> <head> <title>Challenge 6</title> <style type="text/css"> body { background:black; color:white; font-size:10pt; } </style> </head> <body> <? $decode_id=$_COOKIE[user]; $decode_pw=$_COOKIE[password]; $decode_id=str_replace("!","1",$decode_id); $decode_id=str_replace("@","2",$decode_id); $decode_id=str_replace("$","3",$decode_id); $decode_id=str_replace("^","4",$decode_id); $decode_id=str_replace("&","5",$decode_id); $decode_id=str_replace("*","6",$decode_id); $decode_id=str_replace("(","7",$decode_id); $decode_id=str_replace(")","8",$decode_id); $decode_pw=str_replace("!","1",$decode_pw); $decode_pw=str_replace("@","2",$decode_pw); $decode_pw=str_replace("$","3",$decode_pw); $decode_pw=str_replace("^","4",$decode_pw); $decode_pw=str_replace("&","5",$decode_pw); $decode_pw=str_replace("*","6",$decode_pw); $decode_pw=str_replace("(","7",$decode_pw); $decode_pw=str_replace(")","8",$decode_pw); for($i=0;$i<20;$i++) { $decode_id=base64_decode($decode_id); $decode_pw=base64_decode($decode_pw); } echo("<font style=background:silver;color:black> HINT : base64 </font><hr><a href=index.phps style=color:yellow;>index.phps</a><br><br>"); echo("ID : $decode_id<br>PW : $decode_pw<hr>"); if($decode_id=="admin" && $decode_pw=="admin") { @solve(6,100); } ?> </body> </html> | cs |
이런 소스가 있었다.
해석을 해보면 처음에 받은 아이디와 비밀번호를 20번 base64로 인코딩을 해서
쿠키값에 user와 password에 집어넣고 나서
화면에 출력을 해줄때에는 20번 다시 디코딩을 하는 것으로 보인다.
그래서 이것이 solve화면을 띄우려면
id와 password를 admin으로 만들어 줘야 한다.
따라서
admin을 base64로 인코딩을 20번 해 보았다.
그랬더니
Vm0wd2QyUXlVWGxWV0d4V1YwZDRWMVl3WkRSV01WbDNXa1JTVjAxV2JETlhhMUpUVmpBeFYySkVUbGhoTVVwVVZtcEJlRll5U2tWVWJHaG9UVlZ3VlZadGNFSmxSbGw1VTJ0V1ZXSkhhRzlVVmxaM1ZsWmFjVkZ0UmxSTmJFcEpWbTEwYTFkSFNrZGpSVGxhVmpOU1IxcFZXbUZrUjA1R1UyMTRVMkpIZHpGV1ZFb3dWakZhV0ZOcmFHaFNlbXhXVm1wT1QwMHhjRlpYYlVaclVqQTFSMWRyV25kV01ERkZVbFJHVjFaRmIzZFdha1poVjBaT2NtRkhhRk5sYlhoWFZtMXdUMVF3TUhoalJscFlZbGhTV0ZSV2FFTlNiRnBZWlVaT1ZXSlZXVEpWYkZKRFZqQXhkVlZ1V2xaaGExcFlXa1ZhVDJOc2NFZGhSMnhUVFcxb2IxWXhaREJaVmxsM1RVaG9hbEpzY0ZsWmJGWmhZMnhXY1ZGVVJsTk5WMUo1VmpKNFQxWlhTbFpYVkVwV1lrWktTRlpxUm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리어!!!
'WebHacking > Webhacking.kr' 카테고리의 다른 글
Webhacking.kr 26번 (0) | 2017.11.12 |
---|---|
Webhacking.kr 24번 (0) | 2017.11.12 |
Webhacking.kr 4번 (0) | 2017.10.22 |
Webhacking.kr 20번 (0) | 2017.10.16 |
Webhacking.kr 54번 (0) | 2017.10.16 |