About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>' n& t6 E& p7 w& X
<TBODY>4 g9 m7 j2 S1 E$ Z) n) h7 a% X
<TR>
) j2 _( |" T; }# Y) N$ K<TD><PRE>Method 01
0 ]- Q- s. Q5 Q+ b. e=========, m4 t. ^' |$ @. I/ \$ d: o+ L9 Z. ?6 i
  ^+ f- y: B- w( d( X# d9 |
This method of detection of SoftICE (as well as the following one) is2 V1 u! K+ i7 M
used by the majority of packers/encryptors found on Internet.
; y+ |8 A$ p, j: n( ]It seeks the signature of BoundsChecker in SoftICE
( D( K3 {) ^% U7 E
# t" m6 y; c1 I% a0 l    mov     ebp, 04243484Bh        ; 'BCHK'" J; s# p  }2 Z) I" x4 p& ]
    mov     ax, 04h
7 O7 V/ x  f" s4 q    int     3       / c' j) y4 F- L) f6 I" i
    cmp     al,4" p9 c/ v( i  s/ ~- U
    jnz     SoftICE_Detected
3 d+ g4 c5 Z& l) {  \
: X2 y- u( r! x) O. \4 f___________________________________________________________________________
, e6 e, W% j/ k5 O' A/ Q: @, ?% I) ?) q" `
Method 02( m$ c2 N2 {' U4 M
=========4 b+ f' y3 D: s% y1 _6 U2 _
. K; j! ?4 q4 y+ h
Still a method very much used (perhaps the most frequent one).  It is used0 S% l( H; c3 t. z1 M
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,
' {3 j, y' ^5 |! }or execute SoftICE commands...
# I1 f: H! [7 J% B" AIt is also used to crash SoftICE and to force it to execute any commands
! A: h0 i+ d& L0 d1 m% ^(HBOOT...) :-((  
2 z3 r( h% t. S# C5 r4 D
" n  r, A+ @' N# o% ^/ D  g7 ]Here is a quick description:
; m" M  o2 `3 w5 z-AX = 0910h   (Display string in SIce windows)
! [$ X: x" d! p, I! _" E* x* o-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
+ O6 p  [. Z  q* P9 t( E0 N-AX = 0912h   (Get breakpoint infos)
1 N$ b6 c* `" R-AX = 0913h   (Set Sice breakpoints)4 r+ }1 X0 I0 u; f  o
-AX = 0914h   (Remove SIce breakoints)
  c! j5 Y, o# I* d- G! w# u9 s8 [( }  K# m3 K
Each time you'll meet this trick, you'll see:
. Q. \' r2 }1 \$ ^-SI = 4647h
2 T5 [7 w1 _+ ?" c! M+ J-DI = 4A4Dh4 s0 G/ j, t# w+ D9 E4 ~
Which are the 'magic values' used by SoftIce.# R$ u! T4 G+ q9 ]1 f
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.
" b2 x& A4 ?, f. O, t
/ d, t3 L1 n+ M; YHere is one example from the file "Haspinst.exe" which is the dongle HASP- q( R/ s. i# |5 x& @8 C' c
Envelope utility use to protect DOS applications:
* H7 C! ^, P! r: H) L
, O/ K" D) {0 a3 ~
6 T: j1 L+ c- r0 ?5 H8 {7 M4C19:0095   MOV    AX,0911  ; execute command.
" y6 q7 H5 B5 G7 j. j/ x4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).$ z+ B! G$ D8 K& d% R5 N
4C19:009A   MOV    SI,4647  ; 1st magic value.) I5 E- b# D2 p
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
1 Z. l& z% m; I* V/ V) V3 T. ^4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)6 x; h: R! u" D4 B# W
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
% d* j2 [2 y1 Z3 `( X4C19:00A4   INC    CX% d! s5 X8 L! s+ t" }  C; p9 G
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
0 }" L+ A+ _; Q- I: E; e; @4C19:00A8   JB     0095     ; 6 different commands.  t* @+ e8 {6 M+ j& I" s) y" J
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
* `0 z- [2 g. @  k$ A4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
3 F% U6 u7 f" s4 U8 e& p
  G* b: i3 z: c/ I$ VThe program will execute 6 different SIce commands located at ds:dx, which- `1 `9 ?( _$ P6 K+ s5 |0 c
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
8 o5 H7 e0 K# S7 @% U  R2 W: E, B3 [, N3 P7 ?/ E
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
3 N  i. t6 ?2 u) E1 T___________________________________________________________________________
* A' l# [$ C$ w0 [0 W0 M
7 I6 r8 C0 i* z$ W3 V4 H- t  d
; A% M4 j7 C; h, pMethod 03
1 ]' }6 V% D# z3 H=========
3 Q( R3 u# t  a! u+ q/ i, x7 f7 u& r9 G
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h# O( }3 y9 i  W; F/ d
(API Get entry point)
" z5 F' _3 n8 y/ X1 _8 {          f6 M2 a' b  A" F
0 o4 N: l0 v, i9 s  ^5 B1 H9 w' P
    xor     di,di8 J) B* ]6 `" Q: E; S
    mov     es,di2 O' R. j( C9 H% E$ m1 S$ ~
    mov     ax, 1684h       6 ^& r$ Q" O+ p2 b
    mov     bx, 0202h       ; VxD ID of winice
+ _( z5 W) L9 y7 L    int     2Fh
1 y: G) X; s1 p    mov     ax, es          ; ES:DI -&gt; VxD API entry point) r# U" n9 d, h- A" S$ Q2 j
    add     ax, di
) C2 O4 U+ T: O9 w1 I    test    ax,ax; z" T7 Q2 C( V7 K, x! i
    jnz     SoftICE_Detected/ q8 a. Y* b7 i8 V2 J
7 y# w/ C0 b) m
___________________________________________________________________________
. v) }$ U* R! r0 l% H2 ~: g. h! L, g) W* D
Method 04
( a) d7 E7 g9 X0 ?=========
2 d  `: A0 F& L7 X1 a- e$ X; g1 W' U0 f6 b
Method identical to the preceding one except that it seeks the ID of SoftICE
& b! R' G' H3 c& p; sGFX VxD.
8 m1 W7 y$ w3 }: Q$ J1 ?
& E4 I) I, e+ e; T. G    xor     di,di4 X7 A9 S: L5 K( ^. H- m4 O
    mov     es,di
8 z+ K- }: t* ]3 H, `    mov     ax, 1684h      
; {4 X3 t- b6 k9 T& L    mov     bx, 7a5Fh       ; VxD ID of SIWVID
4 |2 v) n; a- G3 d: ]( ^    int     2fh
0 G7 }7 J! R) E$ f    mov     ax, es          ; ES:DI -&gt; VxD API entry point% x) G4 W" c' p' w3 \8 t0 \
    add     ax, di
; B+ c6 s! |$ I5 ^  m1 I" g, Y- {0 _    test    ax,ax
/ @7 `3 C7 C0 ]. U: T" A7 ~    jnz     SoftICE_Detected8 e& F9 {- b0 U; g
  e1 g; c* ~. }. {9 v4 Z, l
__________________________________________________________________________/ W: |' n7 ^. i0 X
) P$ W- s8 t/ l! ~' [
9 b& ~! A& q  H6 _
Method 05
" V& E5 K% v" n& P=========* L+ \* q7 n0 i+ k$ ?, i
. k$ a) ~1 Z3 v2 e& H8 o
Method seeking the 'magic number' 0F386h returned (in ax) by all system. Y$ u4 s% [6 b* g+ u5 F9 ?! ^
debugger. It calls the int 41h, function 4Fh.
3 c& [2 m7 T3 U8 r4 Q& iThere are several alternatives.  6 v, H, A8 s/ f6 t* R* v

6 v! v; m" B5 V8 r( nThe following one is the simplest:
' n) L" f+ ?7 Z0 w; W) M3 v0 k  i; T" U
    mov     ax,4fh
7 z! a. s' N1 Q5 s& Z' G; R    int     41h7 H( s. z$ o% D( o4 @5 R
    cmp     ax, 0F386
+ `  b/ P5 H' d( Y    jz      SoftICE_detected8 q- t& y8 \* k! \( X2 R

- ]' ]- d$ i# ?% ]
& @% `$ P* I) W( m& Y5 k: @- b: |Next method as well as the following one are 2 examples from Stone's
: L" W5 k9 S6 d5 }9 U+ q) Q"stn-wid.zip" (www.cracking.net):
7 e, X5 c" q+ n/ c' z) h' d( \: n- s% Q2 a6 W# \/ Y
    mov     bx, cs
* E( M3 W1 y- x, t, K    lea     dx, int41handler2
. k6 S9 q1 k) T% B5 |    xchg    dx, es:[41h*4]( q# I2 |  M+ k* E. G  Q0 V
    xchg    bx, es:[41h*4+2]7 D' c: a0 i$ u( M" G: m
    mov     ax,4fh. M' V+ e0 W4 C* |
    int     41h2 y. W) M# l) R' `$ \$ |
    xchg    dx, es:[41h*4]- W; j! _8 T; q& c: ]* W
    xchg    bx, es:[41h*4+2]
4 w+ b" u. N: c' o7 g. h, ^    cmp     ax, 0f386h9 F0 `, G7 U0 b3 ]* e& `
    jz      SoftICE_detected  @: r9 l: ]  E3 h; W' \
* @8 U/ O- U1 ^3 k+ P% K
int41handler2 PROC
4 y, E+ r0 n. X* a: x    iret) k0 \. s9 `) j8 c, s5 u8 ~
int41handler2 ENDP
% u. x0 n( B$ s& X0 A5 A/ ^: E
- ], g" G2 m' c
- x; s: n, {9 X+ ?8 y& q, U! z_________________________________________________________________________
& f( r; E! s( P- s! h: |& @9 V" g0 }* l' ^

3 i; T4 y9 N+ T- ^3 A1 A* O3 MMethod 06
  R$ x- j1 h9 x: c: h=========
( R6 y& X. {0 Q+ i# _1 i
: h. c$ [! a7 _4 t0 |5 n7 d! \2 @; z1 A4 T" S1 X& F$ l
2nd method similar to the preceding one but more difficult to detect:
  x6 h& t' p. i; E6 _% |) w% x7 `5 ]" \1 k

! w- u+ L1 E" M0 N: i* J# gint41handler PROC
9 g- D/ f* n2 g4 r6 X' P  \! |    mov     cl,al/ }5 K9 [  \* [/ m7 k8 i5 b& d- O
    iret; i1 ?" N" ~* u& Q
int41handler ENDP
. D& N. `" _* E. b# C, m8 R9 e1 d& v7 j7 U% D9 }7 G8 R$ K) I. [
5 \9 X4 O4 a, g; c6 F
    xor     ax,ax! X0 E2 C/ O! Z& O3 B8 L* F# h8 H
    mov     es,ax+ a+ j7 k5 `& \- E) W
    mov     bx, cs
( W/ i: t- v8 \; c# \0 B" h    lea     dx, int41handler# |) |* N! V3 R- q: W
    xchg    dx, es:[41h*4]
# X4 }" w* t; l& E* }2 K    xchg    bx, es:[41h*4+2]
' ^, Y2 \3 D3 `    in      al, 40h
. M: ~. E" D8 ~5 u    xor     cx,cx
* Z' Y9 z/ y3 j* j6 A2 m7 K$ X; J) T( y    int     41h
; W, Z: z. }* p  D  ^" |" p    xchg    dx, es:[41h*4]
( S7 U; s9 U. b4 i; T' P    xchg    bx, es:[41h*4+2]
7 t, \# S9 |' {5 \    cmp     cl,al8 Q6 Q$ Q9 F8 `# ?! S: M+ \, T
    jnz     SoftICE_detected
7 ]4 N" i  ~) R5 }+ A
4 `( O! A# X& M# v$ I_________________________________________________________________________
4 t4 L. Y7 ]  `$ \+ n7 ]& H& N% S& O+ r) L8 i0 y
Method 075 A+ M0 n) h) Q* r6 N3 ^7 n- \
=========  B/ r9 ?+ Z! ]3 X
; j( h* G) ?- Z  U0 t7 i0 O7 o
Method of detection of the WinICE handler in the int68h (V86). ]  z5 b$ K" p' e

, a" u! s9 _/ k/ `( V' {    mov     ah,43h
' b7 Y7 U* D6 W    int     68h
5 K8 ^5 Z& `3 K    cmp     ax,0F386h
" T0 @! g* S3 L1 S; d9 {    jz      SoftICE_Detected$ e* V& i5 @: J, p$ o3 z0 h

. g, r/ s# }8 N$ ?0 n# R! _
$ n5 a' d3 P7 @=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit  C2 N; |  R9 Q8 ?7 d/ m; ~' G" k
   app like this:) @, [& v7 i3 r& F5 J! c
# z; w' c0 o  b
   BPX exec_int if ax==68
9 }9 {" I/ @7 i* n% ]   (function called is located at byte ptr [ebp+1Dh] and client eip is
, }" l8 S% O' f. y; E; P4 k   located at [ebp+48h] for 32Bit apps)& l' _  }& `& k# O
__________________________________________________________________________
- j/ t# x3 x6 ^, g) g+ T& ~1 ?. V3 S' [3 m8 ^" q- ?
( v1 N  M8 B- @. U  g' o
Method 08
! l% S" v& j, b4 E8 s=========
4 S* X3 D" V6 a2 d. ?
' m6 J3 Y) o( F. N2 r, I% M3 d! t# YIt is not a method of detection of SoftICE but a possibility to crash the
: r5 Y. _* K# G' H7 {system by intercepting int 01h and int 03h and redirecting them to another1 E, s5 D$ `1 Q' L/ z: H$ T0 y
routine.' n& l) r9 f# C" g1 D! g# I
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
" h) W8 k0 i* ?( L! ^& r- p+ nto the new routine to execute (hangs computer...)5 |  Q& u4 w2 B

. {: h0 T) ^# f/ r    mov     ah, 25h6 U, t9 B. @4 r) ^5 o/ {
    mov     al, Int_Number (01h or 03h)1 {! j: _1 }5 T: }9 e/ S# y* ]
    mov     dx, offset New_Int_Routine
+ ^. b( y2 U! ?) B, L) V    int     21h
4 O! l) n: ]4 F
+ w* t3 Q6 K9 `; C8 j9 {__________________________________________________________________________0 g3 Q* y& Y8 z! {8 Z% Z7 r1 }
# W( x7 e( d  i7 D
Method 09
/ F0 p, O0 P& ^8 Z% y=========
% T! R9 g6 x" U8 T! ~  _5 r9 R6 _! j* R  V6 w" m, k9 d3 {0 {
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only  R7 F) N3 v/ p/ e& U
performed in ring0 (VxD or a ring3 app using the VxdCall).
" [" N" I  n) v$ j% GThe Get_DDB service is used to determine whether or not a VxD is installed; h  i, Q1 |# x- Z* F
for the specified device and returns a Device Description Block (in ecx) for
3 H1 n/ g  Z7 m3 P- Rthat device if it is installed.1 l- ]% F+ q/ t& G: v, D

3 _, `- S! C- ~2 k- f   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID2 X1 d. t' e& h
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
- ]+ n! L0 S! w# G* ^9 T# `   VMMCall Get_DDB
* O4 V+ b) H% U1 b: u6 Y# Z   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
3 g! d1 I+ z( X1 Y! k8 t0 t- I9 Y1 [2 ?( Y, X, D$ W( D
Note as well that you can easily detect this method with SoftICE:& O" ?/ u( _7 y6 U
   bpx Get_DDB if ax==0202 || ax==7a5fh
" Z2 r! X5 j7 \+ `( u5 Q
. w( x9 m+ g* J( M3 v! w& N__________________________________________________________________________
  B; n- o5 b$ V7 `5 F% B8 Q3 I2 d" f$ Y; j1 B' ^* p4 j" q
Method 10
# Y) R; s  q4 S& D) |=========
8 @6 H. R# `+ Q4 d- i# S9 W$ o& ^, L3 a1 A2 i- S
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
& |3 ?& ~. o) N, j9 x0 m6 l4 G4 E  SoftICE while the option is enable!!, L- L9 P0 m6 j8 E0 W3 O+ P' p
5 A  j: G6 h" k
This trick is very efficient:2 n: t5 l- p3 c" m
by checking the Debug Registers, you can detect if SoftICE is loaded! V; u0 o9 Y9 Z2 c$ V5 L
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if' R$ p2 o1 b2 Y  G+ Q3 B
there are some memory breakpoints set (dr0 to dr3) simply by reading their
) ~2 J* ]+ }3 }9 o+ K  y6 }9 K6 Fvalue (in ring0 only). Values can be manipulated and or changed as well* g0 l+ B6 _; }. J8 A
(clearing BPMs for instance); `+ C$ M- d! j! G( @: R/ i) e( J" `

& A9 m9 ~3 F0 R4 c. V__________________________________________________________________________
, s0 y( r# f$ B/ u# i$ J7 x1 [
Method 11
. c; O% f5 V* T=========
; ^6 Q, a8 a7 x1 t3 _
# L4 e$ [9 k6 |7 u# r* oThis method is most known as 'MeltICE' because it has been freely distributed
' ^# e) I) H6 Vvia www.winfiles.com. However it was first used by NuMega people to allow4 `& s- y( ]/ B) h/ Q3 r" h1 i
Symbol Loader to check if SoftICE was active or not (the code is located* C0 ~4 X4 j( O
inside nmtrans.dll).. ~8 \7 \- T  N; U

( R. J% E/ z! o3 _The way it works is very simple:- q! Q7 k& _- S( e2 ~( ^
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
/ e+ F1 `- `8 p; K4 _+ J; jWinNT) with the CreateFileA API.+ v0 A7 {( C% k. c6 U" R1 N4 {

" g) z0 o0 J7 Q; [. K, U+ |Here is a sample (checking for 'SICE'):1 H* V0 g0 b+ W0 _+ m
# F9 V. V- g: T" l+ [9 l8 {
BOOL IsSoftIce95Loaded()
2 `; Z5 b* L9 F9 c4 E, Y{) ?& s' L  ?& f, e+ H; f+ i
   HANDLE hFile;  
) U$ o  v2 f. y" k/ V* t+ p   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
( |% K! c4 l+ \9 f' Z                      FILE_SHARE_READ | FILE_SHARE_WRITE,
% p' J% _# e5 G% F& {                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
) b/ L2 X& A% q/ r! e   if( hFile != INVALID_HANDLE_VALUE )0 l( F. y( X  h& z# U, x2 R, r7 \
   {& v5 {& o  A) |8 D% c3 z/ @
      CloseHandle(hFile);/ ~1 {8 s# p; S5 X% B
      return TRUE;) g* A6 ~: L+ Q/ {1 T
   }
( _2 r! _9 l* B/ l% |, d5 |/ A) U   return FALSE;: G* N% y4 n3 z5 N
}
: ^7 k( G. K; X) a  Z( j8 [( d. c2 j' w( H4 `( H
Although this trick calls the CreateFileA function, don't even expect to be' h- t* u0 ]; R' w
able to intercept it by installing a IFS hook: it will not work, no way!, G* S. p$ e( m* L  s7 j% ~* o+ O
In fact, after the call to CreateFileA it will get through VWIN32 0x001F6 C/ ~8 Y" ~. \6 |- u. w
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
( x4 V. R9 ?3 o" E' l/ ?and then browse the DDB list until it find the VxD and its DDB_Control_Proc8 N  V4 Z' e$ W4 T) Z
field.: J6 @3 S8 N* K! ]  G9 G$ H
In fact, its purpose is not to load/unload VxDs but only to send a
: ~# \/ G3 J1 U4 R+ ^W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
3 L- J" ?, y6 G. \% d# h; \! lto the VxD Control_Dispatch proc (how the hell a shareware soft could try, u* i" }$ ^! ~3 R, _7 K
to load/unload a non-dynamically loadable driver such as SoftICE ;-).
  u, s1 G* {. E; A% L4 LIf the VxD is loaded, it will always clear eax and the Carry flag to allow
1 T! _" P* H  Y. |- w! H+ Mits handle to be opened and then, will be detected., l- m0 Q% X' l+ i, f  o
You can check that simply by hooking Winice.exe control proc entry point- k0 S0 i2 D5 z
while running MeltICE.
& z$ X7 U, n/ s
# Y+ X3 S; Y& t$ P7 f% ^5 E( O6 m
  00401067:  push      00402025    ; \\.\SICE7 C1 X; A5 w5 ?
  0040106C:  call      CreateFileA6 P2 ~! X; t% o0 R6 V4 I
  00401071:  cmp       eax,-001
, X- a" ^! u. q% G, c6 @0 T  00401074:  je        00401091
) ~/ D4 r' X2 J5 ?! N0 E
7 k0 R2 ~9 M1 X$ c9 O, F* x5 }8 ~, ~* C- \+ ~' @
There could be hundreds of BPX you could use to detect this trick.
; C' l5 t! E" E: n" m; ?+ g-The most classical one is:3 U$ d% I3 U# A9 @3 f& r9 U% o( R
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||6 ?! c: c+ i0 c% `  C1 G5 i. g/ m, K
    *(esp-&gt;4+4)=='NTIC'1 e9 b, K: w5 \$ s5 y2 A! J) M# T: I

7 ?; f0 Q# y4 U7 n-The most exotic ones (could be very slooooow :-(
7 Y+ }" z% H+ K/ ?! k2 L+ C: J   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
4 i+ T  G$ F+ p4 J; }, ~- B# N, G     ;will break 3 times :-(
5 e* _8 o4 `: k' ~" Y9 G& d+ w
# U6 V9 i' O, Z& |" l) B$ [; p% f-or (a bit) faster:
2 [, |, t+ \6 G4 w$ q& @! O7 D" m   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')" v! x; e5 q7 x0 r; Y
6 L  o5 j! R0 d
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  # V0 e1 a) M  S9 |! B# Y. O2 I
     ;will break 3 times :-(/ O. S: U/ j' t6 v7 b

( P- C/ d% ~" c-Much faster:
" J2 H. J% Q7 \$ M7 w# M3 |   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'# W/ A% c& u# g$ S

( `3 t; V, q8 i' c. |Note also that some programs (like AZPR3.00) use de old 16-bit _lopen
- r/ Y" O$ [' G2 h& yfunction to do the same job:3 X% h3 K) n, h! G& ~

0 w& m1 h9 n: C# o   push    00                        ; OF_READ% G. E+ G$ `2 z
   mov     eax,[00656634]            ; '\\.\SICE',0
5 M$ o2 R4 L; \( X   push    eax" h6 C3 T& @8 T( s) k. P
   call    KERNEL32!_lopen
* F; P" M/ q$ c8 C5 g) W8 m   inc     eax
" R) s+ `" q4 L2 a0 Y   jnz     00650589                  ; detected+ Z/ }; Q% a' c# X9 P0 W
   push    00                        ; OF_READ/ Q% }5 R. r& \/ _7 C& S3 i- _
   mov     eax,[00656638]            ; '\\.\SICE'/ ]; C) ]9 k& E4 {: O+ C* j
   push    eax2 h( a* c9 l$ k! q# j( q; ]! O
   call    KERNEL32!_lopen
% s* }& e* B0 y6 k   inc     eax) f! k1 G9 G' ]8 B
   jz      006505ae                  ; not detected/ B2 c" a+ X. C" C; Y: \
! R' J# q& v0 g" H- Y0 ]/ @5 Z
. e* R. r1 X! O3 W* H* _
__________________________________________________________________________8 x: Q! [3 P; j- o9 P

' M; g& \. f- e8 rMethod 125 l/ e4 \; y/ O- C2 {; e% x
=========
% T( N- \9 z7 u" c' ~* q9 n/ L( ?
2 {/ L! }5 J0 M( u+ B/ uThis trick is similar to int41h/4fh Debugger installation check (code 056 g7 h& }' m' o' [
&amp; 06) but very limited because it's only available for Win95/98 (not NT)
; ]7 C9 G& n4 t. E9 ^as it uses the VxDCall backdoor. This detection was found in Bleem Demo.
2 n/ M8 c! B0 A$ V
/ V5 B' ~# H4 c$ _   push  0000004fh         ; function 4fh
8 i) K0 x6 w* c0 }9 p   push  002a002ah         ; high word specifies which VxD (VWIN32)
2 C9 A( W5 f7 d: ]: Y: c4 \* j' a. V                           ; low word specifies which service: y; k, N6 A. @3 c
                             (VWIN32_Int41Dispatch)' o1 e% d$ Q! K# q
   call  Kernel32!ORD_001  ; VxdCall
  A: e$ t! m& k. Q1 |8 B   cmp   ax, 0f386h        ; magic number returned by system debuggers) i7 D9 l/ p9 v
   jz    SoftICE_detected* I. o! {/ F  y# g5 c
: i; G% T4 f$ n  \& J% f
Here again, several ways to detect it:
% O. ^. q7 N, h* N
! `' s+ V. H- K* _+ a& ^    BPINT 41 if ax==4f. `; Y9 V1 z  k  Z

5 m- H5 }8 E( n! m- d, Z: i    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
0 ~0 i/ z# I7 w; M  B# P
$ k" F1 ?7 l( Z9 F+ P$ q    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A3 Y: t3 d# g' C8 r
. K2 H5 F( l! `
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!- U+ @& w; h' X: c+ z- W7 L

+ F$ Y1 J2 O# F7 O. J__________________________________________________________________________5 _; g0 i: m0 y# s8 h

: }" E5 h7 ]4 P. [Method 13& w' R( ]( Y* v$ x. [
=========  m$ O) M# m% i
2 c1 g+ x7 `- R% B7 n! I- Q, y
Not a real method of detection, but a good way to know if SoftICE is
0 \6 K& d8 D1 F/ f1 R5 tinstalled on a computer and to locate its installation directory.2 U3 |, i  j2 y% Q$ u. r/ R
It is used by few softs which access the following registry keys (usually #2) :
5 ?/ I3 O% _5 @) n1 A2 P$ |
- F: ]% ]  A5 h4 w3 `5 U$ h-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
1 y& H- h  b" _3 C* j\Uninstall\SoftICE
* l  j) i, [7 H* p& H+ B4 P-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE; ?: ^. ]5 L$ c7 y% f  ?
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
% z  S' H7 g* n\App Paths\Loader32.Exe
- @5 Z* D$ D' l+ u. F, G; P% h, X2 Z! G9 H2 M3 S/ i3 K+ z

8 C9 L' l. d5 `( I7 a* I2 hNote that some nasty apps could then erase all files from SoftICE directory
( }4 i7 a' P/ x(I faced that once :-(% P: s2 y1 S0 S; ?% {% T6 S& l
5 G2 v( x; w& y* P1 d. L) o: g
Useful breakpoint to detect it:
, T2 `3 m# Y# b+ _+ Y2 R$ z" _4 H; J8 n) t. Q6 W- r! t% I6 D: u
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
. K/ H$ G# C, |- j+ `5 w6 s
5 |/ D7 @& T7 T; ~__________________________________________________________________________$ L  e/ Z- [' [9 G7 E# _% k

+ m+ V- E* \. h+ q: V, f0 y0 V/ s+ k- ?' @' F6 n2 l
Method 14 - c' p: d* B! P" Y2 y
=========
4 B8 {; \* _+ \5 T; W+ q- D8 ?# [1 v; {3 a& e
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose+ j% Y7 J4 a* c1 R
is to determines whether a debugger is running on your system (ring0 only).: g( C, I- |- X" c8 L: W
" a# f) X  {# ?. z( o
   VMMCall Test_Debug_Installed
2 V+ P* A( g1 }, o, P1 A   je      not_installed
; x  q4 Z6 }  r7 N; N' K8 K5 K$ v, f7 B7 H; T
This service just checks a flag.8 @0 [8 P; m+ l6 B5 O3 k8 c5 n
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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