About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
8 X. t( M% t8 \1 N/ J<TBODY>
$ B7 E3 P$ [- u) |, S<TR>
1 p, g- N0 ]* s/ u1 r1 P4 u2 n% |<TD><PRE>Method 01 # v7 q1 `* K0 Y+ h3 j8 V( p# O
=========3 V' N. _; A3 L8 t. U' |

: Y1 [3 F) u, X# V; y2 ?) U- aThis method of detection of SoftICE (as well as the following one) is
4 \3 a. {- m% F6 [/ [0 Oused by the majority of packers/encryptors found on Internet.
; ^# V- S/ q/ f4 u8 }+ eIt seeks the signature of BoundsChecker in SoftICE, \# n- J7 ?; ~0 p3 F6 o. \

% u2 d# {- s. a# T* B& G! o( {1 w    mov     ebp, 04243484Bh        ; 'BCHK'  I: l3 ^3 _0 q2 s2 Q* m
    mov     ax, 04h
/ s( Y  {% O1 M4 {' ?1 B    int     3       * h4 p0 Z9 P2 a3 d
    cmp     al,49 Z4 M/ U  N* n. f( _3 W% O2 ?
    jnz     SoftICE_Detected/ S/ ~& w: w4 N7 Z! n; x* m) O
- d; a! R& }% i# T
___________________________________________________________________________0 @6 D$ d# F! O3 P1 B; m- s
& W) t( D# T. F; L
Method 02
2 k: A6 T6 P2 v" Z7 [/ J) ~0 D' t. r=========4 O1 n$ p( w# @7 F( \

) u: n  v2 R2 n& |. AStill a method very much used (perhaps the most frequent one).  It is used" u7 `3 C, T/ b4 B2 Q' U3 g
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,2 u& Z5 l" q5 L8 p& I* k
or execute SoftICE commands...
1 k& v5 K1 t1 J$ ~: kIt is also used to crash SoftICE and to force it to execute any commands6 w% c, L1 x- K! }. x0 ?
(HBOOT...) :-((  
5 u* j0 r5 V: q
- `, `3 f' o# f' IHere is a quick description:2 G; l  J- H% v, r7 |# m
-AX = 0910h   (Display string in SIce windows); h- g( j+ ^* H
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
5 M0 b# F+ L' `/ P/ Z: w-AX = 0912h   (Get breakpoint infos)5 B, o& z7 k% |& v* d2 F, u" G
-AX = 0913h   (Set Sice breakpoints)
) J. b) f* U8 N# z-AX = 0914h   (Remove SIce breakoints)
. V8 C2 Y& K' L1 S5 \7 E+ H% }
Each time you'll meet this trick, you'll see:% ]2 h1 B7 X9 B; Z7 h' f$ ^2 Q
-SI = 4647h
4 M8 t8 i. f9 I4 p. E/ H# ^-DI = 4A4Dh2 R* }" \% C1 ~6 s$ I! _+ P
Which are the 'magic values' used by SoftIce.* l, V2 u2 ]0 e3 `, @: C
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.
* {. F) O* P- t+ S
- o6 ]: y* R* H) ~" Z- X7 a* @7 n/ w& zHere is one example from the file "Haspinst.exe" which is the dongle HASP
7 \. [6 J$ ~. o4 J& M6 D  zEnvelope utility use to protect DOS applications:# q5 K" w- O9 B# K: R& J/ [

8 ?+ g3 O* B; @2 ^$ }! i- E4 [% e( G) J8 B1 b
4C19:0095   MOV    AX,0911  ; execute command.
# |- ^6 H* F8 ~; y. ~! V4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
, v! k7 c" w9 ~  G% X7 k) v" p/ w4C19:009A   MOV    SI,4647  ; 1st magic value.9 w: k$ |/ ?: ~& E( C' ^7 \+ @
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.6 H6 c- v- i$ K/ m- E9 N8 v- i' ?
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
: R& @& G4 J; t4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
- h3 R# |& Y4 X% X. H, I, p4C19:00A4   INC    CX  v- |5 e& z  N/ y4 _2 o: v2 h
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
0 E( _: A  R1 N  s7 i1 y+ Q: Q2 z4C19:00A8   JB     0095     ; 6 different commands.
- u; K9 x0 X* R: ~5 D6 C4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
: A0 P8 V( f& @) m: R/ O- [# j" h4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)9 I" a1 U  M/ d! G$ ]" J

0 l/ y0 k& i9 ?2 JThe program will execute 6 different SIce commands located at ds:dx, which
( X7 e4 e2 c& |are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
7 m/ `, w- [2 a+ f. Q* x* m$ _: C/ W5 P2 F  o! p! P2 V
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
: f5 F2 _/ A4 q___________________________________________________________________________
/ ?* K1 K% N1 h0 C" u' D9 O8 H3 O. B: ]) l# w* a
. |" g' T2 m$ e0 R. p8 _4 |6 u
Method 03' C: C; Y2 c4 p! {+ @& [2 [
=========' y$ ]6 {1 o* Y

; P- }. N' H* P  [2 y& _2 qLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
8 `3 C2 U' W2 v8 ]: Q1 M9 l(API Get entry point)8 Z3 ^4 r& D) A, p
        8 d! \( X7 X8 N
: D: {1 X: u- Z5 E4 h: X
    xor     di,di
/ v5 S9 D# n+ @8 {6 ~    mov     es,di
# ?! F2 n- O7 c$ g    mov     ax, 1684h      
( p8 b- e% V; F& @8 i- p    mov     bx, 0202h       ; VxD ID of winice; k6 C8 T' G, d; ~6 b4 r
    int     2Fh
& h' A; O& ]4 E: d" Z0 i. B    mov     ax, es          ; ES:DI -&gt; VxD API entry point3 X% J' y7 h, F
    add     ax, di% x- n" L9 U' a7 b
    test    ax,ax
1 o- S! E0 \+ t9 b5 J7 C# H+ n    jnz     SoftICE_Detected
5 n7 G2 ]+ O7 U! [7 Y4 t' Z, r! G8 o
___________________________________________________________________________
" K" Q( _( l; ^5 n  Z' o3 N# \. ~. _5 V
Method 04( [9 V& }( S) r( [6 K7 g% i
=========0 Y6 q2 l$ B0 {5 m& i6 N
! q1 l# T! S3 u- K# K
Method identical to the preceding one except that it seeks the ID of SoftICE' i8 |7 z% p/ Z% m  u$ x3 M, h
GFX VxD.
" U  D( u6 e4 z9 p& n; t) _: E) {7 D+ t% S. T( i# k; z
    xor     di,di
& w) ]& b) j: @. Q" B) b8 ]    mov     es,di; N6 q8 {" _& a/ S1 y
    mov     ax, 1684h       5 D. E1 S- `( f! t3 I
    mov     bx, 7a5Fh       ; VxD ID of SIWVID
" c6 Z0 G/ h1 G% s$ s: ?    int     2fh
+ ?6 b  Z8 k. K/ b    mov     ax, es          ; ES:DI -&gt; VxD API entry point" Y% Z" `% _, D" d/ f  i& S
    add     ax, di3 X" s$ G$ {; o- n3 I
    test    ax,ax. v. F% t3 F+ A% p% H. Y
    jnz     SoftICE_Detected, ?# c; N8 i+ ?+ f

% W  S7 Q! T  E2 |( ?' ?+ I  Q) W__________________________________________________________________________8 q/ W% ^4 a. M8 O

7 l" t. m0 T8 I  h$ B- O* F( b
* ]" M8 t( J( A( p5 GMethod 05
) I: d; U; v4 ~=========3 Y1 d3 N. c  F" ^3 ?. g

! s  ~$ I% r+ [- H3 OMethod seeking the 'magic number' 0F386h returned (in ax) by all system
* c( M& Z) m, m- s/ }, q% [+ p- Idebugger. It calls the int 41h, function 4Fh.& i. k4 B. T& t9 ]1 L4 D, y3 |, ~4 ?
There are several alternatives.  # X/ c4 o$ p5 d: e

' i* ~6 ]. m2 P0 L( z( xThe following one is the simplest:: e' I4 N& _0 |% N2 n6 A  f8 [

8 b9 `5 t3 h! [7 l; `( W7 P    mov     ax,4fh
1 Y( r5 c4 B; ^+ y! z' k    int     41h
6 {# N3 a' g; n* V9 r    cmp     ax, 0F386  \+ |' B" s" B5 C- {/ l
    jz      SoftICE_detected
0 N! L2 S7 |' Y/ z8 P# y, D; O* h" {3 U$ ^$ |1 F
) Z5 f- V  ?  {% [" Y  L
Next method as well as the following one are 2 examples from Stone's 2 J$ ]* J' [0 o- G
"stn-wid.zip" (www.cracking.net):- `  l8 B2 X, A4 {; L8 Y

( s8 m4 m% q+ K% R& V: d* O    mov     bx, cs7 u+ q  N* [' h4 @$ X* [4 v
    lea     dx, int41handler26 A2 n1 D# f6 \/ L) |
    xchg    dx, es:[41h*4]: }! I* b$ L" o% _
    xchg    bx, es:[41h*4+2]
+ V4 Q3 M$ z1 Y2 i3 I    mov     ax,4fh
! t- n4 o% j) d) s. H0 y! c. \! `! V* r    int     41h) _% v4 J5 j! n
    xchg    dx, es:[41h*4]
. |+ B+ c) k1 P5 X7 J3 M    xchg    bx, es:[41h*4+2]+ H* e7 x; t3 r
    cmp     ax, 0f386h
1 d, c# k4 d7 m5 p2 T1 p    jz      SoftICE_detected
, v+ s( g* p5 M6 ~. O) [& Q
# B$ z* R& U: d8 {int41handler2 PROC
1 R  Q- ?* p3 E6 k- M, P$ z) P    iret
5 y; I4 J) z. l. _: E9 u- ?2 eint41handler2 ENDP' L1 k5 _/ o- ?/ \/ {, a( `

( J/ F1 g/ ^. E; }7 W2 U6 o. ]: U  C0 L: V. @  f
_________________________________________________________________________  F+ Q! S" _( {
( e7 {" j) J6 q- |! n" j  {

! Z1 H! S! Z4 G( C% l: E& OMethod 06
0 \( C4 _  F. t9 a% G5 Q=========
" [6 B3 T! a7 K" b9 I- n
& ], U  c" ]% u; C
5 T# [/ E" f/ @  m2nd method similar to the preceding one but more difficult to detect:5 v0 Y2 M3 R, U7 P7 S$ o5 w' e4 d
" F# w. ^% Q0 X0 I7 i8 ^
, ^4 s: e# K9 E0 @2 T
int41handler PROC# j- e' w5 o% o8 _
    mov     cl,al; Z& @5 O$ O6 Z  ]( m8 r. s
    iret. p4 J" k1 W- ^! }
int41handler ENDP
' ?6 L1 v/ l: {! c: @, {& ]" B) C! o6 ^5 p
8 m3 V: z- w. M- ~( O" j
    xor     ax,ax
2 m9 R: g* C2 \0 N9 I    mov     es,ax/ l) p& P9 l- Z# x' n; \
    mov     bx, cs
1 s8 t3 ~- i+ m0 m. q% p1 T5 V. {    lea     dx, int41handler
' G; F- C' e0 f0 @. q. x5 p. _8 Z    xchg    dx, es:[41h*4]
# W) ?$ ^5 z: X) b6 a% ~4 W# n, x    xchg    bx, es:[41h*4+2]
. r& n0 ?% |, I6 t    in      al, 40h
% t- r& z5 S5 k    xor     cx,cx' _3 N# l/ @$ f9 F; D
    int     41h0 t2 e, x7 m0 l5 j) m: F
    xchg    dx, es:[41h*4]$ W' Z( ?2 |4 w% r8 ~% |
    xchg    bx, es:[41h*4+2]) [( z# R' q" F2 n
    cmp     cl,al' V' y& _/ A# y5 {
    jnz     SoftICE_detected8 E% ?0 j. ]' {: k. k

0 F4 r5 [( Y5 X_________________________________________________________________________" X$ ?, U0 r% Y) p, V

2 I; [: W* t* F- M# \Method 07
$ A# N, |1 c4 K) x5 T=========. d5 o; r, S5 Q( t
/ _, K9 c# S$ U0 K7 h; x% x6 C% h' J
Method of detection of the WinICE handler in the int68h (V86)! U: J5 b( D* r

" L1 H* V3 y9 Y    mov     ah,43h
% C" m5 G1 X* u& G  S# c5 e    int     68h9 f" M0 V* g3 x3 S& u/ F
    cmp     ax,0F386h1 ]3 E( K( S5 |  m. s
    jz      SoftICE_Detected
( }, \; S' m7 C% l( t3 X
  c% m0 T2 Q8 X% [+ `+ [5 u* u: x) Z) G! S4 `( y; f
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit7 Z- t+ r* g' d
   app like this:
5 W& _2 B+ F* l- y0 U, B) `" l  g2 o
  o$ Y- P$ V4 g   BPX exec_int if ax==68
8 \9 o$ Q5 g0 B- q) b   (function called is located at byte ptr [ebp+1Dh] and client eip is. J3 |3 D4 n) n+ _
   located at [ebp+48h] for 32Bit apps)& \8 ~2 p* I( q  U3 g8 Y
__________________________________________________________________________% o/ o! P+ g' q+ K
  w, v7 D) f' R: H6 g# Y

9 \1 W3 v: i. fMethod 08
( R8 l4 u- q2 m( x' S=========8 L8 n" C- o" [5 K) |0 O( V

( R0 j0 Y+ t: B* X! i) [- xIt is not a method of detection of SoftICE but a possibility to crash the# F  \9 i+ b. y! Q
system by intercepting int 01h and int 03h and redirecting them to another
4 S2 X1 k( w# f4 b0 R# b' Mroutine.
7 `3 z: U- X! @- TIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points7 Z" R0 e6 A" V! b1 J7 [7 T" u0 V9 o
to the new routine to execute (hangs computer...)7 k) o( r" U" P6 v6 t2 Q4 v
% s* r6 V) A: a' A  a7 n
    mov     ah, 25h* w, q* f: j5 m+ ^* T
    mov     al, Int_Number (01h or 03h)
) C& X3 B) x7 X4 P6 H' t9 {" z5 ^    mov     dx, offset New_Int_Routine( N- ^4 E( k, `& M3 ^  u
    int     21h; z! W; H0 w) O8 p2 S

' J0 p4 Z+ C# ~__________________________________________________________________________
# P0 j" t, W9 R- A" i; |8 S2 M# d5 \" H% b
Method 09" I' ]& w$ N8 S, I
=========. Q/ H: ^$ Y! W; r  D- r

6 T$ s' `1 ], P5 I7 k. Q/ s, j1 fThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
- n; i, ?+ `+ h. i: q) Gperformed in ring0 (VxD or a ring3 app using the VxdCall).% k5 ~! K6 t0 J/ ~1 w6 J$ @* e+ ^
The Get_DDB service is used to determine whether or not a VxD is installed
, V. d; X% T! `2 b! Afor the specified device and returns a Device Description Block (in ecx) for
& H# C! H! A) B1 q6 athat device if it is installed.5 n- t: N$ @$ q. j1 {) R# z
6 o* Q+ p+ p, Z: u: }/ E
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
- h% W9 @5 {# D0 I! ^5 y" O   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
+ b' {# w8 }, ]* Q   VMMCall Get_DDB, j. Z. \6 U9 j4 d4 u, f
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
$ m1 N9 b/ X' E5 C3 f! d# F- Z* r0 ~1 s* U, @# r: R
Note as well that you can easily detect this method with SoftICE:
0 c, j. b- d! N7 J8 u; h6 X; u- T   bpx Get_DDB if ax==0202 || ax==7a5fh: q. w" G( {. R& }4 \
6 f0 j' H' c7 e) ^6 u
__________________________________________________________________________
! J, R1 `4 B8 s+ I' w7 J7 Z/ D7 p! A9 U6 n
Method 10
. r' i3 m7 a) A# A" g=========
/ i# G; S2 Z4 b' a8 |8 r! L* l! R
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
! X8 Z$ F# A7 |" Y) t  SoftICE while the option is enable!!
; }+ T* P+ Q$ [* S1 Y: A* R
- d- D0 C# }$ h5 Y# k2 n: O3 K% ?) OThis trick is very efficient:
: }  p4 M+ T3 x8 U0 i0 Gby checking the Debug Registers, you can detect if SoftICE is loaded
2 M# }/ n5 Y; |2 X(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if3 k0 r8 _  M' V
there are some memory breakpoints set (dr0 to dr3) simply by reading their
1 O2 C/ [+ T* a3 vvalue (in ring0 only). Values can be manipulated and or changed as well0 p& `/ u0 Y3 F& b9 g+ J( ?( r; ]3 T# C
(clearing BPMs for instance)
& V5 J+ U$ b8 X! D( `' e
" ?# i) w- O5 c0 l__________________________________________________________________________
6 [" D5 {9 w) F3 Z% W7 r0 ]
0 k7 c6 P% r0 _Method 11
( k$ r' \' g5 p) P: |, W=========
3 H' S( ~# k6 x, i- P5 L
$ E/ q1 L1 i9 d* g. y7 k) b" SThis method is most known as 'MeltICE' because it has been freely distributed" ^3 r, c+ G) I! Y$ _* X
via www.winfiles.com. However it was first used by NuMega people to allow
8 k. I- O1 g  P/ s) bSymbol Loader to check if SoftICE was active or not (the code is located0 j$ p. d2 @# I5 g* H0 ]! }
inside nmtrans.dll).1 b3 ]$ y! x" |- k
/ b1 I- }7 @7 k  F# R+ p9 g
The way it works is very simple:/ f5 N: W9 g, a+ Y
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
& X3 N1 Z7 s* h* I/ R% d: CWinNT) with the CreateFileA API.
+ N( z: b; _3 o2 |# |4 B: {6 q6 ]$ U- z& H% R) u$ G2 P! V
Here is a sample (checking for 'SICE'):! W' f" e' b; y
9 f: D( e$ N5 J; D8 _6 n2 {
BOOL IsSoftIce95Loaded()
0 E2 L/ d" V) N9 v4 U. @{
$ a) I" Z/ l5 v2 M) s+ M5 O   HANDLE hFile;  1 @$ C8 e( Q' Y8 T" |5 _
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
  ~7 c* U2 ^! `- B7 H                      FILE_SHARE_READ | FILE_SHARE_WRITE,
) Y2 ?! C1 b6 W# T7 [- g/ g                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);1 V& l5 B8 r* f9 v! P- Q" u6 ?3 T
   if( hFile != INVALID_HANDLE_VALUE )) F/ W# ~0 K3 U
   {# Y0 Y) [: D$ g) e8 |4 g
      CloseHandle(hFile);8 R& f3 A) w: |  o( J# ?7 x
      return TRUE;( I' g9 {  s; r* c
   }
" j4 D* X. O. U: U   return FALSE;2 }- S5 X/ |$ g' N/ l3 L
}& r# O5 ?7 n: D0 s1 V) {% x9 e" ^

) N( m; Z1 f- S  M4 Y8 \5 Q) @Although this trick calls the CreateFileA function, don't even expect to be
) D: A& G* @9 T2 o7 @- Pable to intercept it by installing a IFS hook: it will not work, no way!
7 p. C) }: P' N# N& v6 F8 FIn fact, after the call to CreateFileA it will get through VWIN32 0x001F9 O3 g( b5 q- u! H9 c$ U( V
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)) }; M( p. V( `
and then browse the DDB list until it find the VxD and its DDB_Control_Proc& {: E( l4 `  [: j, l& a# C
field.
1 D$ T2 u. i+ ?* ?# xIn fact, its purpose is not to load/unload VxDs but only to send a
' r% [7 V  i6 _. f! J+ yW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
+ W% j  Z) v' o4 Gto the VxD Control_Dispatch proc (how the hell a shareware soft could try
* p8 I4 y7 V% G: {) T" fto load/unload a non-dynamically loadable driver such as SoftICE ;-).
3 O6 K6 N6 y; p* D+ p/ v8 }If the VxD is loaded, it will always clear eax and the Carry flag to allow8 Z/ l2 v- W; L' m7 ^8 k2 \
its handle to be opened and then, will be detected.
0 A/ u5 V3 v5 d1 v" \You can check that simply by hooking Winice.exe control proc entry point6 ~6 }  O: O/ U2 t; {0 T( B
while running MeltICE.# Q3 _9 }6 e7 Z) S; ]

8 `0 Z; F6 r9 L5 w5 T& b
# W- a- U! W3 k' V8 B, c  00401067:  push      00402025    ; \\.\SICE
0 ]" y) J+ Q* k; c0 l& |  0040106C:  call      CreateFileA
( ]* `( s) q4 i4 L9 g  00401071:  cmp       eax,-001
5 V& k9 I; _% r0 w1 ]; G$ x  00401074:  je        00401091& B1 B) B3 q/ g  r- k
% Q* F6 i  ]6 r8 M, B: k

! }  n8 y: r$ V7 n& gThere could be hundreds of BPX you could use to detect this trick.: Q1 Y$ M: H% c. s
-The most classical one is:" o9 t- W8 n0 r. K& J3 ~! T: D
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||; f5 {7 \) x: t0 P% K* s
    *(esp-&gt;4+4)=='NTIC'
7 d, V. C# w  ~" W2 K6 Z
: }5 R- K7 w' {7 H; q-The most exotic ones (could be very slooooow :-(5 l% Q5 ^1 }3 p9 K$ ]0 v: H) `: A
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  1 f2 s( K  ~7 e2 E
     ;will break 3 times :-(+ s# h6 e  u" b5 k

! R9 @/ L  c  ^( p4 p" ?1 F-or (a bit) faster: 4 o: D9 T7 L- T) `2 P
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
  C. ~8 [" ~. v
5 c: A7 G3 d7 }3 i. O4 z   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  ; e, A" s3 L& O
     ;will break 3 times :-(
& D1 G+ [$ q3 V$ ]& T
! l" O# x) o: Q9 x-Much faster:7 U' C5 E& b/ N$ h* a6 ]
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV') r! B9 e+ Q/ L8 D

" {" |. X4 \" E$ b3 sNote also that some programs (like AZPR3.00) use de old 16-bit _lopen9 I  v9 B; g6 W2 F! v
function to do the same job:1 _' e: E8 @7 v1 h8 u6 I& E
% Y: R- c* z5 _2 B! Q- ]8 K
   push    00                        ; OF_READ. g# O( `1 X0 D
   mov     eax,[00656634]            ; '\\.\SICE',0& k4 Q( W5 f' b2 ]5 m# X; e. n
   push    eax
7 Z, C/ x5 |9 b4 a( v' _   call    KERNEL32!_lopen
+ R, F: _, |6 m% U, {5 G" P3 X   inc     eax
; B7 j# d( n. H   jnz     00650589                  ; detected
  q- d" o0 [3 [   push    00                        ; OF_READ/ v; T3 ]1 v6 J: ?. b( ?
   mov     eax,[00656638]            ; '\\.\SICE'5 {7 t' O( f8 ]: Q) ?: d2 w: o6 P
   push    eax0 Q! ~+ W# f# ?/ c& T
   call    KERNEL32!_lopen
0 u& ^$ m/ x' r2 B6 P  T   inc     eax, X( ?0 X) J& J) ]# ~% T  U
   jz      006505ae                  ; not detected* A% T9 v; D( B( S0 \7 g
, V( L# s& l; B
0 B" {  `* J) b: ]
__________________________________________________________________________; x! I3 Y* M8 ~* s. y& t

2 h4 u0 {8 i# [1 h6 D/ XMethod 12
4 p1 ~# J+ I! J=========
# `$ v% G7 i% S9 i; ]
+ X% U. U* X3 p0 _This trick is similar to int41h/4fh Debugger installation check (code 05: ?3 x0 ~5 ?7 e& ^1 h+ q
&amp; 06) but very limited because it's only available for Win95/98 (not NT)
8 y2 k+ }0 w& t) c8 H# g$ Sas it uses the VxDCall backdoor. This detection was found in Bleem Demo.  w$ \" C- z- |" B' I

& n4 W4 K2 \+ q  z% m* H, _   push  0000004fh         ; function 4fh
2 w6 g( C3 q9 q! _2 s- j7 p( b   push  002a002ah         ; high word specifies which VxD (VWIN32)
1 r7 z7 T+ I; c/ D                           ; low word specifies which service
/ }2 W: Z$ g& ^8 ~3 h. \" x: g8 e                             (VWIN32_Int41Dispatch)
& ^0 V% @- e$ R7 M# D   call  Kernel32!ORD_001  ; VxdCall
9 M; l" H3 _" |! x6 L   cmp   ax, 0f386h        ; magic number returned by system debuggers
) {0 q6 C6 ^, m, d( ~   jz    SoftICE_detected
+ k2 T0 d; d' l/ z
, A) Y+ |! }8 z' X  AHere again, several ways to detect it:6 ^! s- n( q3 F' s1 E7 W4 i

2 x# M' V$ `0 w2 B    BPINT 41 if ax==4f5 ~) m1 J2 n: N% Y5 \. U! H

' N) Z! d6 W) X5 h( H) I    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one' W4 r; ]5 J6 U, X( B
" D$ s% J7 D) C" g) ~
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A: E4 j; d; u% L. N3 s

% @: f: }- Q6 Q. f" |    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!4 x2 s+ t0 B& n
3 x( d9 ^; M, W/ r8 s, g; [
__________________________________________________________________________1 f6 z! Y$ W3 v1 R; t

1 h4 b' K- T4 l0 U  E/ RMethod 13: y; H5 j4 ~# c  |5 j
=========# M, {- X2 ]9 c% |3 h& `2 o

+ {3 x  @( w: B: R4 s  Z% ]& |Not a real method of detection, but a good way to know if SoftICE is
  x0 P* i( ?4 cinstalled on a computer and to locate its installation directory.
1 r4 m" u2 V$ l6 [. tIt is used by few softs which access the following registry keys (usually #2) :
% r& n* h. |: w5 x1 s3 T
+ o( d3 J, w  i, _0 ~  m6 p- ~-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion2 B; X, H; f  O5 h2 g9 U
\Uninstall\SoftICE
: a) B/ ?/ h+ O7 U5 J& G-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE6 ?! t+ X  F+ R! ?; Z" k
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion! O0 b6 B% @# E& G! J) r  C. v, `  O& m
\App Paths\Loader32.Exe
  Z3 J& x% @) T% x* m) R3 e/ [
9 ~/ F* i  N& m8 ?& a" a
! \( A) k" l& w6 y. [4 q; G: V4 SNote that some nasty apps could then erase all files from SoftICE directory) s8 Y4 F5 e1 y/ E; l$ t8 m
(I faced that once :-(
% C9 |3 b( Q8 [& z1 B/ S3 C. N' x0 H1 B, n0 u
Useful breakpoint to detect it:! n; a. D3 n* F8 m' \+ o& X
1 b6 n+ ?6 ^( S8 s4 l
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
% d  j' \$ N# O8 M" Y; e! N  F- ]. G
__________________________________________________________________________: r8 c8 n7 k! d4 G& ?5 k

. y6 Q- N1 m* b( E1 a
) K, C8 z& g/ Q1 AMethod 14
7 @6 p+ h* X% P% g=========* y5 b8 Y* X( b  ~

6 f/ D# t8 F' @# C' \. U: OA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
& T9 @9 Y6 m2 M, L: j: [is to determines whether a debugger is running on your system (ring0 only).
( t- b" Z6 u- u# c8 ?5 Y
3 }' e# X0 N& K& B   VMMCall Test_Debug_Installed
& [! @3 {% B7 _' ]8 m   je      not_installed
6 n# W$ \7 b; e% X2 C; s4 ?# }1 ~4 _( c0 ^, P' J. c0 q
This service just checks a flag.  R  S6 l" W+ b
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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