[카테고리:] Wargame

Table Names

이번 문제는 Blind SQL Injection 문제이다. 로그인 시 ID 입력 폼에 "test’ or 1=1 #" 라고 입력하면 로그인이 정상적으로 됨을 알 수 있다. 즉, SQL Injection이 가능한 것이다. 따라서 이를 이용해 INFORMATION_SCHEMA.TABLES 테이블의 TABLE_SCHEMA 및 TABLE_NAME 칼럼을 통해 데이터베이스명과 테이블명을 확인할 수 있다. 단, 이름 확인 시 약간의 팁이 필요한데 쿼리 전송 시 올바른 응답이면 …

Addslashes

싱글쿼터 입력 시 addslashes() 함수로 필터할 경우 앞에 \ 문자가 와서 SQL Injection이 예방이 된다. 이번 문제는 이러한 경우 어떻게 우회를 할 수 있는지를 묻는 문제이다. 이번 문제의 풀이 방법은 GBK 인코딩을 이용한 addslashes() 우회기법을 이용하는 것인데 %BF 이후에 싱글쿼터를 입력하게 되면 addslashes() 함수에 의한 필터링을 우회할 수 있다. 따라서 아래와 같이 username 변수에 "test%BF%27 …

A Black Hats Tale

첫 문제는 주어진 pcap 파일을 이용해 WPA를 크랙하는 문제이다. BackTrack을 이용하여 아래와 같이 풀이가 가능하다. root@bt:~# aircrack-ng -w /pentest/wireless/aircrack-ng/test/password.lst wpa_psk.cap Opening wpa_psk.cap Read 17 packets. # BSSID ESSID Encryption 1 00:11:2F:DE:23:3F Z WPA (1 handshake) Choosing first network as target. Opening wpa_psk.cap Reading packets, please wait… Aircrack-ng 1.1 r1899 [00:00:00] 8 keys tested (400.14 k/s) …

WWW-Rewrites

이번 문제는 현재 풀이는 하는 시스템의 IP로 아래와 같은 주소로 요청을 보낸다. http://121.190.4.106:80/ByJJoon/[0-9]+_mul_[0-9]+.html 요청을 받은 후 첫번째 숫자와 두번째 숫자를 곱해서 다시 응답해주는 문제이다. 간단하게 아래와 같이 코드를 작성하여 풀이가 가능하다. #!/usr/bin/env python import socket, re HOST = '0.0.0.0' PORT = 80 s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.bind((HOST, PORT)) s.listen(1) conn, addr = s.accept() print 'Connected …

Register Globals

문제의 코드는 아래와 같다. # Send request? if (isset($_POST['password']) && isset($_POST['username']) && is_string($_POST['password']) && is_string($_POST['username']) ) { $uname = mysql_real_escape_string($_POST['username']); $pass = md5($_POST['password']); $query = "SELECT level FROM ".GWF_TABLE_PREFIX."wc_chall_reg_glob WHERE username='$uname' AND password='$pass'"; $db = gwf_db(); if (false === ($row = $db->queryFirst($query))) { echo GWF_HTML::error('Register Globals', $chall->lang('err_failed')); } else { # Login success $login = …

Prime Factory

Your task is simple: Find the first two primes above 1 million, whose separate digit sums are also prime. As example take 23, which is a prime whose digit sum, 5, is also prime. The solution is the concatination of the two numbers, Example: If the first number is 1,234,567 and the second is 8,765,432, …

BOF 원정대 – Level 20 (death_knight)

문제 소스는 아래와 같다. /* The Lord of the BOF : The Fellowship of the BOF – dark knight – remote BOF */ #include <stdio.h> #include <stdlib.h> #include <errno.h> #include <string.h> #include <sys/types.h> #include <netinet/in.h> #include <sys/socket.h> #include <sys/wait.h> #include <dumpcode.h> main() { char buffer[40]; int server_fd, client_fd; struct sockaddr_in server_addr; struct sockaddr_in client_addr; int …

BOF 원정대 – Level 19 (xavius)

우선 문제 소스는 아래와 같다. /* The Lord of the BOF : The Fellowship of the BOF – xavius – arg */ #include <stdio.h> #include <stdlib.h> #include <dumpcode.h> main() { char buffer[40]; char *ret_addr; // overflow! fgets(buffer, 256, stdin); printf(%s\n, buffer); if(*(buffer+47) == '\xbf') { printf(stack retbayed you!\n); exit(0); } if(*(buffer+47) == '\x08') { printf(binary …

BOF 원정대 – Level 18 (nightmare)

문제 소스는 아래와 같다. /* The Lord of the BOF : The Fellowship of the BOF – nightmare – PLT */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <dumpcode.h> main(int argc, char *argv[]) { char buffer[40]; char *addr; if(argc < 2){ printf(argv error\n); exit(0); } // check address addr = (char *)&strcpy; if(memcmp(argv[1]+44, &addr, 4) …

BOF 원정대 – Level 17 (succubus)

문제 소스는 아래와 같다. /* The Lord of the BOF : The Fellowship of the BOF – succubus – calling functions continuously */ #include <stdio.h> #include <stdlib.h> #include <dumpcode.h> // the inspector int check = 0; void MO(char *cmd) { if(check != 4) exit(0); printf(welcome to the MO!\n); // olleh! system(cmd); } void YUT(void) { …