pw에 preg_match 함수를 통해 싱글쿼터(')가 필터링되어 있다.

 

%(퍼센트), _(언더스코어) 와일드 카드 
- % : 아무 문자열(빈 문자열 포함) 대체 와일드 카드
- _ : 단일문자 대체 와일드 카드 (언더스코어 하나 당 문자 하나를 의미)
ex1) k% : k로 시작하는 문자열
ex2) %k% : k가 들어가는 문자열
ex3) k__ : k로 시작하는 세글자 문자열

 

이와 같이 ?pw=9%라고 해주었더니 pw 첫번째 자리가 9임을 알 수 있었다.

 

이런식으로 브루트 포스를 통해 숫자값을 대입해준다.

 

?pw=902% 를 입력하였을 때, Hello guest가 아닌 Hello admin이 출력되며 Clear할 수 있었다.90까지는 guest와 pw가 동일했는데 2부터 달라진다고 볼 수 있을 것 같다.

 

 

 

'Web Hacking > Lord of SQL Injection' 카테고리의 다른 글

[Lord of SQL Injection] succubus  (0) 2022.11.19
[Lord of SQL Injection] Giant  (0) 2022.11.06
[Lord of SQL Injection] Bugbear  (0) 2022.10.09
[Lord of SQL Injection] darkknight  (0) 2022.10.02
[Lord of SQL Injection] Golem  (0) 2022.09.24

위는 natas23의 초기화면이다.

 

아래 코드는 View sourcecode를 통해 확인해주었다.

<html>
<head>
<!-- This stuff in the header has nothing to do with the level -->
<link rel="stylesheet" type="text/css" href="http://natas.labs.overthewire.org/css/level.css">
<link rel="stylesheet" href="http://natas.labs.overthewire.org/css/jquery-ui.css" />
<link rel="stylesheet" href="http://natas.labs.overthewire.org/css/wechall.css" />
<script src="http://natas.labs.overthewire.org/js/jquery-1.9.1.js"></script>
<script src="http://natas.labs.overthewire.org/js/jquery-ui.js"></script>
<script src="http://natas.labs.overthewire.org/js/wechall-data.js"></script><script src="http://natas.labs.overthewire.org/js/wechall.js"></script>
<script>var wechallinfo = { "level": "natas23", "pass": "<censored>" };</script></head>
<body>
<h1>natas23</h1>
<div id="content">

Password:
<form name="input" method="get">
    <input type="text" name="passwd" size=20>
    <input type="submit" value="Login">
</form>

<?php
    if(array_key_exists("passwd",$_REQUEST)){
        if(strstr($_REQUEST["passwd"],"iloveyou") && ($_REQUEST["passwd"] > 10 )){
            echo "<br>The credentials for the next level are:<br>";
            echo "<pre>Username: natas24 Password: <censored></pre>";
        }
        else{
            echo "<br>Wrong!<br>";
        }
    }
    // morla / 10111
?>  
<div id="viewsource"><a href="index-source.html">View sourcecode</a></div>
</div>
</body>
</html>

passwd에 iloveyou라는 문자열이 포함되어 있으며, 10보다 크면 비밀번호를 획득할 수 있다.

 

아무 입력 없이 Login 을 눌러주었더니 Wrong! 이라는 문구가 떴다.

 

10보다 커야하기 때문에 10보다 큰 수인 11을 앞에 넣어주고 그 후에 iloveyou 문자열을 붙여주었다.

입력 : 11iloveyou

이를 통해 비밀번호를 구할 수 있었다.

|0xzF30T9Av8lgXhW7slhFCIsVKAPyl2r

'Web Hacking > Natas' 카테고리의 다른 글

[Natas] Level 23 > Level 24  (0) 2022.11.19
[Natas] Level 21 > Level 22  (0) 2022.11.05
[Natas] Level 20 > Level 21  (0) 2022.10.09
[Natas] Level 19 > Level 20  (0) 2022.10.02
[Natas] Level 18 > Level 19  (0) 2022.09.24

 

위는 Challenge 47의 초기 화면이다.

 

send버튼을 눌렀을 때 아래와 같이 메일이 발송되었다는 문구가 떴다.

 

SMTP는 이메일을 보내기 위해 이용하는 프로토콜이다.

해당 문제는 메일과 관련된 취약점인 SMTP Header Injection을 이용하였다. 이는 cc와 bcc를 이용하여 지정한 이메일로 메일을 전송해준다.

 

코드는 다음과 같았다.

줄바꿈이 가능하도록 하기 위해 input을 textarea로 변경해주었다.

 

바꿔주었던 textarea에 

Flag

Bcc: 이메일주소

를 적어서 send버튼을 눌러주었다.

 

이를 통해 문제를 해결할 수 있었다.

 

'Web Hacking > webhacking.kr' 카테고리의 다른 글

[webhacking.kr] Challenge 36  (1) 2022.11.19
[webhacking.kr] Challenge 23  (0) 2022.11.12
[webhacking.kr] Challenge 27  (0) 2022.10.09
[webhacking.kr] Challenge 25  (0) 2022.10.02
[webhacking.kr] Challenge 19  (0) 2022.09.24

shit는 공백, \n, \r, \t가 필터링되어 있으며, 길이가 1보다 길면 안된다.

이 필터링을 우회하기 위해 %0b, %0c와 같은 문자를 이용해보자

 

?shit=%0b 를 입력해주었더니 다음과 같이 문제를 해결할 수 있었다.

'Web Hacking > Lord of SQL Injection' 카테고리의 다른 글

[Lord of SQL Injection] succubus  (0) 2022.11.19
[Lord of SQL Injection] assassin  (0) 2022.11.12
[Lord of SQL Injection] Bugbear  (0) 2022.10.09
[Lord of SQL Injection] darkknight  (0) 2022.10.02
[Lord of SQL Injection] Golem  (0) 2022.09.24

+ Recent posts