Natas 5–9: 서버 요청/쿠키/필터 우회
다루는 내용:
- 쿠키 기반 인증
- 조건 검사 우회
- 정규식 필터 우회
- LFI 초기 단계
기술 요소:
- Cookie: header 수정
- request parameter tampering
- naive blacklist bypass
Natas5
Application > Cookies > loggedIn을 value를 1로 변경


Natas6
소스코드를 보면 일치 여부를 판단하는 파일 주소를 알 수 있다. 일치하는 값을 넣으면 다음 비밀번호가 나온다.

http://natas6.natas.labs.overthewire.org/includes/secret.inc로 들어가면 아래와 같이 Input된 값과 그 비교 값이 무엇인지 확인 할 수 있다.


Natas7
힌트로 webuser natas8의 비밀번호는 /etc/natas_webpass/natas8에 있습니다.가 제공된다.
home을 클릭해 보고 about을 클릭해보니 page의 인자 값이 변경되는 것을 볼 수 있다.
http://natas7.natas.labs.overthewire.org/index.php?page=/etc/natas_webpass/natas8 로 이동하면 아래 화면이 출력된다.

Natas8
소스 코드를 확인하면 PHP 스크립트가 들어가 있는 것을 확인할 수 있다.
<?
$encodedSecret = "3d3d516343746d4d6d6c315669563362";
function encodeSecret($secret) {
return bin2hex(strrev(base64_encode($secret)));
}
if(array_key_exists("submit", $_POST)) {
if(encodeSecret($_POST['secret']) == $encodedSecret) {
print "Access granted. The password for natas9 is <censored>";
} else {
print "Wrong secret";
}
}
?>
base64로 변경, 문자열 뒤집기, 2진수를 16진수로 바꿔서 비밀번호를 비교하는 것을 알 수 있다.
이걸 뒤집어서 디코딩하면 비밀번호를 알아낼 수 있다.
let a = "3d3d516343746d4d6d6c315669563362";
function hex2bin(hex) {
const bytes = [];
for (let i = 0; i < hex.length; i += 2) {
bytes.push(parseInt(hex.substr(i, 2), 16));
}
const binString = String.fromCharCode(...bytes);
return binString;
}
console.log(atob(hex2bin(a).split('').reverse().join('')))
javascript로 함수를 만들어서 값을 넣으니 비밀 번호를 얻을 수 있었다.


Natas9
<?
$key = "";
if(array_key_exists("needle", $_REQUEST)) {
$key = $_REQUEST["needle"];
}
if($key != "") {
passthru("grep -i $key dictionary.txt");
}
?>
삽입된 스크립트를 보니 리눅스 명령어를 이용해 검색을 하는 것을 알 수 있다.
Natas7을 보면 '/etc/natas_webpass/'에 비밀번호가 저장됨을 알 수 있다.
/etc/natas_webpass/natas8

다음과 같이 비밀번호를 얻을 수 있다.
'Security > OverTheWire' 카테고리의 다른 글
| Natas 14 15 (0) | 2026.03.16 |
|---|---|
| Natas 10 11 12 13 (파일 업로드 / 명령 실행 / injection) (0) | 2025.12.03 |
| Natas 0 1 2 3 4 (기초적인 웹 구조) (0) | 2025.12.03 |
| Bandit Level 32 → Level 33, Bandit Level 33 → Level 34 (0) | 2025.12.02 |
| Bandit Level 30 → Level 31 (git tag), Bandit Level 31 → Level 32 (0) | 2025.12.02 |