找回密码
 注册

QQ登录

只需一步,快速开始

About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
7 [: ~- |9 _- U' y<TBODY>
* @& j- G! L1 E- F" V, k2 k# x<TR>
. Y6 D7 O# T& l2 @; L& |<TD><PRE>Method 01
% f3 b  J5 C: I% x=========# U8 Z' I. N$ }- z# Y
1 b! h2 f4 w' J  e$ \- Z
This method of detection of SoftICE (as well as the following one) is  f4 Y( F" M* X- m" h; |
used by the majority of packers/encryptors found on Internet.9 M; ]* m7 b2 d3 ]5 A+ ?
It seeks the signature of BoundsChecker in SoftICE4 T+ D& U$ {: x9 J' M
4 y, `* h/ \$ n/ b' l! q; s# ?: K
    mov     ebp, 04243484Bh        ; 'BCHK'
0 c, ~5 V5 s, G5 K$ z' {    mov     ax, 04h
" {/ L8 b1 `$ s5 R/ u$ k    int     3       - |% J8 C: K) d" [( A+ F/ p
    cmp     al,43 @" V" v/ ?2 J+ T7 `. n' x; j/ w
    jnz     SoftICE_Detected; i9 u9 {. f2 Q! F! h

' T9 p; U% L5 m___________________________________________________________________________, z" I; Q) ~& X

# S( J0 v8 m  T) c' e" f# kMethod 02* h( F) s) g$ n
=========: T# H/ |  \3 H6 {7 q: h
0 X# `' ], w' n$ F
Still a method very much used (perhaps the most frequent one).  It is used, g' K5 ^  `6 D4 I: Z. N
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,0 o& P+ [" ^/ Q
or execute SoftICE commands...( K' s5 |$ M! b
It is also used to crash SoftICE and to force it to execute any commands
3 v( {/ x% ]2 k5 U- M( k# g) j(HBOOT...) :-((  
' I3 Z! U6 l  z! O: p: T& |
* J! u/ `4 O, O% ?Here is a quick description:7 u% P2 P2 L; M0 g
-AX = 0910h   (Display string in SIce windows)! x: {6 p; x  I) r1 R# U  H0 O# f8 Q
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)3 c4 X7 S8 ~: F  r/ N8 J% V  I0 N2 W
-AX = 0912h   (Get breakpoint infos)
4 B! m8 ?: C5 }! T  n) x4 R, N-AX = 0913h   (Set Sice breakpoints)
: |, F+ |; T, ?" a$ o/ ]-AX = 0914h   (Remove SIce breakoints)4 \2 v5 p8 p  U9 K. }( n- k
9 k  j1 P6 u$ ~5 M
Each time you'll meet this trick, you'll see:
, T) V: |+ e" c3 [# {' _2 [. |-SI = 4647h8 N. R( D% ]1 Z5 P! J' v/ ]- s
-DI = 4A4Dh
7 z$ h0 d2 H( SWhich are the 'magic values' used by SoftIce.
1 |: H- I+ ~% FFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.
; E: D+ T( }3 V9 Q3 a. ]2 ~3 Z1 |: W9 G( ?$ T! E2 g  S
Here is one example from the file "Haspinst.exe" which is the dongle HASP
5 v4 E8 u) |" Z) WEnvelope utility use to protect DOS applications:
6 D' E" P7 l/ e$ q$ n/ v$ `2 U, @. ?2 D8 e5 [% j, R4 Z
: G5 p8 y; N, e$ C1 Y
4C19:0095   MOV    AX,0911  ; execute command.  f( b9 J' ^6 W  O- g
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
" ~! a1 A1 u: ?4C19:009A   MOV    SI,4647  ; 1st magic value.
9 y: J' i& S! r4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
9 h" X; N  ]5 D' e; W4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
: T5 z; _) l! Q( a4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute0 O5 a7 o: L# L) q( w0 |
4C19:00A4   INC    CX
( X( V" P" V/ c! J- P4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
! I+ ]. u- B: _4 V7 w+ c1 T" X' n4C19:00A8   JB     0095     ; 6 different commands.
& Y( l& {/ F% G+ `# a4C19:00AA   JMP    0002     ; Bad_Guy jmp back.8 |# W0 {- j% q- T7 p
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
, e7 v+ E/ i5 S$ T( {; c7 J! G% D% O! v8 g
The program will execute 6 different SIce commands located at ds:dx, which
  J% ^0 R# h# @! \: Tare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.0 m( T+ s: _$ Y" F: X* h) v
  h5 i' g+ I9 R$ _6 A) M
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
: b0 W" s4 G$ P2 x* x9 L___________________________________________________________________________
6 Q; b/ U  I: K) c, i, s6 S( X0 f7 o( J$ S  B7 E1 l
6 M1 E9 d3 {8 c5 f) o3 d6 Y
Method 03
; X/ B3 K' R$ B=========
" O" G6 m$ o2 O, r- e8 z
5 @" K! g' ?( S: s! h: \Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
8 q. s6 c% `, [(API Get entry point), x4 {" ]' {7 h6 l+ S
        / O# Q! G& Y. o* V. S. b* V$ a
+ u+ \* v7 ^' D* N
    xor     di,di
( }6 ]0 e# B* P2 ~2 P, e* T4 B+ i    mov     es,di
6 R9 O9 @+ K9 w. D6 S8 {. d    mov     ax, 1684h      
. O. v# b- M& b" s/ Y! p7 o8 l    mov     bx, 0202h       ; VxD ID of winice. S& Z2 E+ P2 c8 S3 T* r. l+ G
    int     2Fh  V1 _7 m6 W  {5 |  ~
    mov     ax, es          ; ES:DI -&gt; VxD API entry point6 r  S, l, ]7 c! r5 z
    add     ax, di- D& g, x7 j4 V+ y
    test    ax,ax
* d2 W9 I3 F" a9 |$ C    jnz     SoftICE_Detected
6 q# |6 e- k, S- Y- Y- W: Z2 [+ }4 k3 K9 F+ X* G
___________________________________________________________________________
. Q: ]$ h: _, J8 e/ d1 }5 Y
5 k4 X) D+ o3 ^! V( `7 }( dMethod 04
6 ?4 G- ~% v/ J- {( i0 _=========
. G$ E7 M  P; S2 i4 Q( ~1 m" K/ K/ g+ u- ^
Method identical to the preceding one except that it seeks the ID of SoftICE
+ t: ^# M' G4 n# c5 ]8 o: hGFX VxD.
1 n  J3 s6 n* b3 x, d6 m
0 n! C! n4 }" c' c8 a$ |    xor     di,di0 T5 h* a% ]4 ]2 J% P4 e
    mov     es,di
5 i& i8 \* r; E% d    mov     ax, 1684h      
8 {/ L$ |: N. Y5 {+ D5 C    mov     bx, 7a5Fh       ; VxD ID of SIWVID" @$ J! u6 \8 D2 ?& ]$ n0 z
    int     2fh
; h& O/ U: k( {. O    mov     ax, es          ; ES:DI -&gt; VxD API entry point! U% y' y6 E" y/ ]; `
    add     ax, di1 Q1 s2 ~, Y9 C' u( V9 v# A
    test    ax,ax, b- Q+ e: T9 }9 o) F+ _' d
    jnz     SoftICE_Detected2 l6 v% v% U0 t) N. q+ Q6 |0 b

  [. t5 u9 A' k__________________________________________________________________________
- a! D! Y4 ^) y3 {+ r* N
6 ?/ \# a! a9 M2 Y
- q) @( c6 {4 V. X0 x- LMethod 05
. r% }* G( [2 s+ U$ p: J=========
8 V7 L# G( e1 U0 I  j- M3 l" e* e$ j% T9 z  @. @4 t8 ~& u! P& e
Method seeking the 'magic number' 0F386h returned (in ax) by all system: \% K* T! n3 M0 j7 u& x+ h
debugger. It calls the int 41h, function 4Fh.# S$ k, y( [' a0 B
There are several alternatives.  9 H- j1 A6 |# r6 @, Y7 e

% W6 O7 d1 X4 _The following one is the simplest:' z# ]& h- |7 F

4 n3 R) b" ?0 m' u# y1 c" B4 |    mov     ax,4fh+ R' L( r8 T/ o$ o4 V  B0 R
    int     41h( |; D/ z# }3 `, }& Y3 K) T
    cmp     ax, 0F3863 M$ v5 ^9 I" p5 r3 I! T
    jz      SoftICE_detected, F. I# U" M5 v+ z; @6 R/ F5 h

' L8 v" K/ \9 D: @3 E) G/ f. _2 U) t8 a/ H2 C& r3 K3 n, e9 d
Next method as well as the following one are 2 examples from Stone's
" I2 _8 ]7 I* l3 |# d. w/ f"stn-wid.zip" (www.cracking.net):
* \- V% d& b& ]. W# f/ c4 D1 a4 C7 ]
    mov     bx, cs
9 _, _' x  X' ]' x6 v$ N    lea     dx, int41handler2
, j- |, q* d: z. s* j& O    xchg    dx, es:[41h*4]8 a4 B- Z0 O$ w; B
    xchg    bx, es:[41h*4+2]
- w& r0 l3 O5 a# s- }" o- `  N    mov     ax,4fh) B5 Y* V: b. U: Z, v
    int     41h
( S# H# `! d7 o, E2 }    xchg    dx, es:[41h*4]
, W/ \8 B% k, N' W9 @) Z( B    xchg    bx, es:[41h*4+2]
$ C) g% Y$ H: a0 k7 T. ~+ Z# T  S    cmp     ax, 0f386h
% C7 N! l. f$ e9 G    jz      SoftICE_detected6 s$ ~0 J7 w* T: W, P
  i& {! _+ f8 i! F# u( _" N
int41handler2 PROC
4 q  J5 n3 n) i0 s    iret/ ^; Q5 i+ g6 b0 K, s1 q
int41handler2 ENDP/ |8 j3 k2 H! X1 j3 W
# P1 R4 |0 J$ H
9 r( z8 w: q( q# f0 F$ K
_________________________________________________________________________2 u4 Q. ~# N- f# O

' Z, e( p+ J0 B" y* @
: T1 g1 g& D2 ]% I; TMethod 06) t1 I$ \3 E7 i( B4 @
=========0 F& J1 p2 {6 d8 |

: U4 G; B7 j! w- m* k
0 J$ f: F2 z, ~' d2nd method similar to the preceding one but more difficult to detect:) W; E3 q! K; R) P+ K" j, h
4 @! A* b2 f- T% _$ i( F1 L
2 J& x1 S9 M* ~$ v
int41handler PROC
& s# }% F5 ^$ R7 [7 J+ j' J6 S    mov     cl,al; N3 u) A( h9 s1 T" L2 T
    iret
& T+ J! A, \( a9 S# E* R4 y$ Hint41handler ENDP
1 J! G5 @5 T0 W( J, [! Y
# L- `2 I, Q7 _1 o+ o. ^7 y5 l! ~1 g/ U* Y/ b
    xor     ax,ax: |. J/ L/ @! J$ y+ p; S& f" n
    mov     es,ax, a7 L7 P/ H0 o) `) j
    mov     bx, cs
" ?( b$ U0 q/ o: o1 l7 U. I, h+ x    lea     dx, int41handler, o$ u4 i" `/ K# C# G
    xchg    dx, es:[41h*4], z( I. u1 J! e
    xchg    bx, es:[41h*4+2]
3 ]" e) O% S' R! _. z7 R; f! t2 |0 l    in      al, 40h- ?; I9 I5 ~" C
    xor     cx,cx
( ?" j: V( _, {$ @( a8 O: x2 A# \    int     41h; \& `$ g0 W7 j) O6 j6 o0 v
    xchg    dx, es:[41h*4]
) f* c3 Z7 t1 n$ f    xchg    bx, es:[41h*4+2]# Q; m6 o3 k7 {/ e  g4 ~0 N4 A
    cmp     cl,al
$ C5 I" ~6 X+ J    jnz     SoftICE_detected
1 e, `6 u  g5 a2 c" u7 v0 `* ?; Y* R  {/ w
_________________________________________________________________________
3 ^4 Z% @6 u0 I% h' B! _1 z/ w$ B0 b
Method 07
, ]8 F2 K. x2 _8 J' J=========, C% _& f% x3 u' n0 r/ x9 s
7 E3 Z& I1 Z6 V/ w) a2 y2 z. \
Method of detection of the WinICE handler in the int68h (V86)
+ ~9 ^- K- w) T5 P
" j: L7 X, u- I6 S, _6 Q0 L    mov     ah,43h
0 a0 D# ?2 @+ X    int     68h
* ~. }9 P  I- L3 t% D  j    cmp     ax,0F386h
9 F) v+ p3 u) I+ ]! V    jz      SoftICE_Detected- s7 n4 e7 j6 o0 l; M" O
  p8 J: z4 B1 u1 g; @
; G0 A: n, W) L! d
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit: |$ ^7 ]; D3 q" z) B8 o2 r* N: ~
   app like this:
! U2 a% e/ ?1 _9 Z* B! T) L0 p
0 Q5 g: w4 P% i7 e) W( W   BPX exec_int if ax==68
- _: u% V+ @- W" W# e$ y   (function called is located at byte ptr [ebp+1Dh] and client eip is
8 A6 c. z- g; p5 M& |   located at [ebp+48h] for 32Bit apps)& j' I: V3 E; y+ ?
__________________________________________________________________________  A  }* r# `+ ~5 j6 Q3 C
  x* {0 T1 X/ K; E1 p! ~
4 s: T- K7 K& j$ L8 y
Method 08! m, N; `1 ?2 B3 x  E, ~
=========$ j% Q8 N2 h8 D& l

; w2 s8 V/ c. T" H; {0 D. tIt is not a method of detection of SoftICE but a possibility to crash the7 |. y- L5 i+ J6 H8 Q' U, A. y- ]- f
system by intercepting int 01h and int 03h and redirecting them to another
7 b* O( b3 _6 N' |: @routine.
3 R" q; ~) w4 n. a' sIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points) C* L% z8 g5 r- f
to the new routine to execute (hangs computer...)
" `7 ^2 R4 l, A1 S
/ N' N- @$ W% n; G% A! M0 Q    mov     ah, 25h$ W# k3 h& Y4 w+ x  O% q
    mov     al, Int_Number (01h or 03h)
/ Y7 a/ a  P4 K    mov     dx, offset New_Int_Routine, Z0 @1 Q. b$ a, O6 C" F: Y
    int     21h7 G2 t5 Z) B0 d. a/ B

* @  b. F# k9 H' Z. f$ L__________________________________________________________________________, h' ^5 k+ t0 H8 D! E- t

! z/ w! F4 m3 I- n- l$ U3 uMethod 09) |, g5 o/ V$ j: n4 }
=========
+ ^# k! |9 C8 F9 x" v7 j! R0 F1 Q- e( v5 m" ?" w
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
% I- ?+ p' f4 Z1 Y6 z; ?performed in ring0 (VxD or a ring3 app using the VxdCall).* I) j, n4 X/ C( ^1 w& c
The Get_DDB service is used to determine whether or not a VxD is installed
+ \+ C" H, f: B! b1 M8 ^for the specified device and returns a Device Description Block (in ecx) for1 h: P8 W, S  }
that device if it is installed., A% l) V$ I3 R" J
& F8 f% Z4 V2 ~  D" `% e: I
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID, a. Q$ ~4 n, ]  @
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
5 u' E+ C) s# u, u; W$ D* ~   VMMCall Get_DDB
7 K% B) ]* e6 M- v4 Z   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed2 K  s" ]$ P" O3 v7 [

7 a0 K0 H# |3 y' iNote as well that you can easily detect this method with SoftICE:
* X9 |- v; r' y6 q   bpx Get_DDB if ax==0202 || ax==7a5fh
4 c7 B! A0 H5 o: ?- N
1 j% U5 J( |/ G- ?1 g__________________________________________________________________________
' E% Y) H# J2 M, _1 E* U5 w# j" a' U  E- r" [/ A
Method 10; _& P* }3 |2 c, O& e. A! Q6 ?. C
=========& k, _" E# b$ e" ^! p' O( q& t, R

/ D' P! V: @) {; _6 p8 Z=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
1 k" E' R* l+ M9 }7 h. p1 `0 `# J  SoftICE while the option is enable!!+ t" d8 G7 O1 m
' l; E5 u+ R, p/ I
This trick is very efficient:7 m, D, g6 w2 y) l. R  v$ G
by checking the Debug Registers, you can detect if SoftICE is loaded* q  {2 P0 r8 h6 P9 ~* `
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
2 z) G8 F6 T$ T3 o" s; n2 Tthere are some memory breakpoints set (dr0 to dr3) simply by reading their7 n2 V. s: M6 P, `8 x
value (in ring0 only). Values can be manipulated and or changed as well& _# p. U+ Q3 L
(clearing BPMs for instance)
( Y% L2 r4 [7 L2 A, z$ ?+ }0 Y8 n, s" E
__________________________________________________________________________1 D. @/ n6 B7 d8 H6 b! R% p
: K# {% \) K* s. f
Method 11
# F6 m' @' [3 q8 P=========
8 u1 A- M* f4 o# c  ~! T
1 C& Y" L. g( \& `7 O) nThis method is most known as 'MeltICE' because it has been freely distributed
4 I8 f0 t) {" B5 _. z' avia www.winfiles.com. However it was first used by NuMega people to allow4 b+ q7 j  c) c3 @
Symbol Loader to check if SoftICE was active or not (the code is located7 ^% V& ]+ ^, R% Q+ S" g" b9 u9 o
inside nmtrans.dll).2 ~6 Y% `0 ?- p; \
, @! y7 U9 ]; @" R& C+ W& z
The way it works is very simple:, e' Y+ b/ M  V1 B  w9 S) [
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for( ?! I- d3 L; d* x
WinNT) with the CreateFileA API.
; O: }3 M1 v5 b; S6 b3 E+ y+ F3 [; P2 V0 n
Here is a sample (checking for 'SICE'):5 m) s0 L0 [2 O% Q6 f* g9 ^
- Z6 ~! }" F& y4 B
BOOL IsSoftIce95Loaded()3 {5 H) @4 N6 G- ]5 A- Z) p
{# F0 d& ^/ U. l: G
   HANDLE hFile;  
$ F2 x  j' s" ~1 Q   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
- |3 G, q# i' O) A2 x                      FILE_SHARE_READ | FILE_SHARE_WRITE,5 A6 P/ N: D) w( E: G9 J; `
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
2 f. S0 U: y3 G   if( hFile != INVALID_HANDLE_VALUE )
. X) J* ~, ^# W1 B0 }1 M: m" o9 `   {
) ~* c0 t4 J6 \      CloseHandle(hFile);
( k- e5 b! v: J/ _      return TRUE;
5 Z; \7 _6 m! o0 Q   }0 o, j2 X+ E, Y/ J
   return FALSE;
: _7 H, y6 n0 ~1 R% h; Z}
. L- R( F. S  y' W/ i
! p" t! y/ {7 I1 ]- p& m: UAlthough this trick calls the CreateFileA function, don't even expect to be
1 |: a& T3 R! mable to intercept it by installing a IFS hook: it will not work, no way!
3 k: V' B. v( V6 K1 vIn fact, after the call to CreateFileA it will get through VWIN32 0x001F9 c, R8 g% P- ?7 w9 P
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)6 x: }& u+ R$ _5 D
and then browse the DDB list until it find the VxD and its DDB_Control_Proc
4 u. |, F, w+ m" ^8 h/ Efield.
+ t+ ], O% y/ i% @3 Q8 n( c; r' nIn fact, its purpose is not to load/unload VxDs but only to send a
4 `" ^+ e! b$ e: W' [W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
4 `1 H0 I" i. [( cto the VxD Control_Dispatch proc (how the hell a shareware soft could try
  ~. s1 R1 k6 y6 i; Dto load/unload a non-dynamically loadable driver such as SoftICE ;-).
8 i* A/ u' Z# C  @) EIf the VxD is loaded, it will always clear eax and the Carry flag to allow
/ b# t! O- i" |% _/ m' }its handle to be opened and then, will be detected.
$ T0 {: V1 D+ w- P  i& l( J8 e* ^# _You can check that simply by hooking Winice.exe control proc entry point% s* z, ?' E. L
while running MeltICE.
' V- t6 ^# Y1 u# `1 g& a" b0 U. q& [( v+ j* O: t
$ `  t0 [3 ~' X9 X7 m4 K
  00401067:  push      00402025    ; \\.\SICE
# q4 u1 `: ?! m  0040106C:  call      CreateFileA; W4 t3 T! J" ~
  00401071:  cmp       eax,-001
; l/ X' k+ `5 R7 j4 a; |4 p6 R2 }, z  00401074:  je        004010918 ^1 @2 Y  e0 P: l
, G% z9 X/ P  O
9 I3 z! B; H7 P/ p, Z, P  j4 D
There could be hundreds of BPX you could use to detect this trick.
; M+ C" W. M1 {-The most classical one is:
2 z! O6 T! G/ g- i+ D& f0 }  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
  d; f& j( b4 g  u! a    *(esp-&gt;4+4)=='NTIC'6 n% T3 k( O0 U

6 w! B5 f- I2 M! @, r-The most exotic ones (could be very slooooow :-(0 E- c! i! H8 t4 B) \! s6 W# x
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
, \% d* T: [& Z. p; T% L& A     ;will break 3 times :-(
8 \7 ]4 r4 n/ i) l* v4 r4 g+ j3 `0 v7 l7 T% H; T1 ]! ^
-or (a bit) faster: ! H5 Y3 m) J7 y; o( |0 Z
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')% P/ x4 y& ~% A' o( c! m1 ?
9 G' ]; B# X  g2 T
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
4 Q- Z! Y, U7 i3 D% A( H     ;will break 3 times :-(
8 Z/ Q3 c% R7 ?; E+ c' x' o' b0 X' `7 |  ?3 @
-Much faster:
5 \$ L' W! s7 S" M4 Q5 M   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'1 K( r, q$ a& `

* G2 d# C  z0 I/ h% `) a) ^Note also that some programs (like AZPR3.00) use de old 16-bit _lopen/ Z' v3 Y0 p- \1 p1 n# l& _
function to do the same job:2 A7 z/ m0 {% [. V& a" ^

. n7 W6 W& k) K; E* q4 ^   push    00                        ; OF_READ
! |9 \5 Z- i! z   mov     eax,[00656634]            ; '\\.\SICE',0
% z' E& h' r/ Z7 u5 p   push    eax
  e4 L% T2 i& l+ g( Z0 `   call    KERNEL32!_lopen  {! }0 ]1 U6 s. N. V  [) v! V
   inc     eax$ |9 o, d  L2 y# I6 L8 O  |4 u
   jnz     00650589                  ; detected
/ X: g1 }2 \- f   push    00                        ; OF_READ7 a0 |( y0 E# B& M- K
   mov     eax,[00656638]            ; '\\.\SICE'
6 t) N+ G4 a- F2 [4 ~1 ^4 Y   push    eax
$ w. s) y; a9 c  o   call    KERNEL32!_lopen. O" C, ^  ^$ x
   inc     eax
; {/ P8 A' ]% L% w% L" m   jz      006505ae                  ; not detected4 p0 D) z, {9 e1 ^. F
( ]% i7 x  C$ D: w  ~
% r- \5 [$ {! }6 L
__________________________________________________________________________& X5 s5 @# H2 `7 n; z; b6 R8 _4 ]- {
& N: y# {- q& L1 k& t) }3 ?" l
Method 12/ @! b) g# d" N( R3 w. n- A6 P
=========. V4 j, E* q$ r3 w

+ ]" [  [! z$ p0 jThis trick is similar to int41h/4fh Debugger installation check (code 05' E6 [6 `1 K6 W7 ]1 O. A( e
&amp; 06) but very limited because it's only available for Win95/98 (not NT)
- p/ H& N* X2 G/ Bas it uses the VxDCall backdoor. This detection was found in Bleem Demo.
: M3 N. r( X0 u6 z- F" V& ?8 ?- _
0 S% z/ [- w- j3 {* Z) ^+ ~3 Q   push  0000004fh         ; function 4fh
% E, [$ u3 q; B1 v   push  002a002ah         ; high word specifies which VxD (VWIN32)8 ]$ I% M0 r* D; k( C
                           ; low word specifies which service" H- Q$ a" |8 n
                             (VWIN32_Int41Dispatch)& W( B$ I$ k- e5 m3 K
   call  Kernel32!ORD_001  ; VxdCall2 p2 S8 w  ?4 H. E: f" d
   cmp   ax, 0f386h        ; magic number returned by system debuggers6 n0 u! M6 L: z& U' Y1 N0 _
   jz    SoftICE_detected
$ h% d4 P2 y3 W; K1 f5 J& z. ]0 Z! q& |# e
Here again, several ways to detect it:+ B3 g+ d! f9 z8 ^) M( R+ Z
" @! ]+ c( b9 a7 r: Q5 q, z# @
    BPINT 41 if ax==4f% ?2 a9 M; l9 U1 Q7 ^, y+ x
; [* ]8 B' X% O! Z  d/ q" P
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
3 ]0 y. A) _; K, y& j3 E
3 }2 r! }1 X* P$ t) d    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
; t& c) u7 U6 z- o3 r
9 W0 v& o2 o! }% V1 B3 e    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
$ ]8 b! M# G: v- l2 J5 o  \9 \" D% \+ c
__________________________________________________________________________
$ F1 d% O+ ^* X9 L& y
& C+ Y5 }; s6 ^$ {Method 13
. U; z( Q2 i5 Y; p2 A- v=========9 C+ @# a" Y8 n

2 u: P2 A; n. [Not a real method of detection, but a good way to know if SoftICE is
3 e: z* u+ a& [) Qinstalled on a computer and to locate its installation directory.
* p/ Y& Y7 S% d, _It is used by few softs which access the following registry keys (usually #2) :
; u' C8 l: B$ n8 ~% t( x! z, O/ t$ \
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
0 V* `1 P, K, ?, ]- u8 c* n\Uninstall\SoftICE# Y* l3 q$ o$ `4 J$ @; u
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
, f2 \1 D9 |0 w. H/ `- K-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
: N( ~7 A$ C* |4 r6 K2 {4 i\App Paths\Loader32.Exe' {1 ~2 @9 F: f+ W
9 D3 J; R9 n- b( T

1 ?6 ~% j7 z: g/ K1 eNote that some nasty apps could then erase all files from SoftICE directory
/ \. Y) j7 t- |% t(I faced that once :-(
3 _" @1 a! c* l" w8 e/ @6 x. C$ L0 N
% [0 t1 r" d% t. N& B- |Useful breakpoint to detect it:* u7 b: c: Z/ ?6 s- S9 ?( P0 U
$ y; v5 R/ O! M
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'% o5 ?; X: y9 {0 q
, v6 n) h5 g& H5 Y% [  y8 ?
__________________________________________________________________________
" b4 n& F- E) G! Y9 x% i5 E' x9 C& }. D# C( a( i" n3 l' ]

% e4 T8 B, o4 K* DMethod 14 , z/ J  u% i. I
=========
; C3 n3 r; _; b4 {2 V5 p: ?! p' v. N; G2 f* `
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
& P! |9 {4 ^. ~! `' eis to determines whether a debugger is running on your system (ring0 only).) _1 ~" H8 a2 V$ U8 @0 p  y

) |3 h1 i7 m( {8 x' R   VMMCall Test_Debug_Installed
9 K4 [! ]' F' c& @- e; A' O; ?   je      not_installed
: S2 H' ?3 F6 U' b" u7 k! c/ w3 k1 J! I; O( V( u
This service just checks a flag.
7 S8 |) _" c4 X</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|本地广告联系: QQ:905790666 TEL:13176190456|Archiver|手机版|小黑屋|汶上信息港 ( 鲁ICP备19052200号-1 )

GMT+8, 2026-8-7 09:45

Powered by Discuz! X5.0

© 2001-2026 Discuz! Team.

快速回复 返回顶部 返回列表