About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
. w5 x( ~" n0 p$ w/ {# R* Y<TBODY>& ?: e, I* A/ Z
<TR>
# t/ p- P9 R( b) ?; F<TD><PRE>Method 01 ) X3 B* E) S' U" j
=========' q" y: l2 l  e- _/ `5 d/ c+ K

! m2 c% K& P' i3 w3 ~) F$ }5 |  qThis method of detection of SoftICE (as well as the following one) is7 z# c+ q6 @" [5 k
used by the majority of packers/encryptors found on Internet.  w9 t& O0 m7 |: |
It seeks the signature of BoundsChecker in SoftICE
# F: o6 r  A* o0 b. F
/ {6 L% J, ^7 d% m1 W0 I* Z. @    mov     ebp, 04243484Bh        ; 'BCHK'/ H& g  M& s! k, I
    mov     ax, 04h, z4 j) U3 r8 L2 o
    int     3       ( ^$ W3 R) C7 B2 e5 f" L5 q$ n9 }
    cmp     al,4
8 c7 B0 G: _5 W8 S  ?7 H    jnz     SoftICE_Detected
- Q/ h  }( c3 @2 o/ X2 o6 B4 ~6 Q% v/ N5 c: D
___________________________________________________________________________
' j) Y% l! t) N" k
: C9 ]) K9 _% V6 S& eMethod 02
& j8 y4 ]: m$ h1 m=========. A1 v3 e6 K. m. K

6 B, Z$ s9 V8 O% ?, A7 u) PStill a method very much used (perhaps the most frequent one).  It is used3 J7 C4 n2 v( v, x& p2 o
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,
) L. L* s! m) ^" Tor execute SoftICE commands...
' d, x1 B9 {9 p- g3 i) GIt is also used to crash SoftICE and to force it to execute any commands; x5 a5 A5 i  Q4 p# X8 W" N% u
(HBOOT...) :-((  
+ w9 X; z8 I9 ?' u- X+ e1 m- O7 ?9 W* N
: v& f1 n  O6 xHere is a quick description:
* Q  T5 B  ]' u. R4 \+ ?: \-AX = 0910h   (Display string in SIce windows)8 O2 V: F5 F4 H7 w6 i+ W- p
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)3 Y0 [, L" Y1 A% f- \( W; y2 n
-AX = 0912h   (Get breakpoint infos)
6 }/ n0 v$ u* x-AX = 0913h   (Set Sice breakpoints)
# B3 a" l5 J5 Z+ W9 Z4 |-AX = 0914h   (Remove SIce breakoints)
8 a* j. B8 V& y+ |2 C. g: T% _# B- D* O+ C5 S+ ?
Each time you'll meet this trick, you'll see:
  H4 N! w' N1 }/ L-SI = 4647h
* J' I' u% m; a-DI = 4A4Dh6 A& U$ w9 v" d0 d: o4 \$ e
Which are the 'magic values' used by SoftIce.7 y  q, J5 I2 M4 x( H# K
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.4 w# D+ ^3 k; Q+ I/ G7 J) E
0 K$ U" G1 C- f; X- R5 ~: Z
Here is one example from the file "Haspinst.exe" which is the dongle HASP9 ?! K" l8 }5 F# F* j8 x9 n; Y
Envelope utility use to protect DOS applications:
4 s2 C) i& d, K" j' D7 T6 y0 @1 p: ?
9 k! C6 f7 \9 l$ J! k" R
4C19:0095   MOV    AX,0911  ; execute command.( U% T: K8 P  V: E& `- S
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
" H' u6 L- d8 ]# O( P& u4C19:009A   MOV    SI,4647  ; 1st magic value.
8 `. U9 P, x8 j8 k4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
, k! ]3 F/ a. ^& f% E, U4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
8 m" {4 H0 j+ J# ]1 d: f4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute0 G/ P" s% H. p" y1 G
4C19:00A4   INC    CX
* N( }' H  l* X2 _! p2 z4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
2 i" P% k& m" m7 ]9 B4C19:00A8   JB     0095     ; 6 different commands.8 x# Q2 {  {; h  W
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
! H9 z% c: T1 f+ `4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
+ K# W+ C4 `) c/ R( i
2 p$ n2 E8 D1 |7 u5 JThe program will execute 6 different SIce commands located at ds:dx, which# l. H* o" J7 c/ n
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.2 E$ a$ w- m* x0 s
' B4 }6 J! b7 g  p5 B
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.: R/ V2 C/ i4 f  Y5 h* ]
___________________________________________________________________________" D" S! r9 u6 K# h

, J% h3 G0 p% N% O! p
0 z& L( x1 c" m" cMethod 033 V6 H! b1 @7 t; M
=========# `. N# H/ u) `$ k! ^; a
3 d* P& r7 k1 y7 I1 p) ]# b9 c' ]
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
8 a: Y( h1 Y: H/ N(API Get entry point)/ L8 K" u. C- @( k7 `3 B) R$ s; p7 |
        2 p' P$ E4 t# u; E" s5 c' ?
7 x- v9 }6 g7 K
    xor     di,di
/ E( S4 Z1 y; ^, V) W; f$ s    mov     es,di
0 n5 ]0 Y( i5 k! ?0 T5 q    mov     ax, 1684h      
$ g4 J( f6 k! m    mov     bx, 0202h       ; VxD ID of winice
5 C" g# y2 w8 R2 Q: |    int     2Fh( C' l3 U1 {6 r" t. B- k" y
    mov     ax, es          ; ES:DI -&gt; VxD API entry point' i& a# n) t+ P. U" [7 r8 I
    add     ax, di
! n2 H. Y+ _7 P3 v9 T    test    ax,ax
5 g9 B% j4 B6 Q5 V7 |% n    jnz     SoftICE_Detected- {( @7 D  [, `- L4 C) _% h
# S8 P# z; X1 k0 F1 c
___________________________________________________________________________
" }' `4 }/ e; r; [0 G( ?: K$ B/ H1 [1 X8 E! c% @/ W5 d
Method 04
- e" T! r) m! _=========$ R! i* U) {( ^! \

  Q  K# v7 V2 R9 ?! I. z! n1 U! EMethod identical to the preceding one except that it seeks the ID of SoftICE
8 H4 N& {6 d, J7 I$ K. _GFX VxD.0 O/ z1 x: l2 z6 ]1 x2 g* t
0 w8 q$ K/ @* W! C# J( k- g
    xor     di,di6 d9 X9 u8 g  u& S0 e
    mov     es,di
3 M. v2 K! s4 {$ |    mov     ax, 1684h      
4 }  b& s% [: H    mov     bx, 7a5Fh       ; VxD ID of SIWVID' ~( C: f3 V7 R7 i0 X
    int     2fh' v! T, u- \- m% R& Z4 C
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
! y3 v6 h  Y" e) ^    add     ax, di
1 I5 X. Q4 e: F! V! T    test    ax,ax! O! ]; y& w% w% \1 p' X
    jnz     SoftICE_Detected
$ R' k1 j9 Z" f! M
" u( e5 B0 B/ p1 m& o( N, Q- i__________________________________________________________________________
- n2 E) M, q( @8 [3 I" y$ L: `6 e. q- C/ {0 e
6 p5 g! L. @/ w1 k' P# }
Method 05
: V' j+ I# i5 g) v2 @# X) |8 f=========2 c2 [* q7 A7 ^2 E  l
7 w" Q" f7 w1 W7 a' Y, k& ^
Method seeking the 'magic number' 0F386h returned (in ax) by all system
( y8 ^3 r( ?; kdebugger. It calls the int 41h, function 4Fh.
% d8 L/ D' Y& U$ R9 KThere are several alternatives.  
  r2 D) w: ^8 g0 b; d1 p8 U8 t; y( A" e# M3 j; k; ]3 `
The following one is the simplest:
1 R) j+ p/ [; r5 Z
" X1 c- `4 B  W5 H3 `    mov     ax,4fh
' B" x4 U$ _1 m7 |    int     41h
5 V" R1 i& o% r5 r& B8 S3 o    cmp     ax, 0F3863 S# P, n% x$ |+ p
    jz      SoftICE_detected
/ a  s3 I/ `8 k3 j* i9 x  j( A# M; E/ a" T6 p  O- T  r

0 A, t. H5 U" ^2 V* m- t& CNext method as well as the following one are 2 examples from Stone's
+ I- H; y" M6 A5 D! I- G7 ?"stn-wid.zip" (www.cracking.net):, ~9 x" {" I) V+ n- O2 |

' V7 l3 l$ }: I# L    mov     bx, cs
% d% t& _/ x5 c/ |5 M0 Q    lea     dx, int41handler2/ c" w( ]  E- }7 r
    xchg    dx, es:[41h*4]
# o: U& u8 a" m- I) C    xchg    bx, es:[41h*4+2]1 T, ]; F, ~% x2 [9 Q; T8 u
    mov     ax,4fh' p. t; Q$ x- _/ c8 X+ }
    int     41h
. M( ?8 v+ E: t    xchg    dx, es:[41h*4]
+ B4 h  S$ U, V1 k6 ^# P7 d& ^+ {    xchg    bx, es:[41h*4+2]
; Z0 Z* C; O/ Y" ]    cmp     ax, 0f386h
: M" P% n: Y% e& L: _    jz      SoftICE_detected
1 r) c! X$ V) h9 P4 {9 H) I) l
7 v( P2 _6 f0 q" Tint41handler2 PROC
6 ~' h! k" T2 [( u& B/ M$ G2 h    iret1 z- p9 x* z5 y$ v
int41handler2 ENDP7 N; m" E- _/ Y( Z7 W' C. n3 d
/ W3 y' j: y0 a1 Y3 k2 F

3 x& J" @' U% u/ [  x  Y+ f9 g_________________________________________________________________________
9 ?6 B# E+ I4 U. g* Q) X' E+ V; G  H) b; [5 T' F( G
! a7 m2 C* I% R8 x- Y: l
Method 06+ M- N# a& Q$ @. i1 R1 o9 r1 N
=========
8 b3 r$ A0 Q1 D  v) o2 }* H5 C, E8 D, @

0 h2 E1 A, s8 x+ o+ G8 |4 r2nd method similar to the preceding one but more difficult to detect:
/ i2 I6 z" q. u, b) |- D; H: b1 M4 m& v* P
$ R+ M; o. w$ j
int41handler PROC
) I, j; z. u! s, B5 _    mov     cl,al
1 Z- U8 A+ k) C    iret# _+ W/ J: G) n2 O
int41handler ENDP
" n& m; V: P; ]& h. l8 h# g8 h( F+ X+ a
. ]1 u% X, r2 H5 M0 N! q6 k6 W
    xor     ax,ax
/ }; N/ Z9 V. ]' H# `. J4 `& w2 y    mov     es,ax
" H& H: S1 C1 i! g$ n: [& x    mov     bx, cs* I7 _! Q+ m! G5 n: K6 h
    lea     dx, int41handler
8 l# C+ G  g4 Z1 a- V, `) p    xchg    dx, es:[41h*4]% ~2 C- q, n; }" H# P" F% f
    xchg    bx, es:[41h*4+2]
: Y4 S! Y5 f3 G( `/ |" t    in      al, 40h5 r$ G5 `  ~9 X+ w1 W4 A/ X
    xor     cx,cx2 I! j% C/ q4 H2 i+ `
    int     41h. _& S% p$ K+ L, u4 [; Y
    xchg    dx, es:[41h*4]
$ j1 _* b4 k& f- _# m& O; `    xchg    bx, es:[41h*4+2]" K' m/ J! M4 u0 X! ^8 }3 [
    cmp     cl,al
; @1 I; d( T3 A* I/ m$ j" ?    jnz     SoftICE_detected) K) S# n/ J' s% ^* q9 R

! o8 d4 y( E* g' g$ ^6 A_________________________________________________________________________
8 _- {2 Z* v- q' m/ f, Z
6 l  |* j8 c9 x9 X- eMethod 07
! i; J, ]& e! {; @=========2 b$ R$ L; Q' _7 V3 Q

0 r+ v4 M% E; l2 z( c' b4 d; oMethod of detection of the WinICE handler in the int68h (V86)' ]% t* s( i% g/ S- P7 ^

2 q( s: k- [+ E    mov     ah,43h
: |5 {8 d2 p# v    int     68h) P. c0 Z. A% v0 o/ `5 |
    cmp     ax,0F386h3 W" n2 D' n7 b$ O( K9 d3 C6 Y
    jz      SoftICE_Detected
! F5 s( g) S4 [/ W0 B, Q
; V$ T' \( `9 A8 S6 g! K5 w- o
! [6 ~% `' ?1 v4 |$ Z8 _=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit$ l) I9 K' h  S- Y$ _- A: L
   app like this:
# R0 J+ f+ F1 L" l. E7 p; O1 S
* T* ~1 @& H6 y, o, o, r7 i   BPX exec_int if ax==68
$ w$ F: I  j0 d5 `# ]/ |! r+ N   (function called is located at byte ptr [ebp+1Dh] and client eip is
, R' w$ G* U- I( |; _1 G6 r  I   located at [ebp+48h] for 32Bit apps)
9 V: c. v3 q5 B0 }8 Q0 B__________________________________________________________________________$ D, b4 t. B6 _/ {
! i6 k2 m: o( ^
! B7 w+ k1 D; J/ `* y& T  H
Method 08
0 m: e6 N& V) ]1 `  {8 F=========
7 k) C/ E" [. R) N% l
  L* e  Y4 @' a, E+ R4 VIt is not a method of detection of SoftICE but a possibility to crash the
6 M% c& `" r' z. b2 K6 i- Fsystem by intercepting int 01h and int 03h and redirecting them to another9 D1 g  U1 `# |' Y( F! O
routine.
2 V  W; B9 c9 Q0 ]' e7 gIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points! ~* g1 f5 }7 ^9 ~, n: B
to the new routine to execute (hangs computer...)4 M" g8 b, h+ G+ ~# E& e' V4 J4 G
6 f( f3 [' d' J# v$ c
    mov     ah, 25h- m3 u: d4 n4 _
    mov     al, Int_Number (01h or 03h)
; Y, {* G; `, Y5 v    mov     dx, offset New_Int_Routine
; v0 u7 e! N, \# y7 T4 |    int     21h- W! [& g0 r7 M+ M4 d/ M: a% V% E3 v' i
' x; a* D# k9 o
__________________________________________________________________________
$ q% d$ e1 r2 v0 S! w! g3 I. S6 _6 y0 W
Method 095 [, a* L; R6 W7 x# h) ~1 ?+ f
=========  Q5 _1 d1 C8 {# }% v% W  q

* Q& f2 A1 R7 Q; e8 V, vThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
" z# k4 F% i3 ~8 Yperformed in ring0 (VxD or a ring3 app using the VxdCall).0 l' ?, g1 x& ^- G( W7 l
The Get_DDB service is used to determine whether or not a VxD is installed! n6 W! b0 z& b' p
for the specified device and returns a Device Description Block (in ecx) for
6 B# L7 w, l8 r6 Wthat device if it is installed.
/ t, V5 `5 R2 u* r: @% H5 R" c, {( u9 w- n
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID& N: H+ n' S4 L8 E* \
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
) ?/ ^9 y% i. Y6 @9 T   VMMCall Get_DDB% ^) r/ {' \$ M# _" O9 j: D) N/ e
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
* ~3 ^, P$ [+ K6 I6 Q
: S  c/ H! p( g( c' J( k% xNote as well that you can easily detect this method with SoftICE:3 c" S* m- c( _" V; u6 ~/ L" A
   bpx Get_DDB if ax==0202 || ax==7a5fh
( W+ q6 {1 ~# C& }$ E' h. b' ^# I6 s0 o9 m8 ^# Y
__________________________________________________________________________0 e5 r0 o" y) d* s7 W

6 O+ g; g8 D# A( zMethod 10! B. e, g, W2 o, J8 L  e
=========
9 k: B5 T, N5 A4 V- d" N( ?
8 M% n- b: W" G- W=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with1 S* A4 V1 a1 h- F
  SoftICE while the option is enable!!
, S4 L2 U- c. p& p; _! n4 h
; N0 ^) a' K/ `& B* yThis trick is very efficient:+ U4 s5 M8 c+ V% J9 P8 I! j9 ~( e
by checking the Debug Registers, you can detect if SoftICE is loaded$ Q5 X# B0 D% I0 s) B
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
: c% D' l4 C# Z( O2 ~7 W# Ythere are some memory breakpoints set (dr0 to dr3) simply by reading their- H6 P; g5 _" i1 X3 z6 H8 w/ x
value (in ring0 only). Values can be manipulated and or changed as well% b$ ^+ Y& t& o& J
(clearing BPMs for instance)7 C- {4 E( V" i! W- I2 \. ]+ ]; E2 l

9 z9 y3 C! q6 ~1 A6 ~9 t__________________________________________________________________________# W2 v. g9 j: K$ V6 C
! t8 b8 O/ e, O9 I3 I
Method 11
0 ?0 h" I$ H5 }6 b. N=========% U6 t# H: @7 M3 |
' p6 c  m- E9 b9 Z, d7 f# T0 i
This method is most known as 'MeltICE' because it has been freely distributed
( W4 S' @: _! P: pvia www.winfiles.com. However it was first used by NuMega people to allow, X8 w7 G- z- g- a  `
Symbol Loader to check if SoftICE was active or not (the code is located
7 z# P' [  b! I, P: y$ O* a6 ~0 cinside nmtrans.dll).# B( Y8 t$ @: V) e! v3 S

5 P, a5 _; Y1 O5 j' i; k/ S# w# EThe way it works is very simple:4 w+ y) \; z4 V- c
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
- Q0 K2 }3 J6 B& gWinNT) with the CreateFileA API.
9 K! `! k8 R7 W' o) G) K+ T5 ?6 o8 i0 q: U; @
Here is a sample (checking for 'SICE'):
4 K1 w0 N+ H, E% E/ e# M6 @7 d& E) G5 e! j6 L8 d9 w
BOOL IsSoftIce95Loaded(): ^$ X  \! u3 n: B
{
: m& {/ Q+ q4 f2 z: z   HANDLE hFile;  
; F( V' v! ?, m( I* o4 l/ ]   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,& Q& Y2 B5 ]0 Z- D% b" f
                      FILE_SHARE_READ | FILE_SHARE_WRITE,
8 B# [" s8 k8 w1 S- t/ I# L2 d                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);4 b9 \. a4 }7 W; l# b
   if( hFile != INVALID_HANDLE_VALUE )$ |" N+ d7 ]9 g. ?" `. ^
   {
6 U. @$ B  ~: ?' F& r      CloseHandle(hFile);
' C0 |  c% W& B2 M' h! _- n      return TRUE;  r" ~# F! {! U, Y8 a
   }
6 ?, N- I2 q) s7 J   return FALSE;
/ @; {: r) O$ x# J5 M}0 s. ]9 P$ I/ L1 i6 D' F
9 P* k5 o/ [$ |1 I6 N/ l
Although this trick calls the CreateFileA function, don't even expect to be4 D: ~7 a- V. w+ b8 e+ O% ^
able to intercept it by installing a IFS hook: it will not work, no way!- n6 W0 ^2 M- r, z6 N3 X+ U
In fact, after the call to CreateFileA it will get through VWIN32 0x001F9 U5 h8 Z* a! u
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
6 n. F0 V7 e6 |! ~; i! t& y( `and then browse the DDB list until it find the VxD and its DDB_Control_Proc
/ r3 a5 E& A$ y  q, W' z% nfield.
- F$ e5 u& l1 EIn fact, its purpose is not to load/unload VxDs but only to send a
8 {, @  ]+ I  L* SW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)9 r, ]+ P$ B' g3 k5 N5 ^# [
to the VxD Control_Dispatch proc (how the hell a shareware soft could try, J6 o8 D" `2 j1 O8 B( Q5 [1 X
to load/unload a non-dynamically loadable driver such as SoftICE ;-).
8 e5 j3 Q! f" o, ?! mIf the VxD is loaded, it will always clear eax and the Carry flag to allow
5 T2 M+ `9 C# Wits handle to be opened and then, will be detected.
/ P4 E4 h& j0 l- v/ o3 k1 mYou can check that simply by hooking Winice.exe control proc entry point: J! k2 U* ^  b) X
while running MeltICE.
  Z/ [* R* }+ y% a9 I& a; G! j( l( i% g+ t* ]9 W9 o9 E7 q

1 P3 J8 u5 Y* e5 T, g  00401067:  push      00402025    ; \\.\SICE
- E4 a3 I& t$ q  0040106C:  call      CreateFileA
7 ^/ A# L0 b5 w  00401071:  cmp       eax,-001  [3 V% R5 C% I- t) a1 s
  00401074:  je        004010919 |% t' B9 t: s% F' g/ ]

$ R8 L! m" a/ [- u  j1 v0 B  r4 h( m+ \" z! J& Y  W
There could be hundreds of BPX you could use to detect this trick.3 R0 S: p' V" x1 t/ o. S! X" s. [
-The most classical one is:* Y$ i: I& n, R1 F' a" p
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||. ]. ^4 F9 {* g5 B4 V
    *(esp-&gt;4+4)=='NTIC'
  J8 B& t* ^! S" o% R3 Y; g/ p
& o5 B, J4 _8 S9 t5 V-The most exotic ones (could be very slooooow :-(
7 i, |$ s/ v' V   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
8 x  X3 j, j4 @( W     ;will break 3 times :-(& n" |1 ^5 n$ A$ Z

4 i- g& P& {  x6 `+ m-or (a bit) faster: 7 L% p9 S/ B7 G$ _2 M/ p% e
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')8 A# z* n) K( M
  m5 z  z( U* F) p
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  ' P1 V0 i2 s' m" R) B
     ;will break 3 times :-(( j- p% U6 f* y5 A% v8 m
0 X8 F) F- }/ Z) |. Q" G0 }0 J1 T: o
-Much faster:1 p# @; w( X( H4 ?4 Z; k
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
, T* c) @5 E5 w5 F+ c# e
2 ~' H& h, F. O3 mNote also that some programs (like AZPR3.00) use de old 16-bit _lopen1 q" s; Z3 [$ @6 I2 M$ m
function to do the same job:! ]. k2 `# k. g" w$ _4 a8 E

  l8 F+ e" v$ o( z6 N   push    00                        ; OF_READ: |4 T# W7 W" g$ i8 q7 _- ]
   mov     eax,[00656634]            ; '\\.\SICE',0
, ~7 Y+ p% s1 _* y; _   push    eax
1 s: \, K9 l2 p- M$ J* Y- S   call    KERNEL32!_lopen
2 R  N* B; A' y6 b  B" m! ~$ f   inc     eax) J% w" b* c& |! l8 H8 k
   jnz     00650589                  ; detected
  Z0 x1 t, |' K& z- Z% ]   push    00                        ; OF_READ8 v2 p8 m$ [7 O0 p
   mov     eax,[00656638]            ; '\\.\SICE'6 Z8 X) n$ Q' k; X; ^' V
   push    eax
" S8 E, T' K/ U! o   call    KERNEL32!_lopen
9 d! {# q% }' A  @6 K& `! I0 ^   inc     eax& H# \; H  Y7 |$ I. @, g
   jz      006505ae                  ; not detected
( g- L. C3 {; m7 i+ O+ A
- y8 t! J: V: b$ V4 x$ r. ?9 W
! g0 ]' T/ D$ P__________________________________________________________________________
( x0 f6 i5 o7 a6 t) z
& V& O. r) k8 fMethod 12: v  s' p/ {' ~, B0 C, l
=========
8 A, ]6 l, t" ^3 s* e; J9 |1 g  ?: n7 A; C) }9 p
This trick is similar to int41h/4fh Debugger installation check (code 059 y1 c1 }$ ?8 i0 C  O* \% Q
&amp; 06) but very limited because it's only available for Win95/98 (not NT)
9 p5 y" A0 t  I+ i1 p8 [as it uses the VxDCall backdoor. This detection was found in Bleem Demo.. v& {6 |+ v; Q3 F" m

: C) \  |* G8 T& e5 j' a   push  0000004fh         ; function 4fh
+ M1 a* N* ?% a/ H  w: o   push  002a002ah         ; high word specifies which VxD (VWIN32)
, x3 n5 n9 r' m5 \8 z4 B( \& |% Y                           ; low word specifies which service( I/ K: H9 v( Z: _7 P
                             (VWIN32_Int41Dispatch)
2 A1 S7 O9 l% A. B4 X3 Y/ w   call  Kernel32!ORD_001  ; VxdCall
4 N7 u! X+ ~2 R6 y/ `* D   cmp   ax, 0f386h        ; magic number returned by system debuggers) j# ?$ P  j, V' J; K& J
   jz    SoftICE_detected
. L1 S+ |( g* i' H# x# _
& w, g4 q. u- h* u& O' Z! eHere again, several ways to detect it:- `7 _7 P$ ^" C; s. D# H7 o' J
4 t: t) G) X1 w5 V
    BPINT 41 if ax==4f% d$ v5 w' l* }) f8 P

7 j% l  j( l2 M    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one8 V4 f0 ?' S% O% |8 e
' }& j9 R  h1 X' w, W3 P* t# O) _
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
& t( t2 Y2 O  F+ o0 q
9 v7 H( w' U& K. |0 Z$ L( G    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!9 @9 j- @" A/ L% o
- a# }+ h( {+ T- V6 b: M
__________________________________________________________________________, [8 {- _- l0 p

% v" l* W  y5 D- `. O9 N: D7 wMethod 13
9 Z8 Q# D" Z) W( b% o) Q' }+ e4 f=========
5 q# D5 p) {* T6 o+ t1 [1 q  \4 r
! [0 r6 c% x6 GNot a real method of detection, but a good way to know if SoftICE is9 s- G! T, N% q, z
installed on a computer and to locate its installation directory.- k$ w0 T3 l4 r8 w. R  W7 A
It is used by few softs which access the following registry keys (usually #2) :
) c" T* g4 e5 }3 m( r. J, M6 S9 g/ ?( ^) S) L7 m3 A
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion/ u5 o" u- N8 [* w5 [
\Uninstall\SoftICE8 f* C/ Y% |# ~& |
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE1 n8 ^6 \& C) T' b
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion9 h4 T' m! W/ v. K8 Z
\App Paths\Loader32.Exe
' p/ V2 Q+ e- m) c: L. m
. t4 `* y5 |2 {, e  g2 R" z7 p( T, {+ N7 h
Note that some nasty apps could then erase all files from SoftICE directory
7 t$ ]3 E3 x* p% Z5 q' y(I faced that once :-(0 J/ _% h& d9 |

3 x; }6 [: o  M, j8 ^- R$ CUseful breakpoint to detect it:% V# e2 R2 a. u/ L  u& U- o5 O

! f% z' T5 G; T! ?% ^% g, n! H& R     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'; ]7 h! O2 B& x

& a6 i0 o5 J8 Y: x/ t$ t, e2 Y__________________________________________________________________________
, Q- _% [- n% d% M/ P. v8 E8 Q5 J9 w9 y$ l* B' n) r- @+ U

" r% U& E5 W# i" nMethod 14 $ S% e) M  h& z+ O" S; \
=========
1 h8 [) y9 H4 a( ~) {' G1 l5 h
4 m, F& A$ v7 f6 xA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
$ G5 _( g1 i+ A4 z5 [is to determines whether a debugger is running on your system (ring0 only)./ P8 _# f  @6 D
2 H* x( T* ?& [1 _$ t
   VMMCall Test_Debug_Installed
2 s6 Q& a! x' g/ |, d   je      not_installed
" J8 x+ X2 s3 ~# N6 Q- a
1 p% |! [0 Y+ t' D5 o4 |This service just checks a flag.
$ E8 @. l8 ^2 Z2 h0 ^</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

相关侵权、举报、投诉及建议等,请发 E-mail:admin@discuz.vip

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.|鲁ICP备19052200号-1

在本版发帖
关注公众号
QQ客服返回顶部