About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
0 ^2 e+ K, r% y) Q( U; U. N<TBODY>
+ ?; @" j! y+ K" u. E/ ~, m5 E<TR>$ F9 V" s4 V* b
<TD><PRE>Method 01
6 B; p) n7 d. A* c+ y=========0 x7 P3 V, u. h( ~

5 A: }+ f& P" R% jThis method of detection of SoftICE (as well as the following one) is0 x( N! q: k1 D) \6 ~9 q
used by the majority of packers/encryptors found on Internet.4 \: e2 _9 O" B' ~9 O4 Z6 z6 J
It seeks the signature of BoundsChecker in SoftICE! i* w; Y1 s3 N8 u+ i7 W6 P7 [2 u
" t8 R. B' q5 _. n+ V& e! ^
    mov     ebp, 04243484Bh        ; 'BCHK'" z7 R0 C4 H; R4 g5 ?+ |
    mov     ax, 04h
. O2 i& ~. u4 k    int     3       0 c. M0 o1 S" m1 z4 g
    cmp     al,4# |6 b* k- [; }7 {
    jnz     SoftICE_Detected0 ]' L& f! L/ n( o4 I+ V( d

! n8 D  L8 ~& O! H# X+ D___________________________________________________________________________' Z6 t, \. J4 {$ ^# O$ M7 L
( ?6 K  j- D" a% g
Method 02
6 T5 H6 g% L9 }3 t. W=========
1 g  t) b8 U8 C7 q$ `2 u8 ]" M( H& [$ f( U
Still a method very much used (perhaps the most frequent one).  It is used
/ n4 m+ L' u$ O$ p, b6 z) X+ Rto get SoftICE 'Back Door commands' which gives infos on Breakpoints,
3 r5 s5 Y5 H( \( @$ B  oor execute SoftICE commands...
% z5 S2 t- M( oIt is also used to crash SoftICE and to force it to execute any commands) ?: n8 h. {% Z$ ]* i  X4 s) W
(HBOOT...) :-((  
3 B; Q7 O3 `% A( }6 u
9 f( @' T7 m! XHere is a quick description:
1 }& b+ i8 ~4 o8 C8 U9 Z- L) _0 i; A9 H-AX = 0910h   (Display string in SIce windows)& ]. X  b+ o" k7 ]# |8 e
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
! n0 Y$ R0 q0 K( }3 T-AX = 0912h   (Get breakpoint infos)
4 s* A, k2 p7 s" ?0 }" f* O4 O% [-AX = 0913h   (Set Sice breakpoints)# q; ]. V9 ~* n+ A" H- J* x, `# Y
-AX = 0914h   (Remove SIce breakoints)  o  K, u' e0 H# ?. ^; M

- K; v9 Q+ O" d4 t2 V/ ~* p1 ~# x' UEach time you'll meet this trick, you'll see:, g$ P2 F( f2 q) `+ v5 u  H4 L; o0 H
-SI = 4647h$ j% v3 J8 d% i- v$ P0 E
-DI = 4A4Dh
( |7 ~8 @( {5 sWhich are the 'magic values' used by SoftIce.
6 U# b# X, {4 P4 qFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.
$ `' i  q; j1 R! L2 k* \7 a* ]; J/ O
Here is one example from the file "Haspinst.exe" which is the dongle HASP
3 X0 F* S9 m; f; q8 kEnvelope utility use to protect DOS applications:" L, j/ I, T7 T7 r( o" B+ Q# M

: `& s; M. Z: @
, r# f5 S, N1 o- W4C19:0095   MOV    AX,0911  ; execute command.
- R! [3 T3 u7 T& E1 K4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).. Y% C1 L2 A( c! U' y
4C19:009A   MOV    SI,4647  ; 1st magic value.
# C* p9 h9 ]1 F9 ~9 ^5 o4C19:009D   MOV    DI,4A4D  ; 2nd magic value.! d7 ]+ w7 I+ Z% p
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)# H* ^$ a9 q8 n5 b
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
, s4 U/ v- m: v8 e9 l- h( a- t& k4C19:00A4   INC    CX
; e" S; g+ X  H3 I$ r, m# Y5 k4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
1 i& ~2 C) W; g" d4C19:00A8   JB     0095     ; 6 different commands.# I5 J' R- n+ m" f0 l
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
" ]' C" {( |/ o0 C9 M$ W4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
. a- q6 R8 `8 n: G0 h* a; v* P0 G# ^& l% g& M
The program will execute 6 different SIce commands located at ds:dx, which5 _: X# r  O4 C$ x) l
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
4 _8 l5 ^* O$ y  ^$ A' z
4 p) d: e1 c. ?5 s( {/ ~* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
! R; F! W% ?- V$ ?* E$ ?___________________________________________________________________________
9 R! ]! @. s1 k1 Z4 _0 ^6 H% z. R! D( S
% c0 c: Y- d- i& w% ~
Method 039 R4 [! {$ Z2 m: S: ^
=========6 l% @' w9 p) _$ f, N
: R% o% o3 q9 m
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
6 j+ y! e& v8 q  K0 V  T! r+ H" }) O(API Get entry point)0 Y$ p( T. i) v% W7 J
        / k% @. F; P$ |2 z6 _

# q; h# [: \0 E. g    xor     di,di( g' w7 V! \+ N6 ?4 E6 G
    mov     es,di0 U  _9 F( @& Y  E0 J) \. c2 }" W
    mov     ax, 1684h       . f; n- X- F6 L6 R' m& F' |
    mov     bx, 0202h       ; VxD ID of winice3 I- e  Z$ l* N
    int     2Fh
! _5 P% s, [% v. l% ?    mov     ax, es          ; ES:DI -&gt; VxD API entry point" B6 u8 l) b: c4 Z# u
    add     ax, di; T0 Q. F& W: U$ F( P
    test    ax,ax; @' t' @9 j+ m: O. I
    jnz     SoftICE_Detected7 v7 y3 A5 N& q% r  f, W! a$ @( \+ ~
, z7 M" }; u) {0 Z4 U* I
___________________________________________________________________________
3 z7 W6 E: M, k, r$ Z
+ |! `' H1 ]. x# E+ c* y( p, HMethod 046 d3 X  z7 A6 \% R; M% J
=========0 R& h4 a: U  R" F
, w+ r: M% ?* M! |5 |" t
Method identical to the preceding one except that it seeks the ID of SoftICE
; Z8 A  I4 M1 z4 B! A2 {6 h7 ]GFX VxD.
* ]. b& C( Z9 l7 h! n/ Z1 C3 ?( Q8 e0 q& M4 F! m- N
    xor     di,di
! ^3 L& W# n+ M    mov     es,di
, u+ S  C7 p9 T5 M5 h    mov     ax, 1684h      
6 D) k! K) i  ]% s    mov     bx, 7a5Fh       ; VxD ID of SIWVID
5 f/ P  q7 J: I& E4 P- d0 u    int     2fh7 q, M' S) c7 a  u
    mov     ax, es          ; ES:DI -&gt; VxD API entry point, R! d4 t  E. K6 w  `, y+ r; k
    add     ax, di( p3 K& ^+ O. A
    test    ax,ax" j! S3 M2 o/ W" N
    jnz     SoftICE_Detected
- P, z5 `$ W( g$ f4 ~7 U5 L
+ y2 F- K. q- s  I& c+ }3 u! t__________________________________________________________________________
3 S* b! n: O0 \8 ]9 d2 P3 d; L
: ~# Y0 @. F, x
4 V6 G) n, J1 o0 `1 J" MMethod 053 l+ c; X- Y+ B$ J% b
=========2 j- S( E) w- o5 M; T. P+ e
: R9 p* u+ J3 U! W( o8 o6 B
Method seeking the 'magic number' 0F386h returned (in ax) by all system
7 h4 H- \, v1 r% G; Ddebugger. It calls the int 41h, function 4Fh., ~- z* }( X. V1 `
There are several alternatives.  
7 p4 S* Z& m9 N, z* O% V- h0 j
- d+ l* \& F( I, n8 q& b0 }$ OThe following one is the simplest:
6 h$ C) E0 M' o
) f1 {  g. r. y    mov     ax,4fh
! I" z( L9 u- P' \    int     41h
' O$ f+ |  K# N3 R5 U    cmp     ax, 0F386
( R0 `$ F3 v0 d2 K/ H& v) B, c" h, b    jz      SoftICE_detected
6 W" j& H+ H; e) |0 j1 ]" u# r0 I1 O# K2 P* I* G5 C  D
+ U6 F8 ^- B+ r; E  J7 I2 @2 ~5 f
Next method as well as the following one are 2 examples from Stone's " y* m- @$ T9 Z, [" Y6 l% }- J
"stn-wid.zip" (www.cracking.net):
9 V7 L3 W/ `0 Q4 @# s" R" J5 z, q5 P& s
    mov     bx, cs. [1 ]: M! H5 y; b- a! `. a
    lea     dx, int41handler2
% U5 ^6 v# V$ v    xchg    dx, es:[41h*4]
( J. y0 u8 t% s. N+ m! |3 j    xchg    bx, es:[41h*4+2]
! N. |$ ^, X" }, v0 i2 I    mov     ax,4fh
. W$ K% m4 P8 A" R/ B% W8 o    int     41h
2 S0 d! F( `7 R; i/ M( m) |! s    xchg    dx, es:[41h*4]# t7 L! M! T/ q$ k" M
    xchg    bx, es:[41h*4+2]* y7 W- c0 w! \6 ^5 t* e3 ~* s
    cmp     ax, 0f386h
9 i- b9 p/ ^$ P  {    jz      SoftICE_detected" d; c- L8 m; x: D
& ~* o8 u& k3 m
int41handler2 PROC" s" V* S  X0 E/ }; ?
    iret
! [9 I& t5 }" x8 E1 Aint41handler2 ENDP
! L8 t1 Z9 A" w2 @8 \% y5 E7 ~* s9 u% N

- P0 X/ d9 U7 ^3 z3 @1 n/ h_________________________________________________________________________
0 h2 a& O+ ^" Y' ?/ `3 E( `5 m0 n7 Y; f; V; |$ g- t( r

- h& N. y1 R9 N3 j+ y: m/ {3 H$ Q3 hMethod 06
; I4 J6 A$ |  F. A2 y! n% D=========
7 K, e" Y& q- I8 _
. G1 f5 J% R) y7 M" `5 q
! b" I. O1 |+ ?' X/ i; @" \; ?2nd method similar to the preceding one but more difficult to detect:
) Q9 L! G) Y; o. K; ^+ G% [
$ G7 V. a+ }/ f2 o9 }' ^
. u5 G' W2 p, c! y& Qint41handler PROC
& g- W7 w1 X! C; i! q0 V( i4 |3 h    mov     cl,al! b+ Z8 _' F( {  L# P
    iret
( Z/ \2 _6 n$ h" w) r& pint41handler ENDP
7 n/ d: _/ z- h. l: W" U8 D' }/ J  m9 C. x: A% w+ G8 I: _( Q. C

5 w6 \: c- F. V. Y' [/ j    xor     ax,ax
+ \3 ~% b" K) y9 C3 Z( e( X    mov     es,ax
/ X5 r4 q8 y9 M  g! s! S2 c    mov     bx, cs, t* g( {& j9 ~6 h# I5 M
    lea     dx, int41handler
2 O% o5 L& R% |" J% |) D" z    xchg    dx, es:[41h*4]
7 h+ ?+ L0 ~0 ]4 ]! M4 V4 B! m    xchg    bx, es:[41h*4+2]/ U6 Y9 w" G. V5 h% k6 Z
    in      al, 40h
3 b- Z8 ?+ y$ k$ j1 q3 H* N' |    xor     cx,cx1 I7 Y7 b% y6 K4 n- ]
    int     41h: v; `, Z. C  f$ s0 @
    xchg    dx, es:[41h*4]
0 S4 L. o/ Z% K; @! R    xchg    bx, es:[41h*4+2]
. }. H) Q7 I1 Z3 w8 _, b% L7 Y    cmp     cl,al, q% A6 W6 X* `4 F. h1 P& r
    jnz     SoftICE_detected
7 D/ @2 [& M, j7 n' A: A0 ^( F
& P) |1 G9 V2 t2 i8 t2 j- u* U; g_________________________________________________________________________$ I& q# z7 P( z  q  B: \% f

. }' I0 O5 E) B. QMethod 079 n4 F- z) Z3 y1 R
=========- w8 ~; f# o+ U* {( G& B& d, l
4 `% H4 }* W/ h+ h+ Q+ N
Method of detection of the WinICE handler in the int68h (V86)
! k% m9 p7 F8 _! [% x) H1 F! A5 f, d* o6 h- X
% o; M8 K( {1 j3 U    mov     ah,43h
, z" h* U  ]+ r2 F1 G    int     68h
( @& g5 a' @0 ]. Q& V0 r2 g" @    cmp     ax,0F386h- d% \' ]& S5 e4 w8 X
    jz      SoftICE_Detected
/ U1 F" T$ P& s) X' G4 T0 U  Q& ]( X' [- B9 Q3 ^3 ?; }' M
, M+ N- V+ `: P0 U; K4 r
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit+ U3 m/ v  O" C
   app like this:
/ M9 S4 l  D7 K2 O8 N" u
7 t2 D0 N6 `9 J4 Z3 n3 I6 t, N   BPX exec_int if ax==685 h4 C5 k4 i1 q3 E; V+ C3 L# \6 Y
   (function called is located at byte ptr [ebp+1Dh] and client eip is9 J9 c6 C5 j6 m+ `4 g1 G% o* U
   located at [ebp+48h] for 32Bit apps)" x* b8 {8 H8 ]
__________________________________________________________________________- |( ?7 B  [1 V6 ?7 w  K# Y7 ]) e# Q

! T( v/ X+ d. p% y$ w$ r1 G- T7 H, `3 U0 {1 r
Method 08
; x2 Y  u" c8 R=========
3 W/ ?; K! j. s) Q$ E+ V0 ~3 O% |0 y! ]
It is not a method of detection of SoftICE but a possibility to crash the! r1 B* o7 }' Y* E
system by intercepting int 01h and int 03h and redirecting them to another! a/ o! a8 `0 A# e) t" H' |, G# H
routine.9 W9 H2 ~8 n; i& @4 ~) @
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
8 @0 ], p$ y) `5 @to the new routine to execute (hangs computer...), u$ P) C4 J; I3 J, y5 g) d

& {, A/ C4 v* D4 _6 w( F& O    mov     ah, 25h
! m* A0 I1 N4 N( K% a3 U# i    mov     al, Int_Number (01h or 03h)
6 W% Y$ O4 p2 m! w5 j. v1 H1 s    mov     dx, offset New_Int_Routine
1 A( Z+ a3 |4 B3 U7 h3 q# s    int     21h) K! n$ s$ t& v8 F3 i# H
9 ^& O0 H- t) f! Z: m
__________________________________________________________________________) B: y; ]- V2 Y1 W* K
- n8 h7 R* |; v, x0 b* z
Method 09
3 v/ U% M; A& ]6 [' E# T- n=========* k4 Y+ m8 `2 Q7 b' D# }
/ }3 f* m) L1 R: m8 a
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only3 z+ }8 U, I+ G) h6 I, n' S, i1 l
performed in ring0 (VxD or a ring3 app using the VxdCall).
6 Y) q& E+ o3 a4 w9 c  p. fThe Get_DDB service is used to determine whether or not a VxD is installed7 t% i5 d+ H& q) L1 Y1 y: B( w
for the specified device and returns a Device Description Block (in ecx) for
- W; V# `& ]# d: Z3 h3 sthat device if it is installed.. H' u4 J4 f$ N- I: ]
" k5 a- @* {2 `+ N5 x- {
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
! Y- _3 M' l7 M   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)5 m3 |6 S! m1 ?( g( i
   VMMCall Get_DDB& L9 w9 x5 S; l# [' }% A
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed+ b! a1 J& t) [9 N; v

# D# p$ X2 j3 c' ANote as well that you can easily detect this method with SoftICE:6 l4 p% [( y$ I  c8 a: J) g8 t5 I
   bpx Get_DDB if ax==0202 || ax==7a5fh( @$ A: X; P; q- z6 N# M
: ]' U, c9 T4 E$ ]( R
__________________________________________________________________________- O( ^  C2 f6 D4 f! @- K

+ `+ a( x% |" N- A- rMethod 10
, Z: v, x" r  M1 E. K' Q% |=========' {( }3 Y' i& b+ S# x4 s8 x4 ^& H9 _

/ U; L! \$ B) z) {- O=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
0 ]# C+ ]3 l/ O; q1 O) l  SoftICE while the option is enable!!
; q! s5 }* w- i2 B4 J: @) ~' u# u' ^. l
This trick is very efficient:" E" j" _, b$ J( B
by checking the Debug Registers, you can detect if SoftICE is loaded$ I% C) p" i  ?
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if2 m; S6 G( F6 ^3 o
there are some memory breakpoints set (dr0 to dr3) simply by reading their
* Q: b/ z+ b3 i! pvalue (in ring0 only). Values can be manipulated and or changed as well
7 u4 l7 \* J; L% J7 N: W(clearing BPMs for instance)* C$ e$ Q& c8 R7 y6 D4 Y

, H9 L. E) p' z: e. k__________________________________________________________________________3 E% M7 E2 l$ p) U' s9 t+ n$ ]
# V& M% Q7 {/ o5 B5 i1 N) @
Method 11
3 X2 m( }4 H7 i& w: Z: n=========) t; _0 a0 W& E+ |; t& g1 ]
9 W% D8 k& y& S, Y  j: x
This method is most known as 'MeltICE' because it has been freely distributed
0 u) G+ C* U; _2 {0 K) {8 Tvia www.winfiles.com. However it was first used by NuMega people to allow& Z0 [) O  \& z; J
Symbol Loader to check if SoftICE was active or not (the code is located. p& H" ?, X3 b! t5 r' y
inside nmtrans.dll).) O' l. R0 s" W/ p
6 F' t# d# |5 R
The way it works is very simple:
: b- x# h0 ^4 c! t1 C8 CIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for9 _  a7 H" O- U( w
WinNT) with the CreateFileA API.
* ~/ @; F5 J( v) W% V; Z
. Y# s" w  n8 W, L9 b7 LHere is a sample (checking for 'SICE'):
. J1 O  j: r( u/ R, T* }8 }
& S! N" p( }5 v; i! p% I/ l7 KBOOL IsSoftIce95Loaded()+ g7 v1 y9 B4 y. R6 S
{
2 I$ l) h' j- l5 J" x   HANDLE hFile;  
7 B! c3 Z: c! F& k   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,# ]* J" k  C) W$ Q! r6 c( [
                      FILE_SHARE_READ | FILE_SHARE_WRITE,
8 s/ g; H: p; M4 F                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);# c% h. I: W/ m+ b. d- w* m
   if( hFile != INVALID_HANDLE_VALUE ): E8 N2 m2 L$ x* w: S
   {
- B) V$ j) u" h* U1 a7 [      CloseHandle(hFile);
% M( G, }1 c, o" Z      return TRUE;5 h4 T, H- K; a/ d# w7 |
   }
: h: V/ i" t$ d+ g# s) ?' g# @7 {   return FALSE;  x! Y) g3 f3 [; v0 J
}
; ^! ]- R. _3 O! ?
; p& i* ]6 l* g* Q* N. bAlthough this trick calls the CreateFileA function, don't even expect to be" f* E/ \2 v; C8 @3 I
able to intercept it by installing a IFS hook: it will not work, no way!
5 |" p* r% }- z" q$ [. S) {0 G! QIn fact, after the call to CreateFileA it will get through VWIN32 0x001F
( c4 ]% C8 N+ O6 Cservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)( z* M+ @/ F% }  K1 q+ w/ O
and then browse the DDB list until it find the VxD and its DDB_Control_Proc
, {( f, A8 M8 A6 H3 ~& ^; e9 hfield.
1 a- v3 j2 d4 R9 V. e- sIn fact, its purpose is not to load/unload VxDs but only to send a
# ]) \0 a* m: p. Q2 n( m8 SW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
3 L- V3 ^$ r3 p; [1 n) bto the VxD Control_Dispatch proc (how the hell a shareware soft could try: A+ h: ^) d7 D4 h& U
to load/unload a non-dynamically loadable driver such as SoftICE ;-).
6 y7 P- c" a- L; r( ^8 n  pIf the VxD is loaded, it will always clear eax and the Carry flag to allow
* ~. ?9 A/ `! m6 ~. ~; z1 cits handle to be opened and then, will be detected.
$ E2 s4 \. d0 DYou can check that simply by hooking Winice.exe control proc entry point, I& e  L/ m: x; m
while running MeltICE.
* q" s" m$ u. t& R7 p; o8 X8 o* n$ \8 l  b9 I0 z7 N* k: a( N: J
% a( C( Y# y3 h1 A8 d7 C
  00401067:  push      00402025    ; \\.\SICE0 V. ~/ [1 e% V) D' H
  0040106C:  call      CreateFileA. T) J  C5 c4 G' E: g, _7 p( v
  00401071:  cmp       eax,-001. F5 X3 ]' [- d; A9 {
  00401074:  je        00401091
8 D. }5 j8 y! E3 `
: g" A1 E5 l# S" m! j! s
+ L+ \% y/ o6 w' Z8 O" e2 E4 `9 @  |! yThere could be hundreds of BPX you could use to detect this trick.
8 `3 _2 m; Z* e" Y1 O' E, m9 b1 x-The most classical one is:
( L  h  `6 W$ M; A" I  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
! \( M6 G3 \; M& n    *(esp-&gt;4+4)=='NTIC'4 @) ~2 v6 ]6 i# G
2 u$ h# u- v2 j. J1 \2 j2 e' P
-The most exotic ones (could be very slooooow :-(, y0 B+ A3 t" [0 T& @7 Z6 C
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  ! N3 X- f2 \0 a  l
     ;will break 3 times :-(
4 g0 J2 B. B' n- O: S6 J( F3 y: Q& n4 I" o3 u: h
-or (a bit) faster:
; E5 I& c- Y$ H/ R   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')" O0 ?( s) i9 F6 `5 v% z

$ g5 o  X" q% j5 q7 [   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  ( `5 e1 r3 j+ G: {' G
     ;will break 3 times :-(# ?9 P3 `9 y% Z# }# J& f

) o2 f. }  V6 }& q6 [6 H+ y-Much faster:' w0 h: P+ s* W. Z- r
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
$ n8 E/ M: _0 u2 V; B; i
! N/ a& V5 U8 z- e. I1 s# }+ rNote also that some programs (like AZPR3.00) use de old 16-bit _lopen
* W$ y! m; f" Tfunction to do the same job:
7 b! B$ I, i/ g$ B# X) I, k# M! @
   push    00                        ; OF_READ
/ B# m, j' _) b# q9 r   mov     eax,[00656634]            ; '\\.\SICE',0( V8 I9 d+ b: K/ w# Y" v( Q
   push    eax
# k# @+ C" F- |+ g0 X2 n   call    KERNEL32!_lopen; ~3 N4 n5 z% B- A( m0 s+ p! H
   inc     eax
! y2 M: n: o# D2 O   jnz     00650589                  ; detected! T+ |+ J# B0 k* z8 w5 G
   push    00                        ; OF_READ) w; _3 t3 \. r0 u% B) t! W
   mov     eax,[00656638]            ; '\\.\SICE'8 x6 L5 u8 ?; i* `2 |% g' {
   push    eax2 X# d: `6 u7 H, s. @+ [: K
   call    KERNEL32!_lopen
( M) [& K& Z$ c. ?/ w4 O- W   inc     eax: z% \# m: C" q" ]
   jz      006505ae                  ; not detected
3 J, f2 `3 d7 N+ R
; e; a! f5 C) w) D6 M( {1 l. A6 G7 `- e: H  c0 [
__________________________________________________________________________
1 I# Z4 r: y$ B0 K, w! ]  B4 @
Method 127 L9 v, K4 B9 O5 L( u
=========
! ?" g* ]  o4 r8 X3 I) a" m% G' ^; z2 C# W
This trick is similar to int41h/4fh Debugger installation check (code 05% [& V' v! i7 w; N  y6 f2 g
&amp; 06) but very limited because it's only available for Win95/98 (not NT). N% v" r  }7 R! V% T6 R
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.* r3 U' x. F4 ]6 `9 R$ Z1 H

% e4 Q. b" [& I( H   push  0000004fh         ; function 4fh( V6 F- F2 d7 S
   push  002a002ah         ; high word specifies which VxD (VWIN32), g. }+ C* D. ]6 K9 e( J/ Z  Q9 |
                           ; low word specifies which service8 m) C" M7 H0 [! Y. r: B1 o5 e
                             (VWIN32_Int41Dispatch)4 f. ^" w0 f6 I0 H8 B/ r
   call  Kernel32!ORD_001  ; VxdCall3 U( j  q; v6 O* Z/ z, F
   cmp   ax, 0f386h        ; magic number returned by system debuggers' r& q! C& r! I! ?$ o7 R! ~0 D& z
   jz    SoftICE_detected9 [$ A) [" t  x# V" i2 B5 b$ O" E& I
  y( D* e% A4 Z) c9 i0 V$ o7 F
Here again, several ways to detect it:
2 X( a" B# H, Y. E* h2 R/ R9 ?6 ]# V! I: m( T$ c) l% ?7 j# z5 Z" j& X! U
    BPINT 41 if ax==4f
# k7 [, h/ S/ Z2 M6 F0 X4 n- t3 o# u0 {
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one, k% A7 U9 X3 C7 a- A5 e

, a; H% `5 B5 |$ d1 o' S. n    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A; a4 h/ l( ]; F% x) ^( E: N
  I* C$ d' f/ \- H; Q
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!( J2 h6 R+ |# i

; t, D" j9 B" T6 W6 F__________________________________________________________________________
5 `7 A2 d3 S3 q1 A& L- n; U6 V4 k0 d7 N! z( _% A/ U4 x* u/ y
Method 13
- z6 s1 K: y) A=========
: c! S, R& d( m. f  y1 U* g3 p# S6 m' j: C" b: K
Not a real method of detection, but a good way to know if SoftICE is! g4 [6 L" y6 q
installed on a computer and to locate its installation directory.  c6 Z. |; Y" q  T% U% a
It is used by few softs which access the following registry keys (usually #2) :
3 t$ Y- J$ a8 P1 [1 A& n1 @4 v
3 |8 v! R# w0 g7 M% K7 R5 N-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion2 O8 o9 f( M$ N* Y; m6 k
\Uninstall\SoftICE: X1 V3 J3 c- \
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE  `& X8 ~; I6 `! C) y; M
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
) U8 M1 B2 |; z( U\App Paths\Loader32.Exe
+ D% P2 a$ i7 Z; ~/ k# m
& l! |, Y7 x' N" ]/ b" F, \8 F/ C' D7 i4 f
Note that some nasty apps could then erase all files from SoftICE directory" k  R/ `1 s9 Z3 o. o
(I faced that once :-(
( ~& a, @( j8 R' i1 g  u
7 ~0 P; ]8 ^: f) m8 ^2 vUseful breakpoint to detect it:
9 R$ f9 i8 h7 r2 n/ V3 k- e2 C% N% B+ E' X8 @
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
+ B( q' s5 ]: g' \8 \! ?; H. i1 i- E$ V$ R3 O
__________________________________________________________________________
* U4 t, D  N$ f' M8 o
0 \7 p4 @2 i! Y* ~  Y
, l, x' n2 u( s; N* |Method 14 " \) p/ v3 r( s. Y9 m4 `" w2 l
=========
. U  u( t9 s: H7 ^0 S" }
) z- }5 M8 g3 |; s# d* {A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
$ |) B2 s4 X1 {# @1 c- cis to determines whether a debugger is running on your system (ring0 only).
$ M+ |5 R$ K6 B8 o# W7 e; K
6 r' C* v+ W& ?0 w   VMMCall Test_Debug_Installed0 m- X+ R) _9 p  E
   je      not_installed6 ~* o; Q6 r- q" R5 N5 ^. p: ?4 Z) s
# G" v  w$ ~3 R
This service just checks a flag.( {- P; v% k4 t5 m1 B
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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