About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
* J" n/ ~5 y( k. r<TBODY>0 F% r3 R3 c( w% o6 r# ?
<TR>* y, i7 E! {/ V
<TD><PRE>Method 01
' p" g; [( a" y=========
  s, \9 ~+ [9 I: f5 ]5 x
. ]( \8 c& m; ?% ~  ~This method of detection of SoftICE (as well as the following one) is
* q5 x9 Z+ B7 H  A. a- m! qused by the majority of packers/encryptors found on Internet.+ {3 x3 F& @; d% H+ N' s: b
It seeks the signature of BoundsChecker in SoftICE7 [$ Y+ q8 h6 i7 k4 b9 V

8 h& N8 E8 P+ n) t    mov     ebp, 04243484Bh        ; 'BCHK'
" q" a. N, J: z# D  t$ D# D    mov     ax, 04h
* S; `. k# i. ]' e    int     3      
2 @5 P* q1 H% S+ G$ f    cmp     al,4( `2 v! Z, S! O0 O1 G9 j1 V
    jnz     SoftICE_Detected  b; h% p2 }7 |% H6 k, B- R

( R1 a8 p1 p/ J; H2 H7 [( j. n& _* ^; ^& m___________________________________________________________________________) U; ], u$ c+ ]9 C- E' R
* a8 M1 }1 q% n0 g( k* H" ]' y
Method 02) P, e* _  Y6 |7 R& u+ T
=========
$ \- X5 C! I& q) e; k7 x) s
* }: R/ u) D- Q/ g1 sStill a method very much used (perhaps the most frequent one).  It is used" j2 |8 o9 d. N6 y
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,2 s4 V9 K7 Z- \: U& |
or execute SoftICE commands...+ I4 Z! m! ]% i4 }1 H
It is also used to crash SoftICE and to force it to execute any commands
% m: Q. W0 @; [+ U(HBOOT...) :-((  
2 v. E  U* D$ b  X7 F/ b
0 B& p, T) @/ Z2 YHere is a quick description:
& k, I& W0 X! p# W; v% Y-AX = 0910h   (Display string in SIce windows)
  `3 \- M7 V6 P7 J- p-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
  {  L9 n: k) K: B% g! y-AX = 0912h   (Get breakpoint infos)
0 c0 E# q2 d) Z: Z- e-AX = 0913h   (Set Sice breakpoints)
3 _- @7 K+ F6 ^- ?' n4 _( J-AX = 0914h   (Remove SIce breakoints)
/ Q1 ^# ~) r9 n' a( D) `* ~& h3 s  b8 j. D
Each time you'll meet this trick, you'll see:
/ ], ^! f1 H0 b* g8 P! Z-SI = 4647h
5 L8 S. \9 \* q  @' N-DI = 4A4Dh- H4 w  J) e/ F
Which are the 'magic values' used by SoftIce.
! p) r3 g. b( b' e& l2 l9 FFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.( h) q: @  t3 @' O

5 D; p5 n. h% W9 C5 r# p, [Here is one example from the file "Haspinst.exe" which is the dongle HASP3 Q: {# T' G% C8 V
Envelope utility use to protect DOS applications:
0 H" C# B% F8 _5 x
( n4 f" G) C4 Y! Z6 H$ w4 c5 y. q, B- L0 _% q" r; G) S; J
4C19:0095   MOV    AX,0911  ; execute command.
7 Q$ D7 ~( y8 q4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
+ J7 D- _- k2 c3 M4C19:009A   MOV    SI,4647  ; 1st magic value.
" B6 d: k# \! g! e& X" k. ~& @% i4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
. b) ~: j7 z& X# M# E4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)# |0 z# G5 L/ j( y
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute6 G+ d  Y. q  N% ]* T3 |' M$ C
4C19:00A4   INC    CX
8 r/ f% J( f. z9 g; C) i4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
1 G; d8 J  w# B! S# O9 l4C19:00A8   JB     0095     ; 6 different commands.7 n6 `: `) R* r% h3 b+ a- P
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.7 |8 d# `; r6 ^6 }) D; h  G
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)% R( s2 p9 s2 D: C! q# R- w
3 g* j, o2 r4 |: Q2 x3 |! a; @. \
The program will execute 6 different SIce commands located at ds:dx, which
& y5 s1 y: W/ N! Gare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.7 H5 h, q( ~3 ?. ]

4 W& s$ Z$ b6 Z: f- h5 B0 W! w* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.8 j, i+ M# {: j2 _
___________________________________________________________________________
% ^* I" F; r/ ?9 w( ?0 p$ i4 n9 o, i$ b
9 z1 ^% f9 k3 W. X$ r9 W
Method 03
7 n& a! D0 f1 h# P! z( A=========
2 g- B$ H/ R4 A4 O( h) l! r- z
- S- u( r" J+ u5 ELess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h! ^. a" r6 D3 q. F7 }7 y
(API Get entry point)
/ o/ ~& }- T- C        
/ B! J- K9 b/ R& W, j: W
" v- Z+ n* ?* E0 }    xor     di,di  T1 p3 v# j, t9 q: a- g$ H0 A
    mov     es,di
# s+ s6 ~8 L* ]! f    mov     ax, 1684h       # ^0 _3 G. w$ s, [; B7 U/ p
    mov     bx, 0202h       ; VxD ID of winice
0 S* w4 x9 h- G- z, }    int     2Fh
' s% W4 [6 q, E, l) r  B" `    mov     ax, es          ; ES:DI -&gt; VxD API entry point9 b& X7 L# e. O0 U  g
    add     ax, di
: i% V( i# q: _% t3 S4 k    test    ax,ax
* h7 Y: X6 Z4 y7 z/ |    jnz     SoftICE_Detected
1 o2 a$ i; d, P- t$ o/ T3 j* v+ R) X6 c$ m# x# l* E3 q  f
___________________________________________________________________________$ _# U2 c0 A; O

/ G0 N5 X, a: sMethod 04
7 ^6 _- B- A7 q9 }  |, q=========
) _, p9 s2 h' t! Q, K- v0 T5 b& W1 [# L+ b& U- M# O
Method identical to the preceding one except that it seeks the ID of SoftICE' e6 V+ c/ V8 N& f
GFX VxD.
1 l6 [8 X5 @1 K) n2 a' G+ X# A: {4 p% F) q& C
    xor     di,di2 m# w8 [$ s1 j/ C- O( K
    mov     es,di
! o0 }! v& V1 u& c    mov     ax, 1684h      
8 T- D- O! |* n3 _1 \" }  V    mov     bx, 7a5Fh       ; VxD ID of SIWVID
. B# m* X2 E+ _4 z    int     2fh
9 p. h) c6 {5 C    mov     ax, es          ; ES:DI -&gt; VxD API entry point
! M9 u; R: t2 i5 u    add     ax, di& E* |# g' T# |5 y, w; O. l
    test    ax,ax7 r; G2 N6 C! v6 T/ @; x! x  U; q
    jnz     SoftICE_Detected
4 K! A$ W  S4 W  U' l2 G1 }: t* Y, `, e' f5 b/ {  _' T
__________________________________________________________________________
7 O/ |. }4 k$ W/ _
& W7 X* o# l* U3 H# [# _
0 h4 N+ E. V7 iMethod 05
. p9 H0 d% S8 I8 U' F- b=========
- |. C+ a2 A0 v0 B# Y9 f- s9 K& M$ W% R1 B
Method seeking the 'magic number' 0F386h returned (in ax) by all system
+ }  Q/ |  J" w: q2 M/ C4 |debugger. It calls the int 41h, function 4Fh.
3 L! w& p" a- jThere are several alternatives.  & P% w- B5 h1 X- W) d

8 a8 O& z* W( h- v$ c7 ~& l. JThe following one is the simplest:
$ j3 _! Z9 O) \2 ~0 _0 [) {9 w
+ ], j; O5 n# X- ^; c    mov     ax,4fh! i0 _1 [2 I0 O4 G
    int     41h. F& g7 _6 R) t* O% c- @1 k
    cmp     ax, 0F386" R& {( c0 v% z7 I8 @% n  O$ V
    jz      SoftICE_detected
; W( u! K" j- Z. c# H( H
3 i8 R5 q( X% }1 q6 p- J; F, n# ?2 O9 v2 f" s
Next method as well as the following one are 2 examples from Stone's $ [+ O5 B4 J! {( d5 [
"stn-wid.zip" (www.cracking.net):
: V2 i, M4 n, A% D  B2 M4 M) i+ w9 h; R- ~3 m
    mov     bx, cs
5 q/ r- v  Z: V6 @# F' U: q    lea     dx, int41handler2+ Y% }2 A  z( V$ v; ]
    xchg    dx, es:[41h*4]
( O/ Y  v- S# U: |    xchg    bx, es:[41h*4+2]4 J+ R+ S+ h- b1 H8 n" x+ W  O+ h
    mov     ax,4fh9 V8 T+ s7 C7 F: N
    int     41h* y8 T( p$ `8 O) C
    xchg    dx, es:[41h*4]
0 e7 d4 d$ S3 z. B    xchg    bx, es:[41h*4+2]  K# }2 x$ W, o' R" c5 H" g
    cmp     ax, 0f386h
3 K4 D) y: ~, K8 {. v) r    jz      SoftICE_detected
& k: B, ^- F4 {( F, b3 @
8 }" U  m0 N+ P3 L3 ^0 \: q% Tint41handler2 PROC" M* M5 _$ Y4 g0 W4 R
    iret
+ V: g2 N! r. f3 ^int41handler2 ENDP
6 F6 C: v& p/ g( n# e7 F( F2 |; b1 |* ], h- n1 ~( F
, j9 p( p! u0 j" A
_________________________________________________________________________
8 y. }, C9 ^1 g5 O& q
/ e: a* u" v. @" R) B- c, P; E; m& U1 K8 _& x: T" \" ?
Method 06$ b6 @8 I7 t$ s3 R0 R* D1 Y
=========
, L9 ~# {+ C4 S0 c. y4 J  e
9 Q: S- k% e4 E5 {* f
& A: R! l- m: L- g7 W3 P! O2nd method similar to the preceding one but more difficult to detect:
2 n4 u5 X# C3 Y6 M6 w
; z7 c9 W/ F; O4 K& t  |8 S5 i( [9 X; Q; G; a5 l" j, ]
int41handler PROC; D; ^7 g  \9 w  n$ I
    mov     cl,al
8 W7 m  v9 m' s/ c. j6 ^$ e1 V    iret
( i8 h, [5 C9 H1 B1 A9 Jint41handler ENDP
! O- c% S  ^* {* {  D, d
+ F% [9 `* O! G2 t% s
. [, I: f2 w. n' a, T7 g7 `    xor     ax,ax
. U9 j# E5 ^* Z% D    mov     es,ax9 c% A6 R% x  Y$ p4 B- T
    mov     bx, cs
. f4 r" ~, j2 @    lea     dx, int41handler2 G9 L$ `9 d. U9 c0 I& }6 j( F$ i
    xchg    dx, es:[41h*4]. h+ D/ o2 k0 P! g+ r
    xchg    bx, es:[41h*4+2]/ v' v& r" n6 r  ]  V# o& {1 n
    in      al, 40h% `2 [" S* u: g% f: p& e1 z4 b
    xor     cx,cx6 H9 ^, q6 T) q
    int     41h
$ E) O8 I: v9 |/ I    xchg    dx, es:[41h*4]6 y3 ~1 |; X/ f5 o$ B+ @
    xchg    bx, es:[41h*4+2]' `/ j4 Y9 d1 J0 A, @* n$ }
    cmp     cl,al
' t" s/ L, O6 X0 w! R, `    jnz     SoftICE_detected
+ [$ v; _+ ?) a8 b. T8 m7 m% H5 s$ Y4 B9 R
_________________________________________________________________________+ o  c: }; S- v/ g. p; Y' v
" p: s/ v8 A) L/ c! Q* H; O- C+ x; L
Method 07: u/ Y+ e  }3 @# D
=========" z5 [; T  v7 [

2 T: z. \( O# ~4 I3 S4 s2 JMethod of detection of the WinICE handler in the int68h (V86)
; B$ g, w% F/ K5 s" @
4 F, a% s' t( i  B0 `    mov     ah,43h
& W& t1 `0 s9 ]2 M- j5 G* P% s    int     68h
2 i4 Q9 C  c7 i- ~  G+ [    cmp     ax,0F386h( v' \+ }) o4 ?3 X: {2 K' f
    jz      SoftICE_Detected
+ m- f# W3 j9 I7 j1 T8 p$ w
  o9 k8 @; K+ `' E9 U) a( B2 [0 W1 z' W( ~# ]. b9 |. S  R
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
0 p; G# x! s9 h8 F( K' q   app like this:
/ E/ Q5 N3 G9 E! J! N& v, k' i' A) i8 j9 Y9 u: I# L' {# e
   BPX exec_int if ax==68
2 }$ ]! |9 K6 c   (function called is located at byte ptr [ebp+1Dh] and client eip is5 C- k# S7 `$ T6 @8 x, v6 D
   located at [ebp+48h] for 32Bit apps)- p  \9 g1 _3 Q  n" o
__________________________________________________________________________
* b  G& r! J* {  o" Z) _$ K$ F# G5 B& f. z7 ~" C. s/ K3 ~
2 Q9 \" |7 b( c
Method 08% ^# B: a. P3 G  S6 ~+ F/ R
=========' h4 [% n  i5 _; S+ c' A
% _% v1 d% S8 _* K7 n# T- R
It is not a method of detection of SoftICE but a possibility to crash the
( l: f" O) ^5 j% o1 l# X4 Jsystem by intercepting int 01h and int 03h and redirecting them to another
9 m, P2 x, Q) t8 }! e' sroutine.
; w) ?  @% `5 l$ G1 q. I! KIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points& m+ L( k) V6 B
to the new routine to execute (hangs computer...)
9 l/ K6 a$ y5 _# J) P% f! }0 }3 I  t' h. u
    mov     ah, 25h2 G% ~7 `# r7 I) Z2 v% ~
    mov     al, Int_Number (01h or 03h)4 `9 B* x) c: g2 K6 r# \
    mov     dx, offset New_Int_Routine5 U( S: e$ S3 y" z
    int     21h
: y2 D0 e$ r+ F( e" b1 x+ C, f: D- G1 O9 ~6 S0 I
__________________________________________________________________________
- M! z8 a6 g- K2 y7 t' @2 w: F* \6 E4 I# r& t
Method 09. K' T& T$ c, j8 s* K: B
=========+ E2 }- R7 _$ S& o% p

0 h# H7 N; c% U  y/ ]" T: _" vThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
' y$ L( f" N5 U/ w9 T( q$ G/ G1 \performed in ring0 (VxD or a ring3 app using the VxdCall).
0 ?! Q* |" Y+ cThe Get_DDB service is used to determine whether or not a VxD is installed
9 n" G  c  V2 z) q2 d! g9 D* Pfor the specified device and returns a Device Description Block (in ecx) for: c& Q7 W# M" v  q0 P
that device if it is installed.$ J' t. w7 t& D4 |

0 g. E; b! f( g& G5 J; T1 K   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID+ Q- S8 }! o% o4 g
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)4 o( y6 c+ [# ?) }
   VMMCall Get_DDB% |4 b2 z9 W4 J7 D
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
% x' o0 u0 v; q! E; I/ i4 {# z
0 c- g- G% J' WNote as well that you can easily detect this method with SoftICE:
3 e9 u6 Y5 d6 h' \5 f; Q$ m   bpx Get_DDB if ax==0202 || ax==7a5fh
5 e8 [$ U! m* C' }2 H: M% W" h0 p8 y# q; s5 @
__________________________________________________________________________" E1 `+ T4 A  e  @5 @* m

5 m* h! o- a% l' Z- a6 c2 SMethod 10
2 v  N5 Y% v2 u! P1 c=========
8 H. l* L- r2 |" M: l& I7 @& U4 m7 X0 U! p& f: U& ?8 m; P
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with0 L) f0 u- z5 w  T* U
  SoftICE while the option is enable!!5 v5 W) N$ K3 W( Z% \2 W+ M
2 B" U+ [9 H3 d7 e5 r* D* k$ G
This trick is very efficient:
3 W5 i/ h% b7 H1 nby checking the Debug Registers, you can detect if SoftICE is loaded
$ ?6 P5 Z9 e/ P- q' A4 L(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
: A+ Z  j* o# f, E0 b$ `there are some memory breakpoints set (dr0 to dr3) simply by reading their6 z4 ?& g2 T9 `8 Q: n
value (in ring0 only). Values can be manipulated and or changed as well2 ~9 L: r; c4 \/ V5 y8 ]
(clearing BPMs for instance)
+ d8 C6 g8 R4 G0 o# V9 W$ t+ D+ R( z8 t% ?0 c3 W
__________________________________________________________________________
; e3 z. o% L1 I! {1 U  O; ~8 b" c* v6 n3 a8 n& M
Method 11
; H, o" }" e( L3 F& n2 ^=========
5 r  x0 y0 w0 g  W2 X; {0 _" z: Q) `  e. P* S; m* p% f5 D
This method is most known as 'MeltICE' because it has been freely distributed
7 A$ z+ b6 H5 C! K9 p; g" Zvia www.winfiles.com. However it was first used by NuMega people to allow7 I7 F, W$ N/ h+ E: H
Symbol Loader to check if SoftICE was active or not (the code is located
! t" p  B" f. b9 r4 |; D) Z: sinside nmtrans.dll).4 a$ }8 C0 F2 E

/ R. d, g$ Q- W' [# a7 }; PThe way it works is very simple:# I( P6 @. S) q4 R7 C) n# ~( `0 b
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
) {6 {2 B+ a; C. M* m1 j  ZWinNT) with the CreateFileA API.  A- y7 ~' j$ x5 ]1 T4 Q% Q

( F* _- t% U8 x$ tHere is a sample (checking for 'SICE'):( v1 Q0 H) J$ l& t6 M

5 {  M$ a8 y( M: B; C# P) S  tBOOL IsSoftIce95Loaded()8 t6 }' E! L4 j. q+ N
{
* r" u. v) [- g/ W  e   HANDLE hFile;  
$ H+ T, ]# l5 b' L. H/ G& L2 ^   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,8 U& S  z( B, m
                      FILE_SHARE_READ | FILE_SHARE_WRITE,
. `  h3 S. U! f0 a' h, j                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
8 f) Q$ t+ v2 |0 u- _/ h: _% ]   if( hFile != INVALID_HANDLE_VALUE )
+ `7 a$ v: F# P, h1 p   {
( ]2 G6 k. P4 \: }      CloseHandle(hFile);
. R% S  i+ ~) ]7 O+ R# y, g- Z* Y9 t      return TRUE;5 Z% z0 b. i2 ]3 r' V# Q
   }
! _  a& C( `( }   return FALSE;
) V& C  \  I# ^% q, ]}8 p! i7 `2 E1 _1 i5 m
6 A& O% E( m, W* r+ P6 a
Although this trick calls the CreateFileA function, don't even expect to be5 _3 h- T- s2 ]
able to intercept it by installing a IFS hook: it will not work, no way!& B! m' a" y: y/ K
In fact, after the call to CreateFileA it will get through VWIN32 0x001F5 }! s' \# m1 N5 ]: Q
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
# g: t) q( L4 C6 [8 Qand then browse the DDB list until it find the VxD and its DDB_Control_Proc! U6 g6 k, E  j) B* t
field.0 m5 g3 I$ g6 ?9 G- b" a
In fact, its purpose is not to load/unload VxDs but only to send a
7 a5 i% G! q+ m- h9 o9 v* NW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)# t4 n8 W2 Z* c7 ~5 H7 d! j
to the VxD Control_Dispatch proc (how the hell a shareware soft could try$ ~9 [- {4 X5 R+ C4 x; o! f' ^1 j
to load/unload a non-dynamically loadable driver such as SoftICE ;-)., F' k3 f( O% j% {
If the VxD is loaded, it will always clear eax and the Carry flag to allow
+ n: G- X; K; A6 Iits handle to be opened and then, will be detected.# C2 a% S) G% ]- c* P1 I
You can check that simply by hooking Winice.exe control proc entry point
. O' a- Q, u& Y9 l. Y8 W, ^while running MeltICE.& B& ^' _! B$ o  n  Q, K- Z

& g- G/ B: z! f5 o, Q; O
/ b* g7 O' q. q  00401067:  push      00402025    ; \\.\SICE, C; \3 k$ i5 i# p% G& ]) U
  0040106C:  call      CreateFileA# Y( e4 |6 B" L( \; T1 f! O
  00401071:  cmp       eax,-0011 C! L9 p1 X3 B/ h0 J5 @6 o) C
  00401074:  je        004010910 F( r: f  s' p1 D- F
5 n" j, }6 @6 h- o0 B) L  {
: B- a1 W8 g- D8 z! ~$ |# Y& U
There could be hundreds of BPX you could use to detect this trick.
: S8 i  g4 [$ z/ a9 k7 O-The most classical one is:  k9 M! y" H3 y. j# u( C& W
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
/ S7 ~+ V* z8 m    *(esp-&gt;4+4)=='NTIC'6 W) Z  L# I5 h/ Y' Z& x) s) K
+ h2 S" J4 P( i1 R' J; D1 @/ c
-The most exotic ones (could be very slooooow :-(
! j9 l" @# i# ?( b1 ]% G& J   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  " \. u) K0 A+ l: p8 p
     ;will break 3 times :-(" i# n; a: ^7 ^
5 @1 j/ J( \1 V
-or (a bit) faster:
7 o- c; h. v: N! d   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')% ~- }$ l8 G% X: m: n
6 b9 L5 u0 H& Z0 p# `" ~
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  9 q2 v: \% A& A2 H% U' h1 r6 y
     ;will break 3 times :-(! S: W9 C9 R2 @& m) h( @
- u! E5 o3 w: D" H  I
-Much faster:$ P- X5 k& y& i7 N' E
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV', F# r) P9 i1 W; I2 @
5 D( o2 j5 S8 S, t! m0 I8 ?( E3 m
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen
8 r: }7 w, p5 C& Rfunction to do the same job:
% ~; G1 l0 W& k8 g5 o6 J; ?/ r" B: w4 P+ h( T9 o+ }
   push    00                        ; OF_READ' J( l3 k- d: d, s1 @
   mov     eax,[00656634]            ; '\\.\SICE',07 E/ n% H6 O' A4 Z' z3 g
   push    eax
) j! [6 f- n2 `" t  [( T2 X   call    KERNEL32!_lopen1 K+ l: t3 H+ @
   inc     eax
; z  G, E; M; t: C9 A   jnz     00650589                  ; detected
/ p$ l- V1 v* q0 B  l   push    00                        ; OF_READ
& {$ K" M2 u" [, Z6 P   mov     eax,[00656638]            ; '\\.\SICE'
1 Q# Z, e" ]& R1 y/ k1 }$ @0 K   push    eax7 k/ J) m1 O! p7 t
   call    KERNEL32!_lopen
0 i+ Y8 M8 ]! O' [1 G: R   inc     eax
9 V6 j: t* Q! j   jz      006505ae                  ; not detected8 S; s4 E% E) y% R5 ]. E
% R, `* y$ n( q" s- p

1 }' X+ K2 @3 e$ R5 a__________________________________________________________________________
1 `( K9 Y: B/ b0 u$ Y' @0 o' Y; T2 a. ]& c0 z* q; O
Method 12
% @/ w2 t# |9 p8 |) @4 D=========
! C; `+ |8 H7 j* I; ~9 [- P8 G
This trick is similar to int41h/4fh Debugger installation check (code 05
8 q$ V: |! Y: l. \+ H8 @/ H&amp; 06) but very limited because it's only available for Win95/98 (not NT): ^% j# \# U7 s
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.2 A) \, K& J5 z

# j1 J! g3 i9 t/ U8 p/ p   push  0000004fh         ; function 4fh( b4 s% e. W7 e! C; F: t* X
   push  002a002ah         ; high word specifies which VxD (VWIN32)
) M4 x5 F% b" C- S: J$ g                           ; low word specifies which service
; j: ?( Y4 y# e/ g+ {/ r, q0 |                             (VWIN32_Int41Dispatch)
: }) M: C# W# m% H" F   call  Kernel32!ORD_001  ; VxdCall9 D! y% L9 C$ I( D4 m
   cmp   ax, 0f386h        ; magic number returned by system debuggers
  O; P. |& C1 T. S: n; Z9 m: l   jz    SoftICE_detected  M9 Q* C* ?6 {% C

8 s7 |! j* I9 v0 e* R% gHere again, several ways to detect it:
/ p3 ?7 H" j. ~+ b- |: A. X: B4 D6 ^/ e
    BPINT 41 if ax==4f
" P6 ]  f( d3 S' u. ~" v3 T. U
- d' w8 V$ Y' G4 \    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
2 T! N: z' N8 B: U" d1 x) H3 W; z3 U
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
) V( _  s8 n. G; c, P5 y
% ~: W* g) D& R4 C3 r4 s    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!: Y/ _: L3 L! A8 V
- L0 @) l- A0 i0 X0 z
__________________________________________________________________________+ O, S; s9 p  S' o& T8 \

& q" g/ y1 u) b5 wMethod 133 D% Y. W( C7 e; D! M4 A
=========8 h; ~0 u' y7 t/ O  w7 T$ ]8 ^3 J7 p  G

' q: N6 L0 R, K: VNot a real method of detection, but a good way to know if SoftICE is. E, W/ S2 P1 {
installed on a computer and to locate its installation directory.
. l( X# t$ U' sIt is used by few softs which access the following registry keys (usually #2) :) Q0 e% H4 M$ E/ H5 s

  \' `" {# M+ U7 T$ ]4 Q  `7 w-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
8 ~. d0 A! Y2 P# V* z/ }\Uninstall\SoftICE. R: i- K) \% h+ ~9 J: {# J9 G& `
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE7 c; F) t8 e+ J9 ~) h6 F. \8 W+ i
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion$ m# k- r5 `# u4 A
\App Paths\Loader32.Exe, q( }  X- Z6 p" L) z0 ~1 K; F3 e
5 Q* f* W% R/ R4 |
% K6 S! V0 u  s! }1 ~
Note that some nasty apps could then erase all files from SoftICE directory
. h/ i, n0 j2 y1 d6 ^; I4 N(I faced that once :-(2 ^  S. e+ I' \) B% d' A8 g

  H( n7 J; t; Z$ oUseful breakpoint to detect it:: k: D- Y0 m% v3 |, p# P

6 p* D" c+ O' }+ x# c0 u     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
. P0 Q; n( Z, I6 `/ X$ m- ^, z/ ~0 o* O, j% r. {! [2 ^3 A9 T
__________________________________________________________________________
& ^, ~) w! x; A
& H  G) h! M2 {! x
  G4 D, f2 _* Z. Z: H/ sMethod 14
0 P( s% k  a2 G=========
# J0 `) M- M+ d% T+ M7 i& O* T2 U; g2 K9 h
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
3 b  @  v5 r; B/ p6 R2 c/ n% ?is to determines whether a debugger is running on your system (ring0 only).3 x1 y9 A1 \' h) h8 k1 u" j

* Z. n9 c* v7 q( ?# ^% m1 @( n) n   VMMCall Test_Debug_Installed% ~: D2 M- v. {( K* z
   je      not_installed
8 {/ F" c$ C6 s; Z% L' ^0 ~: R; r$ {8 F& g+ h$ e7 s
This service just checks a flag.
4 H( t5 V4 x+ L* Y! S: E1 g, F</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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