[Webhacking.kr] Challenge 18

2016. 11. 15. 10:15·Wargame | CTF/Webhacking.kr

Challenge 18


18번은 SQL Injection 문제입니다.

우선 1을 입력해 보았습니다.

위처럼 hi guest 라는 메시지를 출력합니다.

다른 임의의 숫자와 문자를 입력햇을 경우 아무 메세지도 출력되지 않았습니다.

아래 index.phps를 클릭하면 해당 php의 소스를 볼 수 있습니다.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
<? 
if($_GET[no]){ 
 
if(eregi(" |/|\(|\)|\t|\||&|union|select|from|0x",$_GET[no])) exit("no hack"); 
 
$q=@mysql_fetch_array(mysql_query("select id from challenge18_table where id='guest' and no=$_GET[no]")); 
 
if($q[0]=="guest") echo ("hi guest"); 
if($q[0]=="admin") { 
    @solve();
    echo ("hi admin!"); 
    } 
} 
?> 
Colored by Color Scripter
cs

php소스만 가져왔습니다.

쿼리 결과가 guest가 아닌 admin이 나와야 문제가 해결됩니다.

select id from challenge18_table where id='guest' and no=$_GET[no]

조건문을 보면 id에 guest가 고정되어 있습니다. no에 참을 만드는 쿼리를 입력해 보겠습니다.

1 or 1=1를 입력하니 nohack이란 메시지가 출력되었습니다.

공백이 필터링되어 있습니다. 이 부분은 %0a(개행문자), %0d(리턴 케이지) %09(탭)을 이용하여 우회가 가능합니다.

1%0aor%0a1=1을 입력하니 조건절이 참이 되어 guest가 출력되었습니다.

하지만 결과 값이 admin이 되어야합니다. 여기서 limit를 이용하여 guest 다음 쿼리 결과를 가져와 봅니다.

1 or 1=1 limit 1,1을 입력하니 admin이 출력되었습니다.




저작자표시 (새창열림)

'Wargame | CTF > Webhacking.kr' 카테고리의 다른 글

[Webhacking.kr] Challenge 20  (0) 2016.11.15
[Webhacking.kr] Challenge 19 [에러]  (0) 2016.11.15
[Webhacking.kr] Challenge 17  (0) 2016.11.15
[Webhacking.kr] Challenge 16  (0) 2016.11.14
[Webhacking.kr] Challenge 15  (0) 2016.11.14
'Wargame | CTF/Webhacking.kr' 카테고리의 다른 글
  • [Webhacking.kr] Challenge 20
  • [Webhacking.kr] Challenge 19 [에러]
  • [Webhacking.kr] Challenge 17
  • [Webhacking.kr] Challenge 16
zulloper
zulloper
blog
  • zulloper
    zulloper blog
    zulloper
  • 전체
    오늘
    어제
    • Catagory (47)
      • Web (2)
      • Web Hacking (4)
      • CVE (1)
      • Mobile (1)
      • Pwnable (1)
      • Reversing (5)
      • Redteam (2)
      • Python (0)
      • Wargame | CTF (29)
        • Webhacking.kr (25)
        • Suninatas (4)
        • Python Challenge (0)
        • Hack The Box (0)
      • 기타 (0)
  • 블로그 메뉴

    • Category
    • 홈
  • 링크

  • 공지사항

  • 인기 글

  • 태그

    oracle db server sql injection
    ms-sql injection
    oracle injection
    스머글링
    DLL 확인
    ms-sql server
    RAW 값
    RAW 계산식
    burp 인증서
    RAW 비례식
    security header
    oracle db sql injection
    Process 숨기기
    mssql server injection
    oracle sql injection
    action message format
    액션 메시지 포맷
    pwntools
    hsts
    mssql injection
    oracle-sql injection
    http security header
    oracle db injection
    ms injetion
    Export Address Table
    WinDbg
    HTML smuggling
    web
    BurpSuite
    윈디버거
  • 최근 댓글

  • 최근 글

  • hELLO· Designed By정상우.v4.10.1
zulloper
[Webhacking.kr] Challenge 18
상단으로

티스토리툴바