cascade
http://chall.csivit.com:30203/
문제에 들어가보면 "/static/stype.css"가 있다.
해당 위치로 이동해보면 css 속성들과 그 사이에 주석으로 flag가 존재한다.
csictf{w3lc0me_t0_csictf}
oreo
http://chall.csivit.com:30243/
문제에 접속한 뒤 쿠키를 확인해보면 flavour이라는 쿠키가 추가된다.
값을 base64로 디코딩해보면 strawberry라고 뜬다. 하지만 chocolate 오레오를 먹고 싶어하니 쿠키 값을 초콜릿으로 바꿔야 한다.
쿠키 값을 초콜릿으로 변경하면 flag가 출력된다.
csictf{1ick_twi5t_dunk}
warm up
http://chall.csivit.com:30272/
문제에 접속하면 소스 코드가 출력된다. 이때 sha1(10932435112)에 대해서 구글링해보면 이 값은 매직 해시인 것을 알 수 있다.
PHP에서는 1e2를 1*10^2로 인식한다. 따라서 0e~로 시작하게 된다면 뒤에 무슨 값이 오든 결과값은 0이 될 것이다. 매직 해시란 '0e'로 시작하는 문자열 뒤의 값들이 전부 숫자인 경우를 의미한다. 이는 PHP 상에서 flaot 형태로 인식되고, 값을 계산해보면 모두 0이 된다.
github.com/spaze/hashes/blob/master/sha1.md
위의 주소를 참고하여 문제를 해결했다. 매직해시들이 정리되어 있다.
매직해시 중 하나를 get 방식으로 전달하면 flag가 출력된다.
csictf{typ3_juggl1ng_1n_php}
secure portal
이 문제는 패스워드를 알아내서 입력해야 한다. 소스코드를 확인해보면 난독화된 자바스크립트 코드가 존재한다.
var _0x575c=['\x32\x2d\x34','\x73\x75\x62\x73\x74\x72\x69\x6e\x67','\x34\x2d\x37','\x67\x65\x74\x49\x74\x65\x6d','\x64\x65\x6c\x65\x74\x65\x49\x74\x65\x6d','\x31\x32\x2d\x31\x34','\x30\x2d\x32','\x73\x65\x74\x49\x74\x65\x6d','\x39\x2d\x31\x32','\x5e\x37\x4d','\x75\x70\x64\x61\x74\x65\x49\x74\x65\x6d','\x62\x62\x3d','\x37\x2d\x39','\x31\x34\x2d\x31\x36','\x6c\x6f\x63\x61\x6c\x53\x74\x6f\x72\x61\x67\x65',];(function(_0x4f0aae,_0x575cf8){var _0x51eea2=function(_0x180eeb){while(--_0x180eeb){_0x4f0aae['push'](_0x4f0aae['shift']());}};_0x51eea2(++_0x575cf8);}(_0x575c,0x78));var _0x51ee=function(_0x4f0aae,_0x575cf8){_0x4f0aae=_0x4f0aae-0x0;var _0x51eea2=_0x575c[_0x4f0aae];return _0x51eea2;};function CheckPassword(_0x47df21){var _0x4bbdc3=[_0x51ee('0xe'),_0x51ee('0x3'),_0x51ee('0x7'),_0x51ee('0x4'),_0x51ee('0xa')];window[_0x4bbdc3[0x0]][_0x4bbdc3[0x2]]('9-12','BE*');window[_0x4bbdc3[0x0]][_0x4bbdc3[0x2]](_0x51ee('0x2'),_0x51ee('0xb'));window[_0x4bbdc3[0x0]][_0x4bbdc3[0x2]](_0x51ee('0x6'),'5W');window[_0x4bbdc3[0x0]][_0x4bbdc3[0x2]]('16',_0x51ee('0x9'));window[_0x4bbdc3[0x0]][_0x4bbdc3[0x2]](_0x51ee('0x5'),'pg');window[_0x4bbdc3[0x0]][_0x4bbdc3[0x2]]('7-9','+n');window[_0x4bbdc3[0x0]][_0x4bbdc3[0x2]](_0x51ee('0xd'),'4t');window[_0x4bbdc3[0x0]][_0x4bbdc3[0x2]](_0x51ee('0x0'),'$F');if(window[_0x4bbdc3[0x0]][_0x4bbdc3[0x1]](_0x51ee('0x8'))===_0x47df21[_0x51ee('0x1')](0x9,0xc)){if(window[_0x4bbdc3[0x0]][_0x4bbdc3[0x1]](_0x51ee('0x2'))===_0x47df21['substring'](0x4,0x7)){if(window[_0x4bbdc3[0x0]][_0x4bbdc3[0x1]](_0x51ee('0x6'))===_0x47df21[_0x51ee('0x1')](0x0,0x2)){if(window[_0x4bbdc3[0x0]][_0x4bbdc3[0x1]]('16')===_0x47df21[_0x51ee('0x1')](0x10)){if(window[_0x4bbdc3[0x0]][_0x4bbdc3[0x1]](_0x51ee('0x5'))===_0x47df21[_0x51ee('0x1')](0xc,0xe)){if(window[_0x4bbdc3[0x0]][_0x4bbdc3[0x1]](_0x51ee('0xc'))===_0x47df21[_0x51ee('0x1')](0x7,0x9)){if(window[_0x4bbdc3[0x0]][_0x4bbdc3[0x1]](_0x51ee('0xd'))===_0x47df21[_0x51ee('0x1')](0xe,0x10)){if(window[_0x4bbdc3[0x0]][_0x4bbdc3[0x1]](_0x51ee('0x0'))===_0x47df21[_0x51ee('0x1')](0x2,0x4))return!![];}}}}}}}return![];}
이를 난독화 해제 사이트를 통하여 해제해보았다.
var _0x575c = ['\x32\x2d\x34', '\x73\x75\x62\x73\x74\x72\x69\x6e\x67', '\x34\x2d\x37', '\x67\x65\x74\x49\x74\x65\x6d', '\x64\x65\x6c\x65\x74\x65\x49\x74\x65\x6d', '\x31\x32\x2d\x31\x34', '\x30\x2d\x32', '\x73\x65\x74\x49\x74\x65\x6d', '\x39\x2d\x31\x32', '\x5e\x37\x4d', '\x75\x70\x64\x61\x74\x65\x49\x74\x65\x6d', '\x62\x62\x3d', '\x37\x2d\x39', '\x31\x34\x2d\x31\x36', '\x6c\x6f\x63\x61\x6c\x53\x74\x6f\x72\x61\x67\x65', ];
(function (_0x4f0aae, _0x575cf8) {
var _0x51eea2 = function (_0x180eeb) {
while (--_0x180eeb) {
_0x4f0aae['push'](_0x4f0aae['shift']());
}
};
_0x51eea2(++_0x575cf8);
} (_0x575c, 0x78));
var _0x51ee = function (_0x4f0aae, _0x575cf8) {
_0x4f0aae = _0x4f0aae - 0x0;
var _0x51eea2 = _0x575c[_0x4f0aae];
return _0x51eea2;
};
function CheckPassword(_0x47df21) {
var _0x4bbdc3 = [_0x51ee('0xe'), _0x51ee('0x3'), _0x51ee('0x7'), _0x51ee('0x4'), _0x51ee('0xa')];
window[_0x4bbdc3[0x0]][_0x4bbdc3[0x2]]('9-12', 'BE*');
window[_0x4bbdc3[0x0]][_0x4bbdc3[0x2]](_0x51ee('0x2'), _0x51ee('0xb'));
window[_0x4bbdc3[0x0]][_0x4bbdc3[0x2]](_0x51ee('0x6'), '5W');
window[_0x4bbdc3[0x0]][_0x4bbdc3[0x2]]('16', _0x51ee('0x9'));
window[_0x4bbdc3[0x0]][_0x4bbdc3[0x2]](_0x51ee('0x5'), 'pg');
window[_0x4bbdc3[0x0]][_0x4bbdc3[0x2]]('7-9', '+n');
window[_0x4bbdc3[0x0]][_0x4bbdc3[0x2]](_0x51ee('0xd'), '4t');
window[_0x4bbdc3[0x0]][_0x4bbdc3[0x2]](_0x51ee('0x0'), '$F');
if (window[_0x4bbdc3[0x0]][_0x4bbdc3[0x1]](_0x51ee('0x8')) === _0x47df21[_0x51ee('0x1')](0x9, 0xc)) {
if (window[_0x4bbdc3[0x0]][_0x4bbdc3[0x1]](_0x51ee('0x2')) === _0x47df21['substring'](0x4, 0x7)) {
if (window[_0x4bbdc3[0x0]][_0x4bbdc3[0x1]](_0x51ee('0x6')) === _0x47df21[_0x51ee('0x1')](0x0, 0x2)) {
if (window[_0x4bbdc3[0x0]][_0x4bbdc3[0x1]]('16') === _0x47df21[_0x51ee('0x1')](0x10)) {
if (window[_0x4bbdc3[0x0]][_0x4bbdc3[0x1]](_0x51ee('0x5')) === _0x47df21[_0x51ee('0x1')](0xc, 0xe)) {
if (window[_0x4bbdc3[0x0]][_0x4bbdc3[0x1]](_0x51ee('0xc')) === _0x47df21[_0x51ee('0x1')](0x7, 0x9)) {
if (window[_0x4bbdc3[0x0]][_0x4bbdc3[0x1]](_0x51ee('0xd')) === _0x47df21[_0x51ee('0x1')](0xe, 0x10)) {
if (window[_0x4bbdc3[0x0]][_0x4bbdc3[0x1]](_0x51ee('0x0')) === _0x47df21[_0x51ee('0x1')](0x2, 0x4)) return !! [];
}
}
}
}
}
}
}
return ! [];
}
스크립트 코드를 확인해보면 if 문을 반복하며 패스워드를 체크하고 있다. input 값으로 "1234567890abcdef"를 준 후, 비교하는 두 값을 출력하며 패스워드의 순서를 확인한 후 패스워드를 재구성 하였다.
12:"5W"
34:"$F"
567:"bb="
89:"+n"
0ab:"BE*"
cd:"pg"
ef:"4t"
:"^7M"
5W$Fbb=+nBE*pg4t^7M
csictf{l3t_m3_c0nfus3_y0u}
'CTF > 웹 해킹' 카테고리의 다른 글
Google CTF 2020 (0) | 2020.09.08 |
---|---|
Google CTF 2019 (0) | 2020.06.29 |
xss game level 3 (0) | 2020.06.29 |
xss game level 2 (0) | 2020.06.29 |
xss game level 1 (0) | 2020.06.29 |