About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>- B$ h' P' N+ ]1 z" n& n$ U/ y# l2 K
<TBODY>
0 d2 p) q$ s0 w; x  U' C, Q<TR>
1 t5 B6 _6 j3 Q& V) M# [<TD><PRE>Method 01
$ S# a* w4 P4 Y- K& v' U; X- H=========
$ B1 @7 `$ @4 [* Z) G# a/ y% D# `  {, l4 U
This method of detection of SoftICE (as well as the following one) is% C& E3 Y1 c* ~1 E& e) m2 f
used by the majority of packers/encryptors found on Internet.
3 A( n6 ?( k/ z5 s7 }4 D6 QIt seeks the signature of BoundsChecker in SoftICE- f; G  Q6 S/ P( C6 ^% p' }1 h
7 o% p) i! p* }
    mov     ebp, 04243484Bh        ; 'BCHK'
) F: k' I& J4 `& E7 W    mov     ax, 04h1 Q' d% _: s% P5 b/ p' G
    int     3      
5 Y+ Q% a  z9 T3 h4 \    cmp     al,4
4 i$ s9 L* W6 f8 |! n) T" e! y    jnz     SoftICE_Detected  u. ?! \" @: U& P- K

; n2 E- C8 g9 y___________________________________________________________________________
# I; N9 }7 u4 t2 e4 B  }; d1 P  d3 W6 q  v# b3 Z4 k8 n2 b8 ?
Method 02
/ R6 ^6 ~! g+ I% b) z' r) x=========
! v* Q! S! o4 F- `! O; o  l% ]1 j* r% x) n% G0 N
Still a method very much used (perhaps the most frequent one).  It is used' d$ F, K0 P: @$ C& J+ f$ Q7 \* D) z
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,% h4 t  L5 v( g3 e
or execute SoftICE commands...
& G+ \: \, @/ ]* t' D6 z& M" mIt is also used to crash SoftICE and to force it to execute any commands9 C. \- [7 _& Z
(HBOOT...) :-((  
$ \1 G1 n: Y7 @7 k2 ~, Z4 C, @4 q# B& Z0 m1 }5 ^
Here is a quick description:0 d3 [+ Y+ u" y8 d" l
-AX = 0910h   (Display string in SIce windows)9 `8 ]) U) p- e% i# A1 Y
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
* C, i+ Q; U8 z) ]7 R( W% U& t-AX = 0912h   (Get breakpoint infos)! z' U8 Q, _7 W3 g% }
-AX = 0913h   (Set Sice breakpoints)
: n' Q5 {' t0 l; h0 S-AX = 0914h   (Remove SIce breakoints)
4 t% D: D. k& Q- }
. |/ _) N8 o' U! z+ ~' eEach time you'll meet this trick, you'll see:
8 B( p. L. L) ~: y$ |2 R-SI = 4647h) Z% Q5 i; N: V* c
-DI = 4A4Dh& w9 l( m6 `* [
Which are the 'magic values' used by SoftIce.
6 x8 z3 Y) S) a. MFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.
; q1 A( `! m# |0 }% h! P+ Q+ y4 t# h+ Q& Z# t
Here is one example from the file "Haspinst.exe" which is the dongle HASP
( n7 A4 Q6 y% y/ i" iEnvelope utility use to protect DOS applications:
+ \1 I0 d: }4 A/ x6 s# r: b! z" y1 {. z" G3 E

: V/ ?- y/ ^0 t+ S) h: }3 F6 W2 C4C19:0095   MOV    AX,0911  ; execute command.7 a7 N, N; A7 c: u4 c) m
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).3 P: D# L6 A- ]
4C19:009A   MOV    SI,4647  ; 1st magic value." G/ v) c% {6 F$ R' w
4C19:009D   MOV    DI,4A4D  ; 2nd magic value., r9 R! Q6 w0 I1 S' |  ]* R( O% d: P
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
1 S( H1 q: ?& \0 N( b# p3 _4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
3 c: k8 y3 G" I1 b4C19:00A4   INC    CX! S0 I: O3 H8 C! O+ j% S. W& a, V+ S
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute) R7 ?) A) @1 H+ B- j8 m- S
4C19:00A8   JB     0095     ; 6 different commands.! {7 ^1 m: {7 v- U# M4 C. T
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.3 A( _. G/ w) \, L1 V
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :). R" w" _0 c! o

' u4 _# E, @  [/ z. x9 \( u# lThe program will execute 6 different SIce commands located at ds:dx, which
& E7 \" e* \* O; }% w7 ?8 v& kare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.9 s) `9 H. _7 N( Z) J7 y* ]

$ o  p* A  V: K" [* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
& l6 y0 H5 h2 _4 b2 I$ y___________________________________________________________________________% m% Z2 U( z0 j
- `$ T4 f; @" q: E

3 S. _7 }9 h% zMethod 03
% e) J  O# G* d=========
1 ^- \! @' p  L! Y4 ~6 t0 {  k0 x, \+ q( j) _
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h; r' \4 K6 p2 o+ Q7 e$ |
(API Get entry point)9 k. G7 S0 H/ B: O5 v7 U
        6 a' s. R7 j2 W$ A9 P9 F/ U
( [$ S3 n* s. p* v
    xor     di,di
8 p% b: ~* D$ Q* Q# J9 M( t    mov     es,di
$ k9 A4 k3 v7 K  o! z& |; G; o    mov     ax, 1684h      
' o/ P5 b% U' V: V" {    mov     bx, 0202h       ; VxD ID of winice' S& b% b" J) ]  ^+ y% h3 r& Y
    int     2Fh, q. y. J! j3 D- n! `9 x
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
: u7 a# F' z5 G% W3 r; u    add     ax, di# K- a$ r# D, {$ B/ Y# h
    test    ax,ax' f1 x. a& a) ~: T
    jnz     SoftICE_Detected
" n1 u1 e! v6 j- O) N8 R" r* S
  z: b  y  X6 E1 O9 O: R6 b$ Y6 U___________________________________________________________________________
% O. ~8 T+ L9 A  f5 p
! ?) \+ u( p& SMethod 04
: F, @: \& s& x. j) C1 o7 X=========8 P6 ?9 a6 N' w% I9 e  R5 u. Y
8 G: u/ z! c3 ?) Z, j
Method identical to the preceding one except that it seeks the ID of SoftICE4 e2 f% [/ c7 U6 w0 v
GFX VxD.0 k, B3 [7 \9 [# P; X
  K6 {/ T3 z" k, \: h6 A
    xor     di,di8 O* [5 y# U; d
    mov     es,di
8 n! |! n, w6 D  c" ]0 u    mov     ax, 1684h       % p$ O. h2 r1 U! U$ I  t1 F
    mov     bx, 7a5Fh       ; VxD ID of SIWVID
+ e# _3 G1 `" f! l    int     2fh
8 u! S; ?! s* K9 z) R    mov     ax, es          ; ES:DI -&gt; VxD API entry point
- H1 [9 K+ c+ i7 ?( L4 D    add     ax, di
( b/ \; M8 n1 P2 E    test    ax,ax0 o* Q7 r/ J. D8 `( ?# J
    jnz     SoftICE_Detected
( K* \6 ~3 n% F- y1 v
' W4 A. p: `7 F' l2 A; t__________________________________________________________________________
8 H& M+ s; d, u; K; O5 X' w* c
2 ]  B2 Q" Q5 L' Q* h$ H1 G* a: X0 W8 d- D% z
Method 05- v# N, W5 v% }; R2 x# ~
=========
5 \& j! ^$ ]! W) m2 N  Z2 L7 u) B8 q( O, l4 V
Method seeking the 'magic number' 0F386h returned (in ax) by all system" _  e* |+ k) N! v
debugger. It calls the int 41h, function 4Fh.+ p: |) q' r( d( Y
There are several alternatives.  
; y5 \5 C  K  ^6 q. K% o3 B
; ]8 C% v7 [9 [& o" [9 F# O3 U9 pThe following one is the simplest:
" v, @* u1 x8 {( `6 n
* L- c1 [' t  p0 G    mov     ax,4fh/ S9 t+ T  Z4 |+ K" j* W2 L4 x* \
    int     41h
: ?2 C. Z$ X- y# L1 i- T9 m( p* ^    cmp     ax, 0F3862 @+ t% u5 E  |* }. \
    jz      SoftICE_detected: P  [( F" x" G4 ?; `

: p' ^' |+ L  J4 ]3 b" A5 K3 o$ B& P: ], v) w" |+ d% F% l  M
Next method as well as the following one are 2 examples from Stone's
' R6 e' R% d2 r9 m8 J% c. F"stn-wid.zip" (www.cracking.net):- x& b$ t" S4 C$ w

2 B' \8 X, R# f" \; s8 V    mov     bx, cs
% d2 h2 w  \9 r    lea     dx, int41handler2$ V6 g2 u9 r! U/ d( N- O. L( X
    xchg    dx, es:[41h*4]
- Y+ @& p, Z+ H5 d4 R  a    xchg    bx, es:[41h*4+2]9 w& u  L! X5 t
    mov     ax,4fh
4 j# z- I( M4 R9 k/ e    int     41h
. \. k) g1 [; h7 R/ [2 r% e    xchg    dx, es:[41h*4]+ G# l+ B5 f/ ]2 k2 f- S* n
    xchg    bx, es:[41h*4+2]
- ^# v) z2 O5 i& x" G    cmp     ax, 0f386h
  B9 W$ _. m. b6 j7 c3 l    jz      SoftICE_detected
, a* w& X: i( U7 F- A5 @+ Y+ {' `! }" H: B+ o8 a5 g2 i
int41handler2 PROC
0 V# [4 n5 m5 ^" C8 x    iret: c8 Y1 t- F. r/ h- O
int41handler2 ENDP
3 n* D( o) ?# X! m+ |! V' X( q3 i5 }
3 a  [0 g8 ^' J% e7 z
_________________________________________________________________________8 P* j0 ?$ l  I0 T+ ^8 w' G

  y1 ?' n% f$ b' t
% `6 b/ A& M; yMethod 06* }9 T4 O) R2 n9 ]* W1 h3 p
=========
$ V5 a) i% }* X, ~$ R
* O3 K4 h8 r# ]2 ~$ O- i
$ y/ D8 ]6 x  V/ A7 Y3 U2nd method similar to the preceding one but more difficult to detect:
( D4 H' i& T. ~) h/ O4 Y$ a( }! D3 N

; d+ d% h6 Z& Z" Z- Xint41handler PROC% _6 ]- @8 ~# {1 Z
    mov     cl,al2 h: T( n! W) R+ @8 s4 R( b
    iret
" j& W5 s& N+ k/ q& Z5 M, u+ Oint41handler ENDP4 X" K7 O5 \4 Z1 O7 X
$ p( G. K* c& U4 S" [
( }8 c4 j; o7 L# y% g
    xor     ax,ax0 J) J7 R3 j# q& f& Z3 a1 f! x1 T* R: L
    mov     es,ax
: I% ^/ F1 w; F# ~    mov     bx, cs( h7 f7 F1 l& `7 G: M3 q3 y
    lea     dx, int41handler
* y. ]- x8 Y% H9 c# L    xchg    dx, es:[41h*4]
/ u' a7 ~2 h* M. ]6 ^+ }. Q, P    xchg    bx, es:[41h*4+2]
' q$ K: ]4 Y; _. i+ u) t    in      al, 40h3 \) {$ ]: ~% Y8 `  b8 V2 @
    xor     cx,cx
; O7 q, ?* p/ ?+ F8 D- M    int     41h
4 |' j7 P/ a. b' K    xchg    dx, es:[41h*4]4 |) b$ N0 f- w5 l8 q
    xchg    bx, es:[41h*4+2]
8 z+ ]  b$ T* V- V    cmp     cl,al
5 a2 R/ s9 {1 e2 c- i+ i6 z4 O    jnz     SoftICE_detected' ?0 ]& @- O2 H; v- r

* M/ B/ B4 V9 f0 s( E_________________________________________________________________________
8 I% Z* _, v0 P
7 x# T3 ~- {2 K4 U9 uMethod 07
; C. X' C1 q! i=========
# u$ d# ^" _1 r8 k  H# a6 V
8 ^" _# _4 I) D" kMethod of detection of the WinICE handler in the int68h (V86). b. D' I& D4 J; _8 X

% [/ n4 k% w: I; H( S0 x2 f# A    mov     ah,43h; u4 @5 ~* R. u/ }+ a9 e$ V! S
    int     68h1 j. R, X9 y0 K6 `
    cmp     ax,0F386h
, g- b! B' V2 f6 A7 |- w1 ^    jz      SoftICE_Detected
& z/ L6 ~$ U( j1 _, B. B+ c
: T  I. W( w2 g6 v6 M- o9 \- a! o6 h8 _8 \. ~6 y
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit. q* N2 `/ D- N( I
   app like this:
+ W+ |; Q- b" Q  I8 X) l+ w  f6 A$ K" W; {  j; Y
   BPX exec_int if ax==68+ m: O" w" e# I6 Z3 f
   (function called is located at byte ptr [ebp+1Dh] and client eip is% T  ]# [4 h2 Q, Y
   located at [ebp+48h] for 32Bit apps)) D, Y2 Y% u- s& }
__________________________________________________________________________7 \; a* q5 E+ B' \: L  U. T/ k

0 ]/ A* `+ r6 R8 |1 ?5 J" g' n) p1 W& C' ~
Method 08
! b9 K! u  I6 L=========3 Z9 _4 w( H6 S3 B& k
5 W! c9 V5 b/ D' }1 r
It is not a method of detection of SoftICE but a possibility to crash the/ D3 U" U5 ?/ b7 D7 c6 e1 l" A
system by intercepting int 01h and int 03h and redirecting them to another5 Q5 X  C: ?& l  G' N* L" T
routine.
- z3 d# c5 |; YIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points( j1 o* ~* t0 h4 f9 }) e
to the new routine to execute (hangs computer...)4 E) f0 A, g4 l( {

& |2 C1 e( ~9 H' f3 g: W    mov     ah, 25h
: X- w; B9 r; o- j3 g0 q8 F( J    mov     al, Int_Number (01h or 03h)
* d7 U  s  b8 m) W    mov     dx, offset New_Int_Routine
$ F# |/ P% E) M7 L6 `; Z0 L    int     21h1 d: [0 w' Z5 B
% }* s0 ^, @* j- L- g: r% N
__________________________________________________________________________
/ n. v$ A1 |& W. z# @3 N0 V
" t1 s, y0 o  W+ c; WMethod 09& r  }9 K3 w  k# E! _" u5 F
=========
# m6 |* ]+ J; R" K. T& P; ~+ a* V2 Z# r) z+ g# t
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
/ {9 P! O1 @0 gperformed in ring0 (VxD or a ring3 app using the VxdCall).8 n: ^+ [4 Q3 G, \) n# T- ?  p
The Get_DDB service is used to determine whether or not a VxD is installed
9 V3 o0 F2 E2 g3 j2 cfor the specified device and returns a Device Description Block (in ecx) for0 D$ s7 N' L5 Z. f# y
that device if it is installed.& L3 X, Q; f5 ]1 U* E( @9 {
! j  H7 d3 R- A, s9 o" A  X
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
% F. S3 c1 f, j9 M   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)( v0 \1 b, ^% t% n& k" X( B3 b2 ~/ a$ o
   VMMCall Get_DDB0 X' k5 x' f3 ^- H
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed& N, {+ D- c  V8 z7 G7 {7 \

. c7 f; _& k/ v4 }Note as well that you can easily detect this method with SoftICE:& ?. @$ E; |& t& J7 z
   bpx Get_DDB if ax==0202 || ax==7a5fh
, [# N2 G2 u3 f; J4 G
! S+ i0 l$ p5 H: |+ P__________________________________________________________________________5 I' f# V' e& ]1 b7 C: t

2 F- Y, M/ F7 d( s- e" {/ X4 EMethod 102 e7 P' `- ^; `# W% H
=========
8 [0 ~1 G3 \  y% P8 K
# |: \: L+ {3 H1 c& p=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
& j0 b4 X6 B# W+ [( q  SoftICE while the option is enable!!
* S% r6 x3 R1 k2 b6 e& p( d3 P7 K5 h0 K+ b
This trick is very efficient:. R: f) z+ c! x% H/ ^9 w3 Y
by checking the Debug Registers, you can detect if SoftICE is loaded
  c+ g) V' s. |) d; X(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
/ X. e, i% k* W$ xthere are some memory breakpoints set (dr0 to dr3) simply by reading their
/ T& Z) D( Z5 X6 W* S+ Z1 U3 A: Xvalue (in ring0 only). Values can be manipulated and or changed as well
7 R. k8 u5 M5 L: M. e$ s(clearing BPMs for instance)
8 T8 f4 m5 E$ q7 B- e* m, |8 O
# m9 @% O) R5 e# u. b__________________________________________________________________________
+ V' }- n+ O  M4 B6 w1 T
6 G+ Z- B* m! L4 K3 UMethod 115 d: x2 w) G$ t& i. ~* r# [, D( X
=========( ?. {1 N6 ~8 k9 t+ @
& k( W) \8 ?5 k4 R+ ~+ [
This method is most known as 'MeltICE' because it has been freely distributed& n/ r+ Y2 ]5 l1 Z6 ]/ O
via www.winfiles.com. However it was first used by NuMega people to allow
4 Z9 s5 E* u) Q- u6 T: \* gSymbol Loader to check if SoftICE was active or not (the code is located
7 A8 O0 d6 T+ ?. K' q6 _  m* ~inside nmtrans.dll).. _- \, M) t" |: Y. t% w
& L* d, _$ H9 [
The way it works is very simple:
! y$ `2 F; ~/ _5 K! L7 z" `/ EIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
2 E4 R# A$ `' b6 B7 z2 nWinNT) with the CreateFileA API.8 q% B5 m: p% M' R1 B# ^

4 N( n5 P3 ^. T- W& Z! h7 z& l( l& rHere is a sample (checking for 'SICE'):
; S8 @1 J3 n. \" k0 s2 f" o3 B3 K
. [3 [( G4 @" z' Z/ s7 }  PBOOL IsSoftIce95Loaded()
" ^( F/ k4 {/ l% x: r{
3 p# U7 m/ _: A" |   HANDLE hFile;  - Z8 _  v, W  I/ q4 U% H: r1 B& ~
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,: F+ S# {4 D- @5 u& l+ h
                      FILE_SHARE_READ | FILE_SHARE_WRITE,7 V- q* @1 [: G! _: Z: \3 Z
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
, I: o9 P% p7 c  d; C: ~& E# E- i3 p, D   if( hFile != INVALID_HANDLE_VALUE )/ A" y& O7 v; s! Q0 q
   {* h2 \) j+ M3 S' A
      CloseHandle(hFile);
( w1 C9 S6 Z- i: r      return TRUE;. u0 g4 O7 U* A
   }3 J+ ~: N2 L' E2 v
   return FALSE;  A# H8 a* n5 |* H* K, N% V
}3 ^* K* J4 W# @. }- i6 ]1 \) J

% Z+ U' W- x0 ]& i2 CAlthough this trick calls the CreateFileA function, don't even expect to be  l% M9 r; t$ ?( I/ J
able to intercept it by installing a IFS hook: it will not work, no way!
6 u2 m$ K1 T% A% j" B  f" G: X+ pIn fact, after the call to CreateFileA it will get through VWIN32 0x001F
' G- r: |) S  K6 e" R1 b0 kservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)! ]/ |9 S8 C4 H2 u9 Y6 Y) G1 D
and then browse the DDB list until it find the VxD and its DDB_Control_Proc) T% Q! {. p  |
field.4 [1 l+ u7 q2 K9 }* H, b, R/ a
In fact, its purpose is not to load/unload VxDs but only to send a # s8 m0 ~+ k2 m- k1 t+ F
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
" T6 U" f6 D& Y3 d! B- X- f1 ~to the VxD Control_Dispatch proc (how the hell a shareware soft could try, X8 Z2 C7 K/ Z, e: b% F. _% I
to load/unload a non-dynamically loadable driver such as SoftICE ;-).
" w% P. E0 z0 B# y" k3 A) d/ DIf the VxD is loaded, it will always clear eax and the Carry flag to allow0 Y/ {9 L5 Q& r6 V, s$ _
its handle to be opened and then, will be detected.! f( J& a# j! }5 x5 V% {  {
You can check that simply by hooking Winice.exe control proc entry point
4 m( X- P5 \0 ?( c/ D) c" Ewhile running MeltICE.
) \- {1 ^6 O* w
8 {0 p  x% m# A9 W( F+ [( o& b/ o& ?4 Q: M- ^. v  s; p; N
  00401067:  push      00402025    ; \\.\SICE& d2 d: D2 \& N
  0040106C:  call      CreateFileA
0 a/ T) ~' M7 _  h6 D% e8 u1 h  00401071:  cmp       eax,-001
) E0 G% a1 ~1 {) n7 n  00401074:  je        004010911 r& I2 d. O9 S/ [7 _
1 s! g, G5 y6 e" O4 @1 Q

8 ~- }, f7 }* p& K: m! ~0 O" G( ^* a$ }There could be hundreds of BPX you could use to detect this trick.
" r- S$ D  m( y6 J, b-The most classical one is:, ]( A" h( x$ p' t0 j" M
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||3 O' d$ x0 \9 ^: m
    *(esp-&gt;4+4)=='NTIC'/ i" Q0 l* ~1 U) c; G1 f$ P; |

4 O3 ^8 U; L% |-The most exotic ones (could be very slooooow :-(
! A1 G, O! ^0 P- G. ~   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  6 d& a. e' l2 v+ F* Y
     ;will break 3 times :-(& N5 ]/ x: j  R( {

, c7 l+ G6 _0 B( I6 t$ w1 l5 I  V-or (a bit) faster: 0 I. ~& `) u3 P, N" C
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
6 C6 t7 I' N3 t
/ O" F5 T2 ]8 k; n) p   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
5 K. r# v6 z. J     ;will break 3 times :-(; E/ |7 t1 Z- l: w# z
. B5 b& G1 T7 d9 t0 d- w+ c
-Much faster:& _' [$ Z( @4 @
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'( S  _# J) L  W! l8 W

: X+ O4 V% r6 bNote also that some programs (like AZPR3.00) use de old 16-bit _lopen, g. v" R9 U" [! U2 H! j
function to do the same job:' w( Z! s0 Z; y

) D% b- F, V# z   push    00                        ; OF_READ
* Y3 G3 E3 u* x: l( Z   mov     eax,[00656634]            ; '\\.\SICE',0
. [" d$ B( A, T7 V7 d- m9 o, k   push    eax$ [4 L1 N# O- ~* `5 J  v2 M
   call    KERNEL32!_lopen
/ ^# x% x* o8 B+ p4 b   inc     eax
( f9 [& z# V2 b& w- L# j   jnz     00650589                  ; detected
5 _4 a6 C/ z. ~" L   push    00                        ; OF_READ, ?& [; g  Y& B1 h/ @
   mov     eax,[00656638]            ; '\\.\SICE'
2 G5 u9 ^1 d2 ]7 u  ]0 @% _* r6 I   push    eax) _+ j' e- K$ l% t3 ~: P3 {: h
   call    KERNEL32!_lopen
- l$ r9 X1 `. N* ?4 G3 H   inc     eax5 m; e% n7 }. L3 j& X4 f! [
   jz      006505ae                  ; not detected2 w6 ~9 j8 m' A% x3 W5 m" ^
$ ~* ~1 \7 ]. w4 }
8 O/ B  B; @  n! \8 j( D+ b7 I/ i1 e4 A
__________________________________________________________________________
$ Y- ?. R$ L  Z/ C4 `  M
3 F( |/ U. F# I- [6 R7 i8 {! J7 NMethod 12, W; n" p" K! R4 b
=========3 Z7 V  N# z7 s9 |2 g9 {: J6 {
* R: j9 e; R( T$ ]# X  g- ]
This trick is similar to int41h/4fh Debugger installation check (code 05, v2 q1 j0 r+ l; [8 {# E# |
&amp; 06) but very limited because it's only available for Win95/98 (not NT)
' C) e$ B9 a6 }! ?: H3 [as it uses the VxDCall backdoor. This detection was found in Bleem Demo.
( p& X* X3 f; q7 i
" t3 T) u/ R% t$ J, t   push  0000004fh         ; function 4fh
% g; S5 d, E* b   push  002a002ah         ; high word specifies which VxD (VWIN32)
4 A+ E, _- V2 K- V                           ; low word specifies which service9 ]1 p1 f: w7 G8 I  f
                             (VWIN32_Int41Dispatch)% E6 k' o$ N& z- n
   call  Kernel32!ORD_001  ; VxdCall
8 o0 a  _) L# D8 Q2 ^* [   cmp   ax, 0f386h        ; magic number returned by system debuggers1 \+ q8 t- W8 L
   jz    SoftICE_detected* j& V4 M  ^( G. Y( K
9 _6 }9 n7 y! a+ Q3 `
Here again, several ways to detect it:
  V0 l, Y+ W9 i6 w
8 H. [7 x+ Q/ g& }" c  r    BPINT 41 if ax==4f# S: Z3 ]. L: K  k
1 b8 d  C: n: u$ }
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
/ N5 e8 h+ S' f) ~2 V2 c2 j( }9 y( `8 [9 f
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A' @$ x5 r4 G% a9 r/ _

) x1 _! t3 S6 |4 I  \8 ~1 a8 R* D    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
" I( }' V' f- v+ Q1 M* ~' F3 |' Q# N; X! m3 ^( Y# t
__________________________________________________________________________6 g, q8 q' R6 d; ]: E' X
- e; V( V) S- C, U) z
Method 13
' ^/ I8 }0 @" V8 x5 V=========
/ r, Y: m% j" x, g' @# g/ f+ M
5 U2 N/ Q! A# A# n- Z. KNot a real method of detection, but a good way to know if SoftICE is
$ l+ ^. Y( ^1 d# h6 H( ~+ ginstalled on a computer and to locate its installation directory.
2 j3 [# ?) _3 n" I( b' y' t2 Y* \It is used by few softs which access the following registry keys (usually #2) :& n7 b. B- @  y

; ~- o9 I. q7 ~, y-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion! m; b5 Y1 m0 H$ v
\Uninstall\SoftICE
% ^4 a* M. Q$ B7 O; r$ J/ i-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE, P/ J" U5 ^+ c9 M
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
9 U4 P( y6 U# X1 N+ i' C\App Paths\Loader32.Exe7 @; E) Z1 N2 j! n: s
2 p- |8 M* q# ^$ C

* d( V, d! c9 g. {& \% F, y9 r- v4 y  DNote that some nasty apps could then erase all files from SoftICE directory; E6 b% [; M# e. h/ d* ~! D  W' b, Z% t
(I faced that once :-(
5 h+ _3 p7 r0 t2 f" ?9 C& Q% \4 _. {# t
Useful breakpoint to detect it:
6 V0 o% \3 U; E. @1 l" e
9 D8 u; {  ~% ?9 l     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'# S/ _4 y. n) ]

  D1 c" T/ Z1 e8 |& ^__________________________________________________________________________1 l' b% N3 E! {0 S4 v
9 [7 [7 S* H6 d2 k# O; _

7 s' w2 G, e+ s, B% A) l/ s- PMethod 14 2 t6 [% P1 M% N5 U, P
=========8 N' D, n; Z5 A1 T8 ?3 v

5 y  B" l! q: h# m5 b0 ^A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose9 p* P3 p% X/ G* @7 x
is to determines whether a debugger is running on your system (ring0 only).
. j/ w; X" w6 [& `" H
, X9 T. d4 m; y( \) ^   VMMCall Test_Debug_Installed
; b$ ?, K7 e$ G   je      not_installed- B- P* J6 J! R: w9 j/ k

' W# t% v* s( b$ b4 y- |This service just checks a flag.3 w% v6 A7 |( D# Z# |) ^# r
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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