About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
, Z6 F% E6 V" t" B<TBODY>
/ i( {4 H5 o8 V) z8 a<TR>
+ q# M3 `5 r1 S+ e5 u% ^<TD><PRE>Method 01 # I: I) X8 G: ^/ v
=========& }. N" Q3 ]9 m
- u2 y. l( B% @9 l9 `7 ?
This method of detection of SoftICE (as well as the following one) is3 S/ y3 u# z% d( {. s
used by the majority of packers/encryptors found on Internet.1 B; L) k* Y+ S: t
It seeks the signature of BoundsChecker in SoftICE
& s8 e1 ]" _+ `9 b
/ Y- p5 r0 D4 `    mov     ebp, 04243484Bh        ; 'BCHK'
# B+ Z+ `2 X1 j8 s9 V1 r6 t5 _    mov     ax, 04h
( W  F6 y" r; J9 g    int     3       6 J! _. ?/ E' U" f* A6 W
    cmp     al,43 e; Q" S: I* g- f8 n* B0 J. @
    jnz     SoftICE_Detected) D, z2 H; `- L* E2 `
7 n. R" Z. g, i1 h3 E' \* C0 K% v
___________________________________________________________________________- W" q  e( k: Y' ~% E9 }

( ]. [# I" k2 `* b# d) yMethod 02
8 C2 R. S  h. R+ _=========4 k! E# r* a! W' ?0 N' y, H0 ]
- y4 X* V3 O! A) [
Still a method very much used (perhaps the most frequent one).  It is used
( W+ H. L' E4 @7 Q# E6 Kto get SoftICE 'Back Door commands' which gives infos on Breakpoints,6 }- D% J0 X& O$ t- n; m* f, C
or execute SoftICE commands...
9 E$ a# e" e5 L6 K8 r; ]It is also used to crash SoftICE and to force it to execute any commands
6 \/ T! j5 \- j(HBOOT...) :-((  
, V! e2 b9 `" B' Z, d3 B( R
/ D5 d% E6 x) o$ M- _8 T3 AHere is a quick description:# f/ o( g, |3 i$ c
-AX = 0910h   (Display string in SIce windows)5 X) e, g. C! p6 n
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)  v) n  t& S7 |3 o
-AX = 0912h   (Get breakpoint infos)+ R. B8 J0 g3 T" V1 O: ^
-AX = 0913h   (Set Sice breakpoints)  s6 _  z! w" p
-AX = 0914h   (Remove SIce breakoints)
% L" M+ d4 F" }4 s# g
3 t* _/ ^" Y/ S( z# F0 s/ kEach time you'll meet this trick, you'll see:: O, ~# ]+ G' z) k$ P
-SI = 4647h
/ Y* d+ w4 u! D3 {-DI = 4A4Dh
) a9 f1 U% l4 @) D, b* `  m% PWhich are the 'magic values' used by SoftIce.
3 h8 q) p" I- y, r6 J- i: YFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.
& w9 r* H5 D3 O9 B1 U6 g  Z
3 v+ l) F  y  V1 n/ lHere is one example from the file "Haspinst.exe" which is the dongle HASP  W7 q, I$ `& Y& T+ @2 t( p$ \
Envelope utility use to protect DOS applications:
/ j+ Y4 S* t' j- }# X  Q0 w4 K& {5 i5 D5 \( E6 G
$ n9 A! x3 r$ X& M
4C19:0095   MOV    AX,0911  ; execute command.5 r! j' r' S" W' q% ^+ N
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).1 y$ _) p) \" V5 s# F
4C19:009A   MOV    SI,4647  ; 1st magic value.
  T" r! j% r" J# k4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
" h2 f2 @2 v: u( G4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)% p( m. B! ^$ N& {( ~9 y* I
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute4 ]- {- M# [/ j+ t" y
4C19:00A4   INC    CX
/ ]- E% }- ~, {: B% f4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute, s5 n  v; {* M
4C19:00A8   JB     0095     ; 6 different commands.
. n5 E2 e' N6 E( d/ B' L: r4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
$ C9 g) j/ L  F) [7 |! X" \4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)* O& w9 T/ B$ j, `( y2 h
: ]2 _: Y, E9 t
The program will execute 6 different SIce commands located at ds:dx, which
4 p5 P5 r- ?& B/ Q# F6 \7 N3 Bare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
- `, m) Y, L, F! h; d
: J% p, R! F  m. v6 i* X1 n* p* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
, d2 E) x/ [! B  }7 L___________________________________________________________________________' _. }: V. _3 N9 o! c) g: ?

; K4 ]/ ]. |& m3 D5 h( M, K  L- Q* J% Z; n" y! l1 n
Method 03
0 M# I! S$ y% o+ X4 T8 i) B! D=========
8 T6 I. g0 n# K- r" \  X
3 K, u+ y0 M1 Y: H8 s( w, PLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h2 q7 y) T4 i8 {+ C  u  U. g
(API Get entry point)' C6 e  L! o9 G/ ~* o
        9 C" x; r5 q# P/ w9 ~( J
( r* O; @# H9 P' N0 ?% z
    xor     di,di
9 r% P9 L1 ~# v: m0 E$ y$ S    mov     es,di
, u  O; E) j9 {% R    mov     ax, 1684h       / m) w, ]7 Z. Y8 D6 t5 j! m# B
    mov     bx, 0202h       ; VxD ID of winice
+ e/ [8 f0 j, v* v, Q8 Y    int     2Fh
" C3 W/ m9 d! ]& q$ z" r) K+ B    mov     ax, es          ; ES:DI -&gt; VxD API entry point
* y# v( k% t  x+ V    add     ax, di, C! @3 k8 m6 w5 k
    test    ax,ax
0 V% @! ^. k. Q  K& Y    jnz     SoftICE_Detected
- b) g& Q- j& C7 B5 Z
1 e0 H+ n! W$ I5 G; i___________________________________________________________________________) Z2 x4 M/ T$ ?6 j: `* l1 r, p
$ k2 W3 r3 B- |$ E
Method 041 f. k7 H7 k: P) d
=========
5 E1 _5 H' o& d; z* b( u$ y# C- }0 o% Z* ?* f$ M! l
Method identical to the preceding one except that it seeks the ID of SoftICE
4 L5 B: o( [" ~+ y! |# X! B. iGFX VxD.' m  k- C% p& Q( u, u
  N; @  T8 p: f: R
    xor     di,di
. e0 M. a4 c0 s0 U9 d    mov     es,di
6 H, }! J  j3 r6 k& W" T    mov     ax, 1684h      
  v5 C2 l( F$ u( f5 r/ W    mov     bx, 7a5Fh       ; VxD ID of SIWVID
+ D' F0 l; p1 W! h7 C9 k" o2 s) z0 p    int     2fh4 C" z% c( j$ A! v4 c; G0 F
    mov     ax, es          ; ES:DI -&gt; VxD API entry point# p3 f' q: q+ E, ]7 v" T2 l
    add     ax, di) Y6 m# Q% J- [9 u* K% K. ^; k
    test    ax,ax- e/ S9 \6 E9 F0 E
    jnz     SoftICE_Detected' ]! A% g, B+ h( m5 J2 k

" w  d% p& M! P' P__________________________________________________________________________
, |- A! x  F9 B* f  K8 ^7 k, G) G6 s" H

, \# m* Y; T3 a7 KMethod 05
1 d# T5 _! n; p3 m0 E=========3 g9 |# I( x! f9 q& \- h

" D' b# P4 b- O1 E1 tMethod seeking the 'magic number' 0F386h returned (in ax) by all system6 X+ q1 Y- Z) U1 s$ n
debugger. It calls the int 41h, function 4Fh." s, ]3 h' R' D6 F$ N
There are several alternatives.  
. f$ N1 V  F0 |% ?* Z7 N8 v" m8 m' w9 |$ k2 F
The following one is the simplest:
- Z# [, o4 z1 m* w
( w/ `/ m  I4 N  _    mov     ax,4fh" s3 d' F+ j0 `# h
    int     41h' W2 v' D) z9 `( z
    cmp     ax, 0F3862 |* {2 I) w; B5 Z+ ?3 e
    jz      SoftICE_detected
6 w1 L0 e" ]7 E* Q0 U* e# l& N7 V& \# f1 N9 V

: a4 }. @/ \" U7 X4 uNext method as well as the following one are 2 examples from Stone's
% Y$ P4 Y  X( A( y# }6 D  y"stn-wid.zip" (www.cracking.net):" m1 b9 c, Z3 ], F" F; j( ?

. J4 w8 [  @# J# y3 V3 {    mov     bx, cs2 @1 H8 [2 O9 n. W/ @. Q
    lea     dx, int41handler2
! n; s/ O8 v6 z$ }, S5 a' U. y) A    xchg    dx, es:[41h*4]% I. G! b. D1 v4 B# s
    xchg    bx, es:[41h*4+2]3 T$ j4 ~9 \; R# l/ \
    mov     ax,4fh
" b2 I1 R1 D3 X4 L  i    int     41h3 F$ u: L9 @; s4 k" X. z; Z
    xchg    dx, es:[41h*4]
9 D/ w% ]" M, R# W# W3 S$ r    xchg    bx, es:[41h*4+2]
* }0 g( m8 n& q: q/ [    cmp     ax, 0f386h% \; B  _3 u# z6 q
    jz      SoftICE_detected
$ f/ A6 L& {6 J9 V3 U- e8 p$ i. ?9 r' B- J  c. J
int41handler2 PROC* O, i1 w- N$ ?9 M: B# U$ ^2 B
    iret% v- {' \# ^( W/ }
int41handler2 ENDP
5 o6 V4 R8 t* ]! u; J" `3 U5 h- _
# D2 T" b8 n% E- E) g% O2 ]5 ]+ j+ y# i8 l" s
_________________________________________________________________________! w% }4 M5 r6 C% P  y7 L# R6 t- c

# g4 m  ], ]" ?; v' z( d6 R9 \- {" k0 }; \
Method 060 [4 R& s+ p4 Z1 E+ t4 C
=========$ G" \6 d) i/ H7 ^& i$ w, r7 ^* l
. h  ]3 Y+ a2 ~, P6 W
1 o& t" ]5 J! q$ T: {/ O+ d; R
2nd method similar to the preceding one but more difficult to detect:
# |3 g! d$ h) p  y7 b
* w! w$ W, d- u, E' ]  k8 x7 [. e3 ?- C1 m% |; G4 V+ C* R  G
int41handler PROC
/ L" W$ f& F8 {    mov     cl,al2 g+ C2 b$ {% W5 \
    iret
4 d0 `9 a/ Y' w; B( ^& j. A3 Uint41handler ENDP
: _8 L2 [& {) h1 U5 t+ Q
  Y4 G+ e+ L' H" {* h3 p
; y1 P9 @1 ]1 U+ J$ f$ V    xor     ax,ax
4 {3 B% m$ _2 S0 p3 e6 B- E    mov     es,ax
. S! X5 ]! o) n7 g, N# J    mov     bx, cs: k  G# `7 s$ F1 t( ]) y
    lea     dx, int41handler
0 ?, D- @* f$ Z6 T% T, b9 K' @$ n    xchg    dx, es:[41h*4]
+ {8 u& [0 A3 ^3 d& e7 y    xchg    bx, es:[41h*4+2]
  B2 s. |% n# x$ I3 N/ d    in      al, 40h+ s, x( O) ?& h" p! ~- X1 T; D
    xor     cx,cx
4 V: o$ R" F  X4 h0 o- n" {2 K3 c    int     41h, |8 }& h4 i; j* Y
    xchg    dx, es:[41h*4]- E7 l5 l( x# M5 @
    xchg    bx, es:[41h*4+2]
( h! Y& I. r% I1 J  j$ T3 K2 |    cmp     cl,al, Q6 B& k$ M6 Q4 \
    jnz     SoftICE_detected
6 C: {8 p( G& P  G
: _! g9 W! Z3 H* h_________________________________________________________________________# u% O4 n  d! d- j8 G) S
/ T+ }" |3 d5 s, O2 X) s4 p
Method 079 n0 I( g4 q6 n% S7 n0 d7 e0 r1 |; P
=========
- Z2 {; z& U! R* l0 u
7 z# V. J4 V3 `8 i$ \1 t! ZMethod of detection of the WinICE handler in the int68h (V86)* G) L0 @5 h* w7 ^# o$ T

$ `/ r7 \) S& s$ b" O( W: i: l    mov     ah,43h
- H8 y, Z# s/ G8 i& k- b6 J    int     68h
0 b5 u4 `8 z& i$ Y; l3 y    cmp     ax,0F386h" k" }0 X3 o- o: P1 k1 X& n4 [: ?2 K. W
    jz      SoftICE_Detected( X" H# T: `3 o" g, h7 m

2 \/ G( z, d+ r0 ~2 s% ^/ U5 G6 m& U9 s  C4 }6 m6 N6 k
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
4 S9 \  ^: J/ ^3 J5 a! O' S; U   app like this:8 N2 L' z$ x6 Z3 w

' F7 G& k5 _+ ]/ e: s+ Y   BPX exec_int if ax==68
; c4 x9 H  ~+ M, K- G6 {9 D   (function called is located at byte ptr [ebp+1Dh] and client eip is
. D2 G" i0 {. J5 t! R0 J8 T   located at [ebp+48h] for 32Bit apps)
4 A: \1 t' J. O1 E% f__________________________________________________________________________
* z3 C; w3 L# |- k. [9 v% @1 \5 {- d% _8 ]4 w" y. ^5 H

* h1 N5 R- b& Y, v& @- KMethod 08
4 q: Y# O+ P) H: m; P9 U=========
5 P# I# E/ N; Z; G, s2 _4 |
/ _. ]# D% M) [+ B! p" a2 D' a5 _: @( PIt is not a method of detection of SoftICE but a possibility to crash the
; A" U# u0 c2 a8 `% c! usystem by intercepting int 01h and int 03h and redirecting them to another+ P+ ]+ B( ?8 Q
routine.
" Q5 e# W- q, {; G8 [It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points' ^9 s; I! }( K
to the new routine to execute (hangs computer...)
( d1 W2 n* @' T% [: d5 h7 P" K
1 n  X* }* s6 b' V6 Q! W# h    mov     ah, 25h
3 I$ S2 `/ x/ J% M    mov     al, Int_Number (01h or 03h)
: f5 U" k7 g5 R4 S8 X3 V. s    mov     dx, offset New_Int_Routine; `2 v4 P* n1 @* B
    int     21h
3 d( r( ?( q$ b* m+ _( s1 z! [. r# [0 R1 b
__________________________________________________________________________3 s* j& X0 o) j! Y, R+ a

/ a9 o0 F6 u& q% ]; }$ ?, ~; K; {Method 09
, M2 Z+ w) J* W6 M: Q% L; H=========$ t4 I7 S2 I4 \; r; I/ B- I* Z0 c

% I2 ?, `( k: CThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
$ h4 Q2 Q; a8 |4 f4 E- o% L( Sperformed in ring0 (VxD or a ring3 app using the VxdCall).& a5 |0 X" C) |9 K
The Get_DDB service is used to determine whether or not a VxD is installed/ f3 G$ U$ D) [  q# n5 y. D
for the specified device and returns a Device Description Block (in ecx) for
4 D6 T# t1 `  H3 x  I8 ~) I- Y3 dthat device if it is installed.
& ^* U! b% d3 k( K
" l8 G8 ^% {3 o   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID. E& e7 k& ?, ]3 s* D8 v( g! ]
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)0 N: L4 R5 u6 M# E* {: I
   VMMCall Get_DDB2 B! k; s, z) y% ~! o- a% ]) D' e1 D
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed3 f- R( o3 Q" a2 O/ O

6 Z& y. b7 w( M: m' B4 ~Note as well that you can easily detect this method with SoftICE:* f" }2 Z& e; N0 W
   bpx Get_DDB if ax==0202 || ax==7a5fh& R) W6 O& p+ R: M$ @! a

$ Y. q/ A9 P% @2 ^/ ]0 z/ Z__________________________________________________________________________
* T+ w/ u8 l, X" n: y" |6 \" z+ u% _4 O1 D
Method 108 m! g5 Z+ g2 o4 q
=========$ x- Y" c/ c1 K7 J$ P2 B

- q) B2 R( c9 }! R+ X# [=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with9 w. i( N% N1 o; e8 E4 E; r
  SoftICE while the option is enable!!" H" {6 K! H, t# _7 }
: H. q) Y! T- m6 {+ g! `4 m* C
This trick is very efficient:
: \7 T# ^% K) ]% t$ hby checking the Debug Registers, you can detect if SoftICE is loaded+ K0 [" @$ \7 X
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if9 }. a+ c5 i* I7 l: M4 K6 Q& l0 R
there are some memory breakpoints set (dr0 to dr3) simply by reading their
$ N! G: v% Z! F+ b" rvalue (in ring0 only). Values can be manipulated and or changed as well
& A. P+ i& k. B! F" e(clearing BPMs for instance)
5 C. h& H' z4 w3 ^3 v4 n: _# p$ A1 f: i9 ?2 v' r1 E" X
__________________________________________________________________________
7 U, H) u8 x2 g- @$ f) b* L
/ O, z; z$ m' h& c, l8 CMethod 112 O) {/ [+ H( P+ D' D) J
=========
( a+ f" t' T' l& |/ k1 h) j5 g4 @4 u- z" C, |0 f' G
This method is most known as 'MeltICE' because it has been freely distributed: k  b2 M" Y% o2 E+ |" n9 C
via www.winfiles.com. However it was first used by NuMega people to allow7 v! |  b! D, ?
Symbol Loader to check if SoftICE was active or not (the code is located8 @/ L: v6 v# \- Y
inside nmtrans.dll).- Q6 E/ ]1 i/ v4 o" u) P/ d

& ]  x3 R. O  B. G: W* ~5 SThe way it works is very simple:7 [9 r; n$ M  ^$ S
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
5 ^4 E0 ^# J  n. hWinNT) with the CreateFileA API.( ]/ h; ~5 X4 g( @2 M* W; p

& L: A) q9 \1 R4 N7 H: a5 ?1 ?Here is a sample (checking for 'SICE'):
/ U# K& C( Y9 A; _6 i, j: Y, q+ N8 d# W+ R/ q( a( C7 X* m
BOOL IsSoftIce95Loaded()
! R/ [0 \* L1 Q: r1 w' o{4 S/ n6 j+ A) c4 `
   HANDLE hFile;  
3 A1 o' N! ^; ^2 }   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE," v3 w+ z6 j2 X: l- e5 ~( J$ y3 M
                      FILE_SHARE_READ | FILE_SHARE_WRITE,
8 F6 G. _/ h4 f6 K                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);( v$ Q* G  `  C' L( T  \) C
   if( hFile != INVALID_HANDLE_VALUE )9 u9 P9 c+ z- w  u
   {5 i3 r' C( g( `
      CloseHandle(hFile);
7 o7 f. J! o2 k! p1 c, _      return TRUE;( G5 f. U8 p% r$ ?# S2 o* z- L
   }
5 X0 {$ p0 p1 j+ F* q   return FALSE;, p7 r; S+ O! O$ l
}/ A( c1 N" W" _' `7 w
" w1 k; j; ]/ H+ B. o& z9 }
Although this trick calls the CreateFileA function, don't even expect to be
8 h% r; |# X& e8 Bable to intercept it by installing a IFS hook: it will not work, no way!: Z1 q& V1 M* j
In fact, after the call to CreateFileA it will get through VWIN32 0x001F
# O' Z( t0 q- }6 P% g/ Qservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
3 O0 f, s5 ^$ U. j& E: Vand then browse the DDB list until it find the VxD and its DDB_Control_Proc/ T- ]  h' n; C8 o
field.* M5 }+ X0 ?) ]# O5 I. B" u9 J9 x
In fact, its purpose is not to load/unload VxDs but only to send a * g0 n7 \+ z. f
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
2 g; P; j2 h8 |8 }) vto the VxD Control_Dispatch proc (how the hell a shareware soft could try  F! i0 w+ G1 K, l/ S
to load/unload a non-dynamically loadable driver such as SoftICE ;-).
& \" M( J$ o0 Y3 P9 k+ U4 l' ?If the VxD is loaded, it will always clear eax and the Carry flag to allow
! p6 }* x' c+ C3 s3 f0 Iits handle to be opened and then, will be detected.: G8 j% P9 k0 Q% _0 c/ U8 I, e- F
You can check that simply by hooking Winice.exe control proc entry point
( J2 J0 p* D& Y5 G( f# r/ _0 ]while running MeltICE.( v$ l. g4 h1 M
. ?  A! N; s7 F1 h

3 j6 ^- k' b+ I0 w8 I  00401067:  push      00402025    ; \\.\SICE
9 G$ M9 U1 f' ]& @2 X( Z  0040106C:  call      CreateFileA
5 d% N/ s. M0 _  00401071:  cmp       eax,-001
, L6 g5 l7 N, ^' L+ k  00401074:  je        00401091
( R& q( \5 [( v5 R" h: u2 d" A; Q: }2 N6 C8 @* i  z8 b; Q  B4 \) _
1 N5 ?5 H4 S" f9 V. E2 ?
There could be hundreds of BPX you could use to detect this trick.4 ?& x0 J9 m9 G# E1 _4 V6 f3 Z# l
-The most classical one is:
6 c9 h7 \- U0 q. w  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||7 f+ ?) S" N5 C
    *(esp-&gt;4+4)=='NTIC'
6 _! t4 F1 Q% X- `- k3 |0 m2 P
1 Y) _6 m2 W0 @$ `" w& Z-The most exotic ones (could be very slooooow :-(5 U4 h) Q( I* O9 c8 B' l) [  k- Z
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  " k6 ^- b9 m: B- V
     ;will break 3 times :-(
! H" o, z: ?; @+ O
8 ~9 l' j" W/ H1 s2 _-or (a bit) faster: . J  {4 t5 H& Z. D  e2 ^
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
1 _$ m7 Y" z$ n0 ?. u' I9 m0 p' Q4 @- Q
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
/ M7 S/ i8 L+ n2 v' S# H     ;will break 3 times :-(' b1 o' S6 r* p6 i7 [

5 Z" P+ [5 a! p4 C5 i" k) X-Much faster:8 _8 r: E$ Q2 x! h( F0 }
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
( q9 k2 }* c3 m4 d$ v( R  g- g, p1 t' n
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen
7 l. u. Y& F& v: N& R- k" Ifunction to do the same job:
- E# B+ t' w: i6 ?; h; h
, K. ^* p# O, O2 `0 o0 s% {7 f# H   push    00                        ; OF_READ  n- e6 ^* A1 [0 s7 l/ n, F! Y( X
   mov     eax,[00656634]            ; '\\.\SICE',0
3 p. \8 [" F( U  F+ _   push    eax  z" m, N9 w( @, ~, j
   call    KERNEL32!_lopen5 N4 h  c1 I: ~, L7 w3 Z
   inc     eax
, H, M2 Z% m! V  B+ B, ^, m$ J   jnz     00650589                  ; detected: ^8 H# g5 S' P' k" e' e: n
   push    00                        ; OF_READ
2 Q& q' T. ?5 Z& C' R9 V- K   mov     eax,[00656638]            ; '\\.\SICE'1 W( F, X+ o2 M* M: i+ q0 J( P
   push    eax; \2 a- r: T- `
   call    KERNEL32!_lopen
. I: I8 ~2 y1 H! y5 X; C   inc     eax9 }0 s9 q9 b  W  J, }
   jz      006505ae                  ; not detected4 L( a! Z, Q: w" u# ~; z' ]' R9 l
) i1 L" k' M' s: \& P$ {
4 C7 [' ^9 h3 E+ Z9 s! i. q  S
__________________________________________________________________________
2 J1 f7 u# ~; B$ l' E4 g& \( W9 B  x. }7 s- b2 Y
Method 12
2 C7 e- _/ f6 w$ \- e, c6 u; V=========
. Q# f% z! b# j' ~6 C& g
! U; f' o" j4 [" w2 a  VThis trick is similar to int41h/4fh Debugger installation check (code 05
$ ]. X/ `+ y9 Q( K$ E&amp; 06) but very limited because it's only available for Win95/98 (not NT)$ o% S6 Z# d% q. y, ^
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.
- q4 t) F+ O5 }* F' S; ]
) v0 q% ]; A4 R   push  0000004fh         ; function 4fh0 U" W5 A6 s9 }& `) c
   push  002a002ah         ; high word specifies which VxD (VWIN32)+ c+ K' G$ _. N# A
                           ; low word specifies which service
- d& J1 s, j9 e% h) I  s; q5 V                             (VWIN32_Int41Dispatch)
8 T" l$ i0 G$ ]4 L) o; c+ {( w   call  Kernel32!ORD_001  ; VxdCall
& ?/ C! l, Q& M: J: }7 b4 W$ n   cmp   ax, 0f386h        ; magic number returned by system debuggers
. S9 i' ]0 g+ y3 a' p: p7 z   jz    SoftICE_detected
" q: q  m* L! b0 q: T  z$ F" X  W2 T- v+ p0 x
Here again, several ways to detect it:, Q0 \, p( c' ^% v  {
3 H* J0 M  Q8 Z! q1 G! C+ R6 O% W0 d
    BPINT 41 if ax==4f( v4 `% W; t1 R

. y% k9 v) m' S8 P& W6 G    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one" u1 R. w) {7 z+ H9 e. Q) C) |
5 ?7 y: u6 o% \( N/ E
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A( w3 b  r& I4 r, v" `4 @/ O9 n

) O# ]( D$ y# g3 z  A; T4 N    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
' `7 ?0 P% X) `
" _8 M4 Y2 ^1 W/ ^__________________________________________________________________________5 ^$ S% e, h1 [7 F3 L

% C3 a0 r2 x" u/ H) vMethod 13
) L( E1 e' u+ S=========/ f. q  U0 t4 \" j6 B
+ o- Y$ u" m9 [6 L
Not a real method of detection, but a good way to know if SoftICE is
! ^. y) c$ I/ G8 ?6 N! Sinstalled on a computer and to locate its installation directory.% s2 p+ f7 x' @$ f
It is used by few softs which access the following registry keys (usually #2) :9 }; v4 J  P6 }

( M4 o+ Q0 p& I7 Q-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
& V, w( D* A- k( M' K\Uninstall\SoftICE9 f) I0 w9 F) O: M" L
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
! c: g) L* e. d- d( `-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion! E" I" u2 E. N1 y/ a8 W  b
\App Paths\Loader32.Exe
) V+ G- \$ w3 s9 Y8 V
1 X6 a. \+ v. \! O$ r+ N2 o: i% s6 a' q( {% ^# O% B5 m; g, \
Note that some nasty apps could then erase all files from SoftICE directory
: d/ @5 G- Z# z(I faced that once :-(
7 m) d/ H( j: C! r' ], L
* ?  `! l: }: V$ eUseful breakpoint to detect it:
: C5 {3 B" }# d8 B, I% d8 D2 o& r3 o( X' {; ?  S
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
* i; q& F9 H1 t  _. G( \1 p5 m. k0 I5 q( i. [8 j4 V* ]( g
__________________________________________________________________________+ ?$ q) |  i' T( U
. A' H8 B2 _1 j! ^

/ H* K' R" V2 x* Z3 ~Method 14
1 h2 e9 ~) z. {# r) _" y- W9 c  s' [=========
3 Z' G4 u, n8 }, @# N! N$ l4 M8 H  u5 T, P& g
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
* D% ^8 i9 Z# S# c- Z# Tis to determines whether a debugger is running on your system (ring0 only).) h/ K9 M& B5 E  Y

# v) _! `7 ?2 a5 H+ Y/ t; q" {" G   VMMCall Test_Debug_Installed
- m) H8 E% M4 N" }. I6 @* x  S   je      not_installed
. V, C5 q( @- {  e1 j9 p
, q8 c2 o0 }& A3 k1 h) }( I! ~# ~This service just checks a flag.
' F6 L, N, o0 O</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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