About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>8 J8 }' g$ l1 g5 d; S1 q
<TBODY>
( `1 d, e0 j! d% X% N6 L* i<TR>% r3 a) d3 t/ s( l4 i
<TD><PRE>Method 01
1 D. A  a$ D% l5 U6 S=========
0 ~6 c  H, N: [. M* Q9 \7 h/ @+ z( n: G- \1 E' `
This method of detection of SoftICE (as well as the following one) is/ ^* p! t4 P8 y5 c
used by the majority of packers/encryptors found on Internet.
! B+ d9 E: J6 ~% Y7 \+ K0 qIt seeks the signature of BoundsChecker in SoftICE
) ]7 z4 _* Q/ |, S9 D+ o/ U
2 u" `& S/ p+ V& d5 P& M' Y9 O8 ?    mov     ebp, 04243484Bh        ; 'BCHK'
" J+ x7 v4 M6 x; A7 d& {/ B    mov     ax, 04h
) o' b" q7 t+ S    int     3       9 B* |; E( }: y8 |
    cmp     al,4
" [; S3 p0 g. Z+ G% m( F  U# V    jnz     SoftICE_Detected8 X. d' y7 i# E6 {& M5 E2 b

% a% T  d* m# @1 D- t___________________________________________________________________________9 s* h, L, c( I) x! U# C8 x

; N* `& z" \0 c+ ?Method 02* g) {2 m! x! V+ t- V( L$ A
=========
( L: ?. q7 p/ ~1 m' c: y# J3 X" [$ N
Still a method very much used (perhaps the most frequent one).  It is used* ?, Q% I% ]2 @' l. n) n
to get SoftICE 'Back Door commands' which gives infos on Breakpoints," Q; Y3 `2 R4 N) `. v  o8 |
or execute SoftICE commands...
( K. K, g. s8 k+ C: A8 FIt is also used to crash SoftICE and to force it to execute any commands1 H& d/ E3 c  x$ s- l! w" O
(HBOOT...) :-((    L- @1 [8 E" R8 {1 U

9 U0 O$ w8 a3 G9 A! hHere is a quick description:
3 S0 ?4 _, q  _7 L6 i, i-AX = 0910h   (Display string in SIce windows)
& |5 ]* o/ r# L1 d$ o  ?- W: {8 {-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)6 m8 c( `" E1 t' |/ h- h
-AX = 0912h   (Get breakpoint infos)
- m+ W2 I# w2 d6 ~-AX = 0913h   (Set Sice breakpoints)
% y+ V" [) C; ]- a" [! ^  p-AX = 0914h   (Remove SIce breakoints)
8 p1 c; u& A9 M' u4 T' t3 Z; K; F. l4 I
' x9 B( [9 j: _Each time you'll meet this trick, you'll see:" U3 R. F$ E  ], v% f( j
-SI = 4647h
5 C. A5 I% e; I3 U2 {-DI = 4A4Dh
! R  I( E# H7 R! o8 i( |Which are the 'magic values' used by SoftIce.
8 j% S+ I0 {, D& EFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.& A" ^# x" k0 S# e! V( ?7 A

7 X2 Q0 s1 o- C+ i9 _Here is one example from the file "Haspinst.exe" which is the dongle HASP
) t- r  P& }8 UEnvelope utility use to protect DOS applications:
  Q$ w+ T( k! X3 Z5 \4 w1 z6 q0 D# t8 l3 u- Z
& T7 I8 E, N9 u0 Q
4C19:0095   MOV    AX,0911  ; execute command.
- t! ~. }/ d# w. f% N8 M4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).- T) k0 h( ~' G' R( D6 v
4C19:009A   MOV    SI,4647  ; 1st magic value.
) B: I+ u" V* d' G) l' f9 G' ^4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
5 d6 e, @/ f* {6 j. M0 L4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)# J' D' C) q: }; q6 z
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute* U6 `; _  {: _+ f0 c
4C19:00A4   INC    CX
$ f; g$ D7 k2 g5 E4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute* s, I! u% E% I0 i5 H
4C19:00A8   JB     0095     ; 6 different commands.: r6 X. `3 c+ k- `4 R6 m
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
- _( E) n" t1 A2 Y# Q4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)5 z3 |* T7 x: B4 O! @; ?, N
  i0 _. v& ]+ g7 ^
The program will execute 6 different SIce commands located at ds:dx, which
! ~8 b. q! j0 \( [6 N7 aare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.9 E. y& x1 v8 X/ O) R6 n0 i$ _

$ H% Y4 Y7 L2 K" D1 e* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.+ M( [3 \( x9 o, u
___________________________________________________________________________7 `6 T# n7 r8 K# M* T. L

* f# F" S# |. Z  L7 r7 J7 W3 W' D8 e3 V- j
Method 03
" w) s3 K( C) U1 E# I=========# m  h2 I8 P# Z/ S
8 P, L- U3 }: \1 n
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
6 O/ M1 [+ \$ Q1 k1 j8 U  W- i! B(API Get entry point)
, e8 u5 I% h  {        
) D; F4 H, \$ Z1 [- k0 `! i0 W% j7 N! c' u: Y8 k8 Y8 T
    xor     di,di
: q: b) D: o, D5 J1 X5 @  H    mov     es,di  T" g& ]! W- B* ~* R5 c
    mov     ax, 1684h      
6 L' z- [: h; u& C" Z( Q    mov     bx, 0202h       ; VxD ID of winice
1 z: \& c5 [& p% {# h$ M2 K    int     2Fh
1 F  M6 t# y1 J' G# a    mov     ax, es          ; ES:DI -&gt; VxD API entry point
/ t6 W; o) k; t    add     ax, di4 G+ D( j, q4 `7 Y7 x$ j% G0 s
    test    ax,ax
' D; s1 T4 z  i1 [5 G# E    jnz     SoftICE_Detected
2 }8 F8 V- _  b) h6 p( H& W: e1 a' P9 M) o1 j% ?# ^
___________________________________________________________________________
5 b! h1 T# R" z% V; K2 |4 {
9 P9 U: O" Y' _1 Z0 {" @Method 04: O* v& J) L9 K4 @# H1 F9 m2 m
=========* S8 i4 A; U- ~& v8 t$ ]

; ]; H/ E) c& j9 O8 eMethod identical to the preceding one except that it seeks the ID of SoftICE; L9 k( Q( n3 D# }3 c
GFX VxD.
$ z: m( b, t- n1 |6 }/ [5 b* j' u) E
    xor     di,di
# i/ O9 M0 v0 k: P+ M    mov     es,di
+ {8 B- [* J! d    mov     ax, 1684h       2 j$ {+ A- \5 {9 V# g
    mov     bx, 7a5Fh       ; VxD ID of SIWVID
/ b5 R0 J/ b$ m3 ~    int     2fh
5 P: l& S; \  E  {    mov     ax, es          ; ES:DI -&gt; VxD API entry point# f6 h' I- ]% T
    add     ax, di
" h7 E! d6 C0 s. L2 a) F0 d6 l" m    test    ax,ax, Z& ]$ a! u' J, e  M% Q
    jnz     SoftICE_Detected6 |# `# J* @, T
9 L9 G; q' X8 n2 f  ]$ ~7 u& v
__________________________________________________________________________
4 j- s! \% s4 u' o2 [! N9 P: n; m; N: _+ @! [
. x' x  {5 D4 b% t) ]" `
Method 05
" P; ]9 E. k1 z3 n, R=========
1 \$ o* Z3 Z: {0 Q3 |0 U0 v
6 }* n, i5 _1 qMethod seeking the 'magic number' 0F386h returned (in ax) by all system
5 n. b/ |3 ]% O( z, i' Pdebugger. It calls the int 41h, function 4Fh.! S: z9 e. u. p, G
There are several alternatives.  
+ b* A4 J: [3 b" Q/ O3 Q
$ Z6 t$ X# e$ _, GThe following one is the simplest:2 C( P- V" j* N: j+ k5 L
; U- C* t+ \. N( T# g8 h$ G
    mov     ax,4fh
5 d0 l9 r! N7 F    int     41h" h7 g! u% ~$ `& n! L6 F2 O
    cmp     ax, 0F386
% v- S5 W+ R' m! a+ y7 i    jz      SoftICE_detected
% n2 n( j! c) v" M4 [9 @, p& l, O; b$ J# \
% j9 B2 p! n: S- N+ `4 I/ R8 `$ Y
Next method as well as the following one are 2 examples from Stone's
. P. I0 h3 B! ~  K# `9 j& x"stn-wid.zip" (www.cracking.net):
2 v! ]7 g0 e4 O0 l; i( _( m; {9 {. X  T$ C* i) h: B
    mov     bx, cs4 Q" q! p# B9 l6 W3 c
    lea     dx, int41handler2
' |8 q  @( s( g( k5 ~4 y# ~    xchg    dx, es:[41h*4]
  i# u6 x3 U3 A- ^; V    xchg    bx, es:[41h*4+2]& F  E) h# P3 r  X8 o8 R0 S
    mov     ax,4fh" Q7 v; ?, w" H7 c
    int     41h
, d3 Q# B0 @. k. |7 W! H    xchg    dx, es:[41h*4]
5 \4 u% c6 a& c- A( @    xchg    bx, es:[41h*4+2]
9 x$ T* ?9 x4 _    cmp     ax, 0f386h
8 p. S1 w5 O( \( L# V7 z* f    jz      SoftICE_detected
4 p  q/ k- K4 i2 R8 _: W$ u7 w$ M( c" H: J2 G2 O2 A5 n0 R
int41handler2 PROC) e1 i2 c* P0 Y4 A  }  c
    iret
# }6 I- F$ U3 ?4 I3 M! ^  U' e/ M! ~7 bint41handler2 ENDP# n  \+ d+ l3 b. U1 V
, H& i+ m. Y% E) Q5 Z2 [" j

2 ]$ t+ y" N( Y6 E_________________________________________________________________________0 f4 G4 Z& x& Z$ F4 _8 k0 u
+ g5 D" t: s+ l- Z; q$ `# ?5 }
* L* C, O( ]- M' D
Method 06
- ~9 I5 \& i: @9 B/ Y=========( y; [( C1 R( \0 m4 Q5 J
. Z& D( t$ }7 f) T7 E, q; b

! b9 f3 `3 K4 F- {2 \2nd method similar to the preceding one but more difficult to detect:$ i2 _( @- L9 y

8 ]( ]1 Y1 g7 v* h* q* m3 e
* E' E3 M, Z8 j# M) i! Q, lint41handler PROC6 j+ L2 p3 q$ v  Y3 [
    mov     cl,al
- n# b  r1 W. P* z! I1 V    iret
1 N& {3 I3 v- {5 L5 R' ~int41handler ENDP
) q! U7 ?2 p5 ]4 @5 J, f. l$ N0 n& d5 U* O* N9 N

( k7 `# {% ]# Z7 X5 ]" h    xor     ax,ax7 N. @2 l) o2 I, E$ N
    mov     es,ax& o1 c1 T0 i2 {( T: ~
    mov     bx, cs
4 f5 G. z8 U7 K    lea     dx, int41handler
$ I. u' A$ ]& B! ]" e    xchg    dx, es:[41h*4]
4 g$ y8 s1 N, d$ _( \0 _    xchg    bx, es:[41h*4+2]
" [/ d: f' v% p+ ~9 \    in      al, 40h7 M# S% T+ [: f9 t  V
    xor     cx,cx
1 r- O" \  }9 ^5 G& W0 _    int     41h6 f1 O4 ]) i2 S6 d8 H/ w" D- u
    xchg    dx, es:[41h*4]
6 |+ E8 X3 i( \2 u) s    xchg    bx, es:[41h*4+2]
5 }" K9 L4 S" G( w( b: c    cmp     cl,al" }: t2 H; h, o: ^, N2 z
    jnz     SoftICE_detected( f: \7 y% G! Y, Z8 _" g

& x2 w# t9 J7 v+ U  J_________________________________________________________________________  l+ U, \/ ?. C% ?0 r$ Y$ ^

- R1 g% k1 G2 oMethod 07
5 V1 \+ v! k: B2 G6 X=========, l; q' v6 r2 j( o2 H: D2 t

, x) Z" l5 L3 I! ]Method of detection of the WinICE handler in the int68h (V86)/ h# w0 u- r& V$ A, u/ @8 }8 x3 O

* x' C  r: R& o; d- @    mov     ah,43h
1 w. @. q: P+ D5 B% B& v8 o    int     68h3 ]7 h  [" p" t, `4 Y0 l( O. b
    cmp     ax,0F386h% m6 d5 S) q2 X' G: m1 T
    jz      SoftICE_Detected! W$ y1 A9 V$ w% i' `

. X5 R4 y& p" a4 \9 _( F9 _1 ~
* g) u7 X2 A" s% A8 D( S=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit9 ^/ ]! ~  B2 C% m
   app like this:
* v% k# {; l0 F9 Q& G, Z
- w3 ^9 Z, M% m* A  W- [* b3 L, v   BPX exec_int if ax==68
- D$ c4 a0 N  R' w. e( W8 t   (function called is located at byte ptr [ebp+1Dh] and client eip is
! y3 g5 Y, ?# I% F) Y. R- u. C' P* u   located at [ebp+48h] for 32Bit apps)8 i+ n, m3 C* d! b9 R& N
__________________________________________________________________________
) g9 Y# Q1 s2 I, M% B  M( Q+ {. x
# y; P. m! i$ E2 h2 [, l
Method 08
/ }1 n, f- m  q+ y, _" q  a6 E6 s=========( E* f# U9 S: \4 D' u
0 ^5 C0 E( Q7 i9 z. d
It is not a method of detection of SoftICE but a possibility to crash the& b! @6 _& s* _' \
system by intercepting int 01h and int 03h and redirecting them to another' `6 E2 K8 G% w( D* w7 u7 z2 z
routine.% M9 Q$ C4 x6 _( W% o3 b
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
* t8 l, u7 w5 h5 m* ato the new routine to execute (hangs computer...)
2 x# Y. T* a8 Z  X- I
5 V$ Y6 V2 V; W    mov     ah, 25h
$ ], n! k  a+ n1 b; d    mov     al, Int_Number (01h or 03h)
6 M+ ?7 ^0 }1 t4 ^3 v( w    mov     dx, offset New_Int_Routine, \- G8 q/ R+ M9 B8 Z
    int     21h
5 J( Z  F( S7 V9 t  p  I
! M; o7 M) q. ^4 P% r__________________________________________________________________________
7 o  r2 v* E5 v7 ]8 K& E( z! ?% _+ w; Y8 r9 \
Method 09
9 t5 B7 s2 w8 y: f=========
/ K2 T2 b8 |' U; _: x$ h( w/ e* D* h, @1 |' B! Q" _* z6 w* @6 {
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only4 T6 Z9 g5 x; [3 M! |- g
performed in ring0 (VxD or a ring3 app using the VxdCall).
8 o" k4 k9 o* F. c* b" u7 K; jThe Get_DDB service is used to determine whether or not a VxD is installed
8 `$ b8 L2 x% u  ?" A7 M/ s7 @: c+ Y; Dfor the specified device and returns a Device Description Block (in ecx) for
' I' ?9 Y( O3 p$ L0 x1 R8 dthat device if it is installed.: D) G7 {/ F; B
0 Q) b( ~1 c9 F$ s: y3 D
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
7 V: I5 ]  |) s9 ]7 i   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
' b7 s+ n/ ]* O2 y% n8 L   VMMCall Get_DDB
8 P5 t+ O, j( `4 S9 z   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
. f) a$ `! q" S) I% P, n, ~7 ?) l3 Y6 o7 {: g9 U8 W& w
Note as well that you can easily detect this method with SoftICE:
9 k1 q2 C6 ^: b7 L3 A   bpx Get_DDB if ax==0202 || ax==7a5fh
2 ~# t$ Q: Z  T; Q( i9 q/ S
+ j6 Z2 i# q  E; M; @! k1 C__________________________________________________________________________/ G8 d4 J' \7 D

0 M7 u% r( t6 C# j% v$ D0 @* I% eMethod 10
4 N# g3 |5 n3 x5 L& z=========
/ H; @. [) ]# T1 F/ V* o8 i) O( [$ H+ ~# R$ o$ o
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
1 P/ d" N4 g( J, d2 B4 ~  SoftICE while the option is enable!!
$ o# W; T  s. s, _1 n2 P) C7 n/ d6 N# d
This trick is very efficient:
* n, s, E- m( I. M+ q0 D) s/ vby checking the Debug Registers, you can detect if SoftICE is loaded( L: e. ?, V* s. @: y5 c% W  M
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if2 q. `+ g  d6 B+ v' `/ g
there are some memory breakpoints set (dr0 to dr3) simply by reading their
( j  _# C! F8 T/ O& ]value (in ring0 only). Values can be manipulated and or changed as well
8 ~8 [, {# L/ G( o" X0 k2 v- C* ]+ F, f(clearing BPMs for instance)
* D( d9 W. U) [4 B6 |
7 F& F: }" d2 i" R5 ^9 \( M__________________________________________________________________________
2 X  ^$ @4 v. E6 d( E/ k! I) `. |" _! q4 @+ |1 w
Method 11: A7 s7 v' z& i8 T5 P7 S
=========$ `2 J+ r7 |* _( ?; _

7 d- B4 Y. A4 a" L' ]This method is most known as 'MeltICE' because it has been freely distributed
" I2 g/ _: n- n0 Q: `& Y* Avia www.winfiles.com. However it was first used by NuMega people to allow, I3 Z( i5 s; D
Symbol Loader to check if SoftICE was active or not (the code is located% T) s% D+ R! j' `& H5 y: S
inside nmtrans.dll).2 A# p+ r& M4 A( V* M' V& a

5 t. ~: c) J: L# K9 G, o3 ]9 Z7 ]The way it works is very simple:
' s0 T" t( _4 k( W9 `It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
! H$ h% r" d5 ]WinNT) with the CreateFileA API.
8 v, l; g' F1 r2 J" C3 J
  }) T  t' Z9 y. F& p  CHere is a sample (checking for 'SICE'):
" X; k! }8 G5 k$ K6 p* Z: ]7 X4 y( w2 V
BOOL IsSoftIce95Loaded()) {4 Z) ?/ c: ~; V
{2 Y9 M- G% _' U
   HANDLE hFile;  0 L6 p  y2 s+ D! ^
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
- N& a6 P# _3 J) M                      FILE_SHARE_READ | FILE_SHARE_WRITE,, s! X7 s7 f9 x$ W  B; m$ y, j
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
3 X7 H! H8 O5 b1 B  ]$ S   if( hFile != INVALID_HANDLE_VALUE )
4 D' w. I% f  S" X; b   {, D" W: ~7 J) v% B" ]  o6 P
      CloseHandle(hFile);. a6 g( P5 |0 O% d/ s
      return TRUE;
( P9 r( u$ K3 n# r+ Z% I   }, [7 ^5 r1 g$ X4 U* u1 l  F
   return FALSE;
( M; }7 W" R& c4 V* A! @) Z3 S}2 M9 s. ]$ M0 Q4 g3 Z

7 I( g1 x3 S6 B4 L1 }  g: B5 ^4 yAlthough this trick calls the CreateFileA function, don't even expect to be
' a, S6 h9 w, q% i6 b7 l9 e2 Wable to intercept it by installing a IFS hook: it will not work, no way!9 F! P- u  P% D0 H! a
In fact, after the call to CreateFileA it will get through VWIN32 0x001F. R/ @! y# J3 @& h8 E
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)) h" u7 Q2 U7 L7 h6 }5 a; Z5 [
and then browse the DDB list until it find the VxD and its DDB_Control_Proc6 x. j; U6 t  d
field.
* _# K, U# O5 @# C& HIn fact, its purpose is not to load/unload VxDs but only to send a 6 @: z7 D/ |1 ^% c
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)  t* e8 l' Z( N7 d7 o3 x$ e
to the VxD Control_Dispatch proc (how the hell a shareware soft could try" ^8 \& Q! c/ l, {( X4 G* p( E
to load/unload a non-dynamically loadable driver such as SoftICE ;-).- `$ h" l( J' K% ~( s
If the VxD is loaded, it will always clear eax and the Carry flag to allow
0 b' k& H' h. l; b9 N7 i% B) \8 rits handle to be opened and then, will be detected.
, Q8 X9 T9 |- D; XYou can check that simply by hooking Winice.exe control proc entry point( ~3 S- e! J$ n* ?
while running MeltICE.# o) [* h5 \3 j1 R

/ t- G: O! q' w9 E
9 h2 t1 s6 o# @8 q  00401067:  push      00402025    ; \\.\SICE; u/ ?2 L; @4 m
  0040106C:  call      CreateFileA
* o1 t  B; w8 s; [, ^3 U  00401071:  cmp       eax,-001
* a- P' s$ K) d4 k/ Z; W  00401074:  je        00401091" m$ Z. m$ L! E6 z/ D. {
; _6 ~& m8 R+ N  ]# o- l2 |

" }0 h, P) V! n* @There could be hundreds of BPX you could use to detect this trick.
, f! S- C' s+ j# E-The most classical one is:
2 Q2 [- J& Z, W0 ]  J" K  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||: N6 s% N% Q. o+ v
    *(esp-&gt;4+4)=='NTIC'  E5 J9 g8 M) y4 ?* I8 W  S. x% l

) ^% ^9 [& P* W2 \8 |2 d0 c0 x-The most exotic ones (could be very slooooow :-(
: [8 N" G5 Y% |2 L. S   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
  p/ m, P5 c* J. F  F1 A' ^' v     ;will break 3 times :-(
( Y. u- R# c! I) `* U
4 T& y# @/ L5 ^-or (a bit) faster:
( P- x$ g7 C- D( e) M" P. t   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
) \/ i! K$ }- e  K; h' G9 t
4 L6 s/ J' u" r' D: S9 r% t   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  / {0 W2 O" O' v7 T: D) `& A; f( r" N
     ;will break 3 times :-(
) L% R/ ?1 k7 P+ g" k
7 j. `6 u$ `& P& p1 F# D8 j-Much faster:
9 a/ ~4 C% d: V2 n% S   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
' a; S2 j* {4 n7 y7 l& ?+ R( a" x5 u, q) k- ]: {
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen8 C' G* p, n2 b9 n* J" y9 H$ F% G
function to do the same job:8 P& M- I( W; I: h( W

' R( J$ @9 O% U* Q/ I4 m* i! Q   push    00                        ; OF_READ$ {8 c: a0 j0 y' I
   mov     eax,[00656634]            ; '\\.\SICE',0) `. R. b' B. X  s: M. v1 I( J
   push    eax
0 B. f6 g+ v" F" |1 d- p   call    KERNEL32!_lopen7 ^# i! d: I, @; {! F; w- w
   inc     eax5 B. Y- v, H! T$ W: q& @" |
   jnz     00650589                  ; detected% p6 P' c0 t$ Z  Q
   push    00                        ; OF_READ
# T+ g- ^* p+ i& i# T+ K) P   mov     eax,[00656638]            ; '\\.\SICE'
, o( x. T+ h8 q* C   push    eax6 C# X; O9 s* [
   call    KERNEL32!_lopen4 }! N+ ^8 r+ j
   inc     eax
" p7 ^" r" ?4 i7 w   jz      006505ae                  ; not detected! i! r+ H/ y/ ~- O9 i

: r/ ~4 q5 C5 Q- z/ ~+ S( C& i1 v8 r, X& x$ ^. l9 g# `
__________________________________________________________________________
( `; w4 i: |; l& ]4 }$ z* o; v! j2 s* g; \& ~
Method 12, r$ j2 d0 M; `8 g
=========
* H5 {" a. F' R' K3 |) u& X, V4 j" ?2 [+ U' N7 h# p0 }
This trick is similar to int41h/4fh Debugger installation check (code 05
5 V/ L% s1 t6 K6 f&amp; 06) but very limited because it's only available for Win95/98 (not NT)
- s* k1 c% L- z) v: K$ }, _as it uses the VxDCall backdoor. This detection was found in Bleem Demo.% M; G6 v$ o% s: O' y: n2 q: i! C
: v7 S( o5 Z. d$ \7 E
   push  0000004fh         ; function 4fh
0 P3 d1 F% d: b+ L- Q9 C4 I   push  002a002ah         ; high word specifies which VxD (VWIN32)' o$ U1 E/ M; I: }
                           ; low word specifies which service
4 v. `' r% m& \+ c1 p& {/ S                             (VWIN32_Int41Dispatch)
5 G; I6 P8 B$ A! p   call  Kernel32!ORD_001  ; VxdCall! y+ k- H& h8 V/ g" j& z
   cmp   ax, 0f386h        ; magic number returned by system debuggers  E9 `9 p1 s& J+ ~% o* f" X1 |/ G! W2 ^
   jz    SoftICE_detected
+ w% A1 p9 u5 j) Z0 x  `& a
$ }3 c' c4 @" A+ E$ ~: LHere again, several ways to detect it:0 O6 k/ E  @6 B6 v& I5 b2 y
( y4 M& l4 m) w' F& |% q( T
    BPINT 41 if ax==4f
5 j; T6 |) G/ [% n3 T1 ^) z0 L1 x# D9 Q
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one6 F/ |4 \9 c' \) B
/ D2 U* Q  p5 P; w7 ~. H3 }3 ~; S. {
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
! t) s* s; i, c! u+ s7 Z
9 a5 q7 v! G+ P  q7 P$ w5 [    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
9 C" @5 r' B2 J$ S2 ]4 v% X- T
8 G( ^: ?- ~4 v* n/ h) `' Z__________________________________________________________________________
1 b' Y* s/ s7 ]+ L0 `4 F0 F; r$ q" B* i
Method 131 a2 y4 Z$ c) I, l- c8 Z% E0 o  ~$ ?3 J
=========9 x: |8 R3 j+ N% M+ }8 Z
. d/ h, V  u2 b; j" j, B
Not a real method of detection, but a good way to know if SoftICE is
2 n( ]: y5 S+ N0 U( @/ v; Rinstalled on a computer and to locate its installation directory.
1 @8 g- {  ~, o/ _0 L' P3 eIt is used by few softs which access the following registry keys (usually #2) :
8 k( ~: z5 k- H+ [! `
$ y6 F( g+ X; R/ @" J& _5 j7 B. C-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion* m* S* f7 s2 r* u$ j
\Uninstall\SoftICE2 @6 T; U1 O" B+ o% f/ R
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
, }* i) b2 c- N- `6 T1 z, o/ q9 b$ P-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion: a: @/ j$ z$ s% f
\App Paths\Loader32.Exe
/ O6 e3 v- N  [+ o, V2 A6 X# K% o7 i
- ~( r# s7 q1 n  [. ?, S0 S' r
Note that some nasty apps could then erase all files from SoftICE directory' x" }2 ~) q! h$ B- h3 ?4 G' \/ J
(I faced that once :-(
  Q3 T% O5 A4 `, B0 @6 J/ D9 _5 i6 O& q  @/ W5 l
Useful breakpoint to detect it:
1 F$ [2 r' l8 M" A0 P
- t* Q3 P0 u. a- i     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'* C) ]; \1 k" \% }6 D+ ~
9 Q5 [# A" P4 T# Y9 }- ]2 R
__________________________________________________________________________
, u) E, k; D+ _' l  E5 t0 g& F. c( A1 E
" r9 I' [0 B! K
Method 14 ( l4 O4 c0 Q* n0 }
=========
0 p$ r5 d) w  L$ @+ ^9 y& ^9 |, o
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose4 s: ]# N3 {  {. S2 E% _4 r$ [8 L
is to determines whether a debugger is running on your system (ring0 only).: l+ L$ l2 \; Y& E

1 S! B+ X% y4 W: ^) s) G- s   VMMCall Test_Debug_Installed5 P& n1 @( V* U
   je      not_installed3 g7 ~/ n; e+ v" L/ U% @$ N; n9 L

( C; k6 c$ c. z$ e9 Q( KThis service just checks a flag.
1 |# w8 @" N' r2 p% w# G</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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