About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
- s# W( q$ j& x3 y( K<TBODY>
3 c# k, p4 Z* R5 D* d) y' p<TR>4 @( K1 R; r# Q- m
<TD><PRE>Method 01
1 ?: F/ \6 E* g: P=========
( D, _5 X  \/ F5 `
$ o9 a' U/ x* _& ~! e3 e/ sThis method of detection of SoftICE (as well as the following one) is" u& H* R* g- _9 _" w# [! P) Z) ~
used by the majority of packers/encryptors found on Internet.
  p% K" R2 u+ X' U3 M7 QIt seeks the signature of BoundsChecker in SoftICE
1 c: _7 g5 }; i( c8 x6 X. Y0 p( ]& i' @  R0 D0 j$ n& q# h
    mov     ebp, 04243484Bh        ; 'BCHK'4 k" w3 S  w( d) h
    mov     ax, 04h$ L7 R9 k8 \# S* S* B* v+ }, B- X7 y
    int     3       ( o+ w' H, T4 \) s4 {
    cmp     al,4
- i6 e& S% d" A7 ^( o5 z    jnz     SoftICE_Detected: L& R( E& N! A* q- ~

$ g9 B' x7 |& Y___________________________________________________________________________8 P+ E7 a* e- X( @# F/ k% A

% M+ ~2 L4 d7 dMethod 02  p1 n4 Q/ [( z( R. x4 q
=========, P  W7 e$ R0 \5 o. |/ f4 f
( X3 C+ s6 O) `
Still a method very much used (perhaps the most frequent one).  It is used$ v- t5 b1 i+ Z$ k. I3 j7 C
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,/ R: @' ~2 w% z# S: x
or execute SoftICE commands...0 O% y4 v4 G2 {8 g7 g4 Y
It is also used to crash SoftICE and to force it to execute any commands9 _3 v+ u' W: B' ]- x) W% q
(HBOOT...) :-((  
+ K$ h& N) M9 V- l1 W4 ?
+ f  r8 \% M8 R& u& HHere is a quick description:. n# g1 c1 J1 X( @, t
-AX = 0910h   (Display string in SIce windows)
" V2 y0 u& f2 c& n9 H0 d-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx): z* c% N  H/ `. S' i9 e$ P
-AX = 0912h   (Get breakpoint infos)
% M8 w( H/ |& k" T-AX = 0913h   (Set Sice breakpoints)# S8 m+ q  r8 W
-AX = 0914h   (Remove SIce breakoints)
5 J. k$ E9 e1 D5 J) ]( F
  W& Y8 F! i# j* k. P) o; iEach time you'll meet this trick, you'll see:
1 `( ~9 u4 q+ X$ w2 B/ x& Y+ z-SI = 4647h
/ }( y  g. Z5 z0 B5 x-DI = 4A4Dh
( W0 K2 b& _# l, H/ OWhich are the 'magic values' used by SoftIce.
3 E+ O3 [! B) O* aFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.
) o& N* e8 N4 z! y$ R
: U& h. S8 l# Q7 W8 DHere is one example from the file "Haspinst.exe" which is the dongle HASP; u7 s) m% R5 ^, l1 W! t9 G
Envelope utility use to protect DOS applications:
7 f/ y: a- W' x
7 c5 g+ a2 u' w+ R+ Q% N8 r: s. k! T( H9 w$ i% Z
4C19:0095   MOV    AX,0911  ; execute command.
) [, s9 S+ G% A! F+ x4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
+ {' ]: O- c; s' d; G, f4C19:009A   MOV    SI,4647  ; 1st magic value.
; j, d# v9 v! u0 w  U+ `4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
( [& h9 M* s4 r; R4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
9 G5 d& @* _& N8 ~8 q4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
" V# J" f% H, x' z- ]$ ?9 H0 P& b4C19:00A4   INC    CX- A9 G9 A* |2 @
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
! A" N4 e, m- I& T" `# J+ A4C19:00A8   JB     0095     ; 6 different commands.
, D$ \; x- w1 j% s3 ?% L4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
# ?5 C  L; z: `6 i' h. [' N, ^7 H- }$ H* P4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
+ H! x9 J0 ?5 P0 l7 n' b2 b
" l) H+ D$ g% H0 S) tThe program will execute 6 different SIce commands located at ds:dx, which
8 p: t* F4 U% M' s! jare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.& @5 C# |% j7 m. |
$ T' X: c. D* ?5 }9 Q8 p& ]! \
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
. u& e; N& [9 J* J4 y1 Q* k___________________________________________________________________________
1 k; F8 H4 G& w/ R5 V- C& m
3 \( |6 e; y) k+ A" S
& J% @- m% T! t/ {Method 03/ K2 c( \% t, m% T, Z' o
=========
1 k" q, S: B# T) E$ s1 X. b. K9 T7 ~8 y" K
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
5 K3 T) }0 k6 {2 y(API Get entry point)  l( }7 G! D0 J" q4 w% p# s" T$ s
        
, y# d6 i0 O0 X1 o$ Z/ k8 |% M* H; d  w7 w; X# _; \* ]
    xor     di,di
* ]* h5 Y  R% Q8 F* ~5 e# O    mov     es,di
8 s$ O4 b+ U0 t    mov     ax, 1684h      
* t2 @1 N' S" [+ H- {, R; R6 ]: g. i    mov     bx, 0202h       ; VxD ID of winice
! T- u! [1 j1 E9 ^2 C: E    int     2Fh
: w# R4 N- t* x- x) l  x    mov     ax, es          ; ES:DI -&gt; VxD API entry point' y2 m+ C5 l& d1 c1 g9 K: q
    add     ax, di
9 d/ E, `/ V# k4 V    test    ax,ax
2 P; e( [2 q9 H. F    jnz     SoftICE_Detected- ]( g, A1 B8 w7 u
: E9 Y' Z! X* @7 o) w" |
___________________________________________________________________________2 k# o: \' G$ O) p2 J

9 C+ x; ^' _: F" oMethod 04( y% M1 A& a& w" F
=========
3 G, K+ z3 W7 `$ Q3 U  V
3 u$ S8 E1 R' A+ UMethod identical to the preceding one except that it seeks the ID of SoftICE
: I8 v5 n, v0 W& ^  B8 r8 sGFX VxD.
$ f9 V' A& f- m' z; y7 w9 I3 P' D; K' T! h& r! N% Z  P
    xor     di,di  R8 S* S, U$ M1 ~; v8 W: h
    mov     es,di! y8 ^5 A/ h& }( K6 H
    mov     ax, 1684h      
1 [9 {" [2 D' K6 D" ?% U8 w    mov     bx, 7a5Fh       ; VxD ID of SIWVID
8 c0 V3 C# _7 r- }& D    int     2fh
( K: X+ L) q% Z$ Y    mov     ax, es          ; ES:DI -&gt; VxD API entry point0 F% K. \  X7 n) t2 v$ h$ m
    add     ax, di$ T+ |2 ^$ }# f1 r( V" \) l
    test    ax,ax1 }; R2 l( B9 G( Y% K. K9 h  h+ Z% A
    jnz     SoftICE_Detected
1 ^$ V2 w* S+ g6 O+ Q8 O, [, o7 g! a5 T, ]
__________________________________________________________________________& h0 \& L2 U6 T- l/ n, G# j( j; P
9 i' |) {: S7 p! H1 m0 S* {: _

1 Y' [/ ?7 B$ H: SMethod 05
& Z) f2 Z$ D" L5 t5 L=========% b/ T6 h( m5 F2 @& `& \

/ B2 z. |1 ?* }# hMethod seeking the 'magic number' 0F386h returned (in ax) by all system9 K: O5 |$ P3 f9 Q( D0 `4 o
debugger. It calls the int 41h, function 4Fh.& [$ B4 r9 g0 Y
There are several alternatives.  " F5 i3 M5 m' n7 A

3 c: a* ?8 c8 R$ i3 PThe following one is the simplest:
$ _1 B: U" C0 X6 \' x% V7 I# U9 A
0 o, i& S0 H3 g    mov     ax,4fh
+ y  \; ]' |& v' d2 N6 [  }    int     41h! G' P& F! z# r0 B+ I
    cmp     ax, 0F386
7 g6 q( Z8 E% w5 o    jz      SoftICE_detected7 J+ N9 F1 Y( z- M9 Z4 X: b' J
% E* ?  ?; O2 g* [9 }
: b1 I3 M, X' R
Next method as well as the following one are 2 examples from Stone's
6 T1 ]# T7 K( K3 Z/ E7 ?& X"stn-wid.zip" (www.cracking.net):
5 r# k( b) P" z8 J
% M2 p/ T% _+ m4 j* ~    mov     bx, cs8 D0 k9 s: \5 d2 F! m& d) q0 R
    lea     dx, int41handler2
6 ?* b5 j) u  [9 z1 {( [    xchg    dx, es:[41h*4]! w, T  c+ R! U" w- \6 ~) E
    xchg    bx, es:[41h*4+2]$ Y  N( ]  V; m
    mov     ax,4fh
# `' g- q, Q5 s$ z( C    int     41h
* W, |, ^- q8 @: {    xchg    dx, es:[41h*4]8 ?: H. d! N! R* p
    xchg    bx, es:[41h*4+2]
7 [, B/ f0 |) K. t" j    cmp     ax, 0f386h
/ J- a" U9 f; r' v9 F/ @7 K    jz      SoftICE_detected) q! {0 P  r# H
1 S, M5 J7 y9 T; c- o& t  @* h) T
int41handler2 PROC1 U' h4 E3 K  ]0 `  [
    iret
( T- p/ D. ^  Z( iint41handler2 ENDP
9 X  s4 T7 H/ q3 C" q' H) E" q
/ t2 {  p2 t) n+ s3 B5 f# ?+ M8 @" O, O3 I# A' x7 y# B
_________________________________________________________________________
" R/ E, {3 z2 O1 L- i: z  X# l% H
! J! ~* N" d% i# m+ u+ X2 n- t$ h0 @3 W* b* Y4 V& f1 P" x: z  ?* K! I
Method 06
4 @8 k  v. t1 F+ _  b' l4 h2 z4 e=========
& y* h& N. [3 g3 V: L8 X4 v" w4 P+ ?+ C, k% H# Z: p6 l

5 n/ f0 x! d6 g) f3 ?/ m$ Y5 i5 e2nd method similar to the preceding one but more difficult to detect:& O& c5 _; u9 h9 w* x# L

4 E  \6 ~# U! Q5 @! t4 p. n( K, z5 \) |- y: ^
int41handler PROC
. M- g/ F7 f9 P7 i1 c5 E    mov     cl,al( i" e4 W* l. a. F! U- u
    iret# L5 ]$ a7 [1 `& i7 z, v7 t
int41handler ENDP0 B3 X9 I* J& D/ S9 z& }, d

" Q7 K+ B# K0 L4 T7 j6 D
+ C1 G- P0 l8 D& h8 x    xor     ax,ax
* ]& f9 i; q5 R1 @    mov     es,ax( r  W5 ~! z" f2 ?' M: _8 m/ x6 O
    mov     bx, cs1 ?1 t# r( U! |  z8 ?8 a
    lea     dx, int41handler6 a- E3 K3 c* Y% P  @
    xchg    dx, es:[41h*4]9 d! O! k( v% b7 `
    xchg    bx, es:[41h*4+2]0 H6 X4 T5 |" l  Z
    in      al, 40h; X, X! j! b4 h9 }! @
    xor     cx,cx4 l8 r' z! _0 `& Q
    int     41h
) G9 A" `  S0 E7 |2 K    xchg    dx, es:[41h*4]) N! _, u* h% B5 p3 |) ^; S
    xchg    bx, es:[41h*4+2]
* _( Y0 ]  h# x! n6 E' g: l    cmp     cl,al  M) I& e4 N2 j5 A, D
    jnz     SoftICE_detected
% s8 I$ V5 o* {' t3 e; R' c
& P# J! J4 L4 B( c( _- A$ p: |_________________________________________________________________________
; y6 N0 I9 z+ L, i9 X) M0 v3 z3 S$ I3 c% s3 }- x* ]# e
Method 07
( c, o9 O/ R; m6 ^$ U3 p=========
! y, M" L. |9 z
7 k& d' y3 R+ Z7 \9 b5 LMethod of detection of the WinICE handler in the int68h (V86)5 b- n" H1 l9 p# r) |

( j1 _% [: V! g' `    mov     ah,43h* _0 ?$ _" W6 D' b* E2 F7 `7 L, ^, ~
    int     68h* r# \& o7 w) c' D% n
    cmp     ax,0F386h' ~. L8 G% G7 D7 g1 D" z3 P: O
    jz      SoftICE_Detected
  {8 {* {, E: {, y' {: [  P6 ]
( x4 a6 Q0 S; ^$ |
0 f5 ^5 H5 D* u! N=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
  R% Q4 o) x8 W2 D4 e9 F   app like this:
# E. j  y& l: u+ n7 j/ \% k- @
- q6 W$ q( @+ X6 l8 k   BPX exec_int if ax==68% x4 @/ _' H1 ]9 o. Y$ C
   (function called is located at byte ptr [ebp+1Dh] and client eip is/ U: c3 E+ U) |5 O  Q0 `/ T4 y; Z
   located at [ebp+48h] for 32Bit apps)
+ f) B/ Y& k7 m/ z9 x* K__________________________________________________________________________
( ^# ]2 T- B- w+ x4 n1 P& m9 J1 d' J+ o9 M# O# ]
) _3 L- E1 j: k8 N8 _+ q4 `- F
Method 087 V1 b4 N; H" I  f, ^
=========
: y+ }% S1 t7 g* Z* F
% ~* h1 |0 J, U& SIt is not a method of detection of SoftICE but a possibility to crash the# I' l+ k- M0 ~- D* ?7 n1 I1 _7 G. X# }
system by intercepting int 01h and int 03h and redirecting them to another" ^0 B9 k4 u7 R$ ?8 `9 v% b: Y
routine.
* m, ^$ y* T0 gIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
* r. E1 q7 A# l. G0 s' H" oto the new routine to execute (hangs computer...)6 h( ]: K: s2 a" ]

8 \# `& C. v' A; ?    mov     ah, 25h1 I) J5 ^  \/ P* W* P# N
    mov     al, Int_Number (01h or 03h)
) J# Y3 m- e* g2 J    mov     dx, offset New_Int_Routine
* [/ d: h/ }. U! s+ c    int     21h
! A: h& B5 W0 }8 A) ^  F5 J" E
# K# R2 T7 [* X( n4 ^5 n- w2 I__________________________________________________________________________! O( _* }9 f3 d7 A2 r9 X$ X
% }+ S+ _! f7 r5 ]% V  V9 W9 S
Method 09" Q: t3 C9 O. S; e$ t
=========' Q# f1 J$ A/ |! a

3 D4 ^5 Q1 z9 `0 u8 [' MThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only/ d( P( X- B1 I, M+ Y
performed in ring0 (VxD or a ring3 app using the VxdCall).
1 L5 {7 r% W) v# x; ^The Get_DDB service is used to determine whether or not a VxD is installed
! n0 @$ @7 W+ D( w5 ?& b) C5 n9 vfor the specified device and returns a Device Description Block (in ecx) for
* p) R" e# u7 x+ N/ V2 R5 x1 cthat device if it is installed., d2 |( X# C3 M% `' K" z+ v
2 M; X! E! d- B! A& _3 }7 W/ S+ I
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID& `% S; U7 b. o9 O8 n, }
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
7 [/ n' ^* G9 I  Q4 R   VMMCall Get_DDB
* H% X6 `8 o- _. o& {   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
( V% m' R! n; G# ^. E6 ^
6 F6 {+ u2 t6 k: O4 A3 ZNote as well that you can easily detect this method with SoftICE:
$ P2 L7 M3 s. r   bpx Get_DDB if ax==0202 || ax==7a5fh
% e* \$ X8 g2 G% Y
- y. L" l# [5 A__________________________________________________________________________8 {) C/ n) a- X* z1 [3 C
% Q8 b5 @7 N! n% v
Method 108 t  N6 [4 q' P% b5 M" K  q
=========
; N  \& F9 n0 ?( r" q, D2 ^' v
. v2 L3 p# V* }8 q7 [=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with# g0 p9 u# S; L. }* B& w0 V8 p
  SoftICE while the option is enable!!& ^8 Q7 o' X5 y1 L, J. k  G+ S
6 S8 @/ j, A0 v: M
This trick is very efficient:2 Q6 ?# p+ a! d; ~3 U* {9 X" z
by checking the Debug Registers, you can detect if SoftICE is loaded
! l+ w4 J1 c7 u) d) A+ ](dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
/ t( x$ ]8 V, d. z5 K3 Jthere are some memory breakpoints set (dr0 to dr3) simply by reading their0 S; L% y# t- o9 b  p
value (in ring0 only). Values can be manipulated and or changed as well0 h; q! K2 h; Z+ U$ M4 H7 H2 o
(clearing BPMs for instance)6 r- h7 Y- \4 x6 |: P' x- }$ d

4 Y/ y7 V* O7 F__________________________________________________________________________
% u% T; u( @! j) y1 a
1 i2 {; T) Z. E5 |: `. IMethod 117 L- ]: d, w- P7 O5 F! K
=========
7 J: V8 q- z3 y5 k
; l  f' X+ h3 m1 aThis method is most known as 'MeltICE' because it has been freely distributed
0 V3 i) G5 k. Gvia www.winfiles.com. However it was first used by NuMega people to allow8 g4 Y. y3 O6 {6 n/ e  A
Symbol Loader to check if SoftICE was active or not (the code is located
! H/ E- u$ r, y  a6 N8 h! Vinside nmtrans.dll).
8 y4 M0 u) j9 T! ^3 F) {9 ~
$ T0 e- f: A- @! `1 {" |The way it works is very simple:
/ ^- g/ b& j- g0 N2 PIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for3 J% _0 c* y' X) T( f
WinNT) with the CreateFileA API.. P8 D7 u( t% {
- A1 f! r. \  k6 H- @5 m0 R
Here is a sample (checking for 'SICE'):
7 ~/ Q* X+ k+ E7 `6 L1 m
, P' \% c8 D7 F; o) ]BOOL IsSoftIce95Loaded()
) [: S5 c2 a: w4 B; s& ^{
: x1 d* S. S' s; |   HANDLE hFile;  ; n( d0 X; K% c
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,, ~' L* _( _' D, U4 m+ d
                      FILE_SHARE_READ | FILE_SHARE_WRITE,
; T+ \" N. }) P" a- K! J8 H                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
3 ^& G* Z  I$ w$ ~9 x   if( hFile != INVALID_HANDLE_VALUE )
5 O' i! I9 @, V" O" X   {+ H  V  L  c& P
      CloseHandle(hFile);
1 x( }( ^& k; c/ m      return TRUE;  q& `0 {2 _6 I: q8 s/ a
   }
% D3 e% ]: |6 `2 ]6 }- g1 G3 D# j6 G   return FALSE;
3 Q1 i& X% Y: X- s1 i  h}
0 u2 Y3 q9 C* a9 ]
: ~: D. H! w. I, h: h8 t) xAlthough this trick calls the CreateFileA function, don't even expect to be
% p- ~' D4 r. Mable to intercept it by installing a IFS hook: it will not work, no way!# u7 M1 ]% I$ c
In fact, after the call to CreateFileA it will get through VWIN32 0x001F: [' K7 O5 a) {* j# p
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)% C1 l) e' U1 Z7 H2 t! ]
and then browse the DDB list until it find the VxD and its DDB_Control_Proc
/ F6 O/ g5 U, v0 W2 wfield.- c+ r( \. q& D  n8 v  Z) `
In fact, its purpose is not to load/unload VxDs but only to send a & a+ E6 `1 Q/ {2 Z
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)% E7 a( d! z4 M& ~8 z# [! ]) @
to the VxD Control_Dispatch proc (how the hell a shareware soft could try+ T" `+ o. |# g; R2 V9 e
to load/unload a non-dynamically loadable driver such as SoftICE ;-)." J% K8 v/ L& H
If the VxD is loaded, it will always clear eax and the Carry flag to allow
3 n+ {1 r8 g. Mits handle to be opened and then, will be detected.+ \7 [4 {* n2 J, M: a, O
You can check that simply by hooking Winice.exe control proc entry point
7 }7 a% v( ?8 Q" Z, `while running MeltICE.
: U. }: d) E* |& ^- ]1 R! l  d/ R* N

# k% `# n: w2 ~$ Y+ K  00401067:  push      00402025    ; \\.\SICE
4 J0 O) H" i- p8 q) e2 n, a; c  0040106C:  call      CreateFileA9 S+ Y* w3 j" x$ H$ ]! i) z# T
  00401071:  cmp       eax,-001) B7 J% a9 I* j
  00401074:  je        004010918 M8 S7 c. Q# j' O

7 g/ ]9 ]3 L1 w+ u6 O' n  m( e$ J& _
There could be hundreds of BPX you could use to detect this trick.! b$ h3 a7 ^8 M$ O3 q
-The most classical one is:
1 y, B/ m% i$ K+ V  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||" Z, \" Y- j" k! W
    *(esp-&gt;4+4)=='NTIC'; u% F% L5 n/ ^# K( u0 I
5 O. t$ K% I6 J
-The most exotic ones (could be very slooooow :-(6 _! W* v" I, R; a8 h! x: X
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  5 @. {( `3 Y; _' L& x7 a
     ;will break 3 times :-(4 x% ]/ O/ ?* N2 `. n

2 ]4 `4 b2 e3 v! p-or (a bit) faster:
/ |2 ?9 C% Q6 q! s! _, ~   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')! N- C7 W2 z8 F& [

1 f' q) u! [" w& w   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  + Z/ C. v3 w  F0 T5 v( L- z
     ;will break 3 times :-(3 ?# ^1 p  m  ]+ F4 N# T

* d* L& r4 g4 S0 v, l% e-Much faster:. |% V" ?: F# n! k, F" m* [, l
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
8 u5 w* [8 ]% K4 S9 u
1 j" t( }4 v. }4 G& s) n. JNote also that some programs (like AZPR3.00) use de old 16-bit _lopen
: _9 T0 `. i0 Q) f4 ?  U8 Qfunction to do the same job:4 {$ y. ?# N. ?6 u4 V5 j/ p

6 P! w. w! z* a6 P7 l   push    00                        ; OF_READ
& y- e* k8 d2 [- ]! V   mov     eax,[00656634]            ; '\\.\SICE',06 p6 L+ X  v! D0 `% q
   push    eax5 R6 K# \; ^* ^# b
   call    KERNEL32!_lopen" C( i! {% m8 S9 X
   inc     eax
/ r' W% E  \9 `; A5 F5 N   jnz     00650589                  ; detected
4 [: C1 R7 Q3 M: h/ X   push    00                        ; OF_READ
6 z" K# H( @- `: q( Y; e   mov     eax,[00656638]            ; '\\.\SICE'. Y" k3 M0 z: G) E. H* d
   push    eax  q3 O- L7 s! y3 ]+ P. w
   call    KERNEL32!_lopen
1 b3 ]/ S& L' S! o% p0 z( v' h   inc     eax0 A0 p9 K: G9 Q/ C/ k
   jz      006505ae                  ; not detected& U0 J7 H( O- C' r7 a

* r4 C7 ]/ w0 ], G2 \2 j" [; Y9 u/ V, g
__________________________________________________________________________
- l% ?" D- h  ^  C3 P: S2 u' r
; }' @. M5 n' o+ y! T0 fMethod 12
5 g' t$ W, u$ {- e! J$ q+ m' O=========
. v" `/ Y& [" z# G+ h) m9 c% ]$ t
# q, ]: z6 [; O2 ]This trick is similar to int41h/4fh Debugger installation check (code 05
- I# \) b# C, H! g: V&amp; 06) but very limited because it's only available for Win95/98 (not NT)
8 I) _" t' d5 i) O% qas it uses the VxDCall backdoor. This detection was found in Bleem Demo.
& y% `) P' M3 V0 P/ Z$ k
. {6 |+ F" n9 O& Y0 @# ^" i/ B: r   push  0000004fh         ; function 4fh( Z( M0 h& \; ?- S6 q: i$ g
   push  002a002ah         ; high word specifies which VxD (VWIN32)
: i, u  b: A  R; M                           ; low word specifies which service$ }. l& n* L) h8 v: B
                             (VWIN32_Int41Dispatch)$ D+ Q& D7 s, N( R- e+ d' ?
   call  Kernel32!ORD_001  ; VxdCall& k% W! J- g: d7 J9 ]* V, b: b% o
   cmp   ax, 0f386h        ; magic number returned by system debuggers
1 V0 e$ r% B- X" T! }   jz    SoftICE_detected- G- J0 ^* v! ~/ t0 G
$ L2 _- L6 j; n- w" M1 D
Here again, several ways to detect it:
5 N, E+ @+ [6 K  u: y4 l+ M* q( Y! F+ B9 \0 }
    BPINT 41 if ax==4f+ F, `0 r6 A+ R" k% M
& j. n; [9 O% z' m; X
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
! n( G" A8 B, |5 \1 u
( P! Y/ q+ Z( M9 U" a* g! n9 ~; _    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A' ]- d) U, q6 g0 ~8 U1 s8 ?
6 _# A* ?& g* W# h
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!  S' A& y1 P3 j, o

' }: h  E% W+ V2 i+ L1 O* |6 S, ?__________________________________________________________________________
9 |: Y/ j& \8 y+ G, j. [! ]' v4 d) P2 {0 [8 F& D( o
Method 13
0 }: E7 j& v9 e+ q! F( i+ u=========. X: @9 N2 O1 Q

" `4 D# X, }$ k8 jNot a real method of detection, but a good way to know if SoftICE is
, ?+ \7 n1 G- x+ S& Pinstalled on a computer and to locate its installation directory.& |( O9 i5 w" s. G" B3 W
It is used by few softs which access the following registry keys (usually #2) :! H; N7 Z9 f- Y- P
* J8 _2 G4 [% S, A
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion4 Z! R% a: s4 V# t
\Uninstall\SoftICE) ^. k) x( L+ F4 j- b
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE+ S1 S, \. T; f* M* J& h
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion/ x- U: r0 r1 b% l
\App Paths\Loader32.Exe
" g" \9 f5 G1 x8 O
* a# Z6 d0 l! y" G6 O, K( s
5 l1 i% T2 o: k1 s1 Z% ENote that some nasty apps could then erase all files from SoftICE directory
6 N1 i5 Y) ?1 ^(I faced that once :-(4 u& L: G& g2 U! G
8 `; G" r5 z0 L7 z& M: }
Useful breakpoint to detect it:7 y2 s: Z0 f7 j0 U/ z, J" h4 f! B

. @1 G- {6 l6 o     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
, k: l+ K* @% a) {7 \) v
0 c6 q' o6 g+ p# g__________________________________________________________________________/ x0 d9 i( N7 |$ A# f1 r5 o
0 |6 m' a, q( b+ I. C, M

% y+ G: O7 Z# m5 K! pMethod 14
) K* r  N% G. h' M/ y  [=========( W+ U# N* a' P4 o8 N1 Y0 ^

1 s" U: D0 z+ K/ M4 JA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose3 N6 h- d0 Y* I% q5 I6 w4 Q
is to determines whether a debugger is running on your system (ring0 only).
& Y: A5 N( t6 p5 R4 t
0 h& ^/ [9 E1 n$ Y+ h   VMMCall Test_Debug_Installed! x& [- L- |7 N" @! H$ H) p5 c$ k
   je      not_installed5 o& a7 G( {" W% X$ ^' i( {
6 D, o1 }& a* T/ Y
This service just checks a flag.* `  ]( s0 i2 Q+ G& _- c: K  }+ B; @2 E" O
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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