About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>! t6 t& F6 ]5 U) Q* a
<TBODY>0 E  Y9 M$ }/ A" `# N; ]
<TR>
3 L& Z/ K" ^" V# H  v5 h<TD><PRE>Method 01
, p7 z, V) _& j$ J=========
) S- ?: ]) B! a8 W- D9 P0 S6 K% S, T1 F- M+ g
This method of detection of SoftICE (as well as the following one) is6 Q* @; M! |2 |+ H
used by the majority of packers/encryptors found on Internet.) t9 J: p; V" C% N8 R
It seeks the signature of BoundsChecker in SoftICE7 s! y0 e0 U# U% Q0 N8 C1 p, u
2 t6 b! j& n; r+ @' _) [/ ^& ~! q
    mov     ebp, 04243484Bh        ; 'BCHK'0 M+ `, v7 _4 m: D+ x3 ?
    mov     ax, 04h
0 [1 \* ]+ K. Q* F- t# M    int     3       # z' J2 l, l$ P4 Y
    cmp     al,4) h: D. A' T- P$ }& C
    jnz     SoftICE_Detected
4 f. ?- ]/ j% c4 V$ K* E
& H$ }9 A# k9 O  A3 Y___________________________________________________________________________
" k  K& p" ?5 A5 N3 C1 e
- H& T/ Q; Q. K" k  x0 P+ Z- Y( UMethod 02+ K/ \0 R; K! F
=========
' k! G" s9 _3 \# I0 o' t  J$ y- M. `+ I) J) D0 `
Still a method very much used (perhaps the most frequent one).  It is used
; f# D4 R) A8 F$ e6 V0 Nto get SoftICE 'Back Door commands' which gives infos on Breakpoints,; Y( d# B$ n8 w9 H  I
or execute SoftICE commands...8 [" j- O* \5 ?4 n
It is also used to crash SoftICE and to force it to execute any commands
5 v: b) w( }* ?% F  u(HBOOT...) :-((  
: R" W. s; _, Y# h5 F9 Y! ~! d2 W0 M9 [9 K2 u$ s! q- K
Here is a quick description:$ [( e  M' O$ L- m2 Z
-AX = 0910h   (Display string in SIce windows)" n% x0 R! [! X1 F4 ~
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)! I9 q% H3 R7 c6 H. o  m/ E
-AX = 0912h   (Get breakpoint infos)
% g4 N# D6 W3 m  }-AX = 0913h   (Set Sice breakpoints)
+ U0 k# f! r% g0 r3 X-AX = 0914h   (Remove SIce breakoints); G- E; V3 @) |3 a! R
5 R$ Z+ }& _+ I# J
Each time you'll meet this trick, you'll see:( O: w5 Y1 B; A: y
-SI = 4647h
; ^# Q1 C" k4 V4 ?2 [8 z. `4 ~-DI = 4A4Dh
: g# w' R. \( A0 uWhich are the 'magic values' used by SoftIce.) `$ V  c  W8 t4 N$ `! d
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.% `, Z4 ^6 N9 g) z

) I; S7 F' f% A6 a% QHere is one example from the file "Haspinst.exe" which is the dongle HASP
2 d- M0 r+ w% d, x9 v0 E; MEnvelope utility use to protect DOS applications:- C  u- _, A$ b& [

# g# i/ x2 _9 ^( l) s# d  L
6 B; E3 I- X8 m. c4 t4 x1 j4C19:0095   MOV    AX,0911  ; execute command.
/ A& F( g/ _5 _% E8 Z& M4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).7 l0 B! w. H2 {/ W: K& t& [
4C19:009A   MOV    SI,4647  ; 1st magic value.9 L1 }- }7 ~$ w% I
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.: s3 Z9 w# E$ `: J- F" m' _
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
# ^; X8 o4 a" X/ `9 o4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute7 ^* P1 P2 W# `4 c# N
4C19:00A4   INC    CX
" p. F5 I' W( L+ d3 \4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
" E$ Y( O1 R; G2 O1 c* \4C19:00A8   JB     0095     ; 6 different commands.
4 l4 m  ]: T  P/ d# M# u2 q4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
3 U$ t# J0 K. t% Z. p' ~4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)" V0 h- v  u: `* ^, I0 ]
# I0 `% D8 O+ q
The program will execute 6 different SIce commands located at ds:dx, which" v) u3 a8 J6 N. ?$ U
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
( @1 R# G5 y$ v' l
# V, w! C( R" u  J* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
+ O6 Z: Y  p/ @" @+ k! ?3 v' W' }+ H___________________________________________________________________________1 `5 n# ?; |( d) D8 T$ y2 q
$ `9 @, Q+ y* e" t
* |( ~5 X9 v) c& P) V- U( k, C
Method 03
+ ]) N7 ]5 u/ W4 l' P2 q" }=========
5 G  B8 _+ R0 q9 M( }$ l( q+ K- L6 r0 V% k
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
5 X  y) p9 t( J; K(API Get entry point)
, v6 @8 Z: L$ K) ?        + a" ]6 i! p: O! e0 |' ^: `
8 `1 T+ W4 b: Z5 ^  Q7 v! n
    xor     di,di- Z, Y  `0 Q+ W( d% i) z0 U2 I
    mov     es,di; z$ d& \- T/ x, {; l; _
    mov     ax, 1684h      
) W; |  a8 f5 _    mov     bx, 0202h       ; VxD ID of winice6 b9 E' n, A* u( g- a& ?
    int     2Fh
4 T: q9 g% k- ]' c0 b    mov     ax, es          ; ES:DI -&gt; VxD API entry point
7 |5 {: V0 j7 L+ v% k3 Y    add     ax, di' m; z/ T! t! ^, y- w% n9 f0 j
    test    ax,ax7 ?" q8 S- k+ \. i2 d" D  m$ @
    jnz     SoftICE_Detected: C$ @+ z7 t. M& r7 e/ i% P8 ~

; E9 y3 Q6 u1 C$ D___________________________________________________________________________% P* V! r, l" I/ x# O5 l& ?2 a

) Z+ x8 W# S; M# b, {Method 04
/ a2 X/ W, }% {6 ]# |' j( V$ v=========' Q. e, R- ~2 @( e* u/ B4 z

6 z/ |; [+ ~0 B" rMethod identical to the preceding one except that it seeks the ID of SoftICE" q- P& U  s  y  x
GFX VxD.+ D3 K6 ]& r4 l% |

+ L* N8 f; O) ^0 {- [3 e8 W    xor     di,di
3 R) ~$ h; Q, `    mov     es,di
( m* M& w$ Y- y5 B& ~    mov     ax, 1684h       6 b# c4 j0 j; q9 H% }6 t4 {
    mov     bx, 7a5Fh       ; VxD ID of SIWVID8 C' m, |5 d  d# I, X- B5 Y
    int     2fh
; k8 Y3 }- h/ z+ H" v6 P! H" [    mov     ax, es          ; ES:DI -&gt; VxD API entry point
9 _4 N) e* ~) P1 i: s9 ~( s. m$ `    add     ax, di; P, g; n6 {! r0 l( T
    test    ax,ax, l) ^' g% B( @; V1 D7 d
    jnz     SoftICE_Detected
: @* K% c! R$ P7 ^
) e3 J8 {+ |1 {6 m9 q$ V+ X/ C: ^__________________________________________________________________________8 ~" Y/ m2 y! j$ {! ~- q

3 `' b# G6 l2 `! D8 H
8 O! U$ Q' @" ]2 DMethod 059 ]4 ]" k% i; x6 c
=========+ J/ e! d9 h" k' w5 [

# K) ?3 P4 Q! z  d1 p" {5 p: UMethod seeking the 'magic number' 0F386h returned (in ax) by all system
& g; d$ q. `2 o# B% N2 _, K# gdebugger. It calls the int 41h, function 4Fh.) Z1 U: B0 E4 \9 R0 j. _$ n8 T" d
There are several alternatives.  8 \  ]. v+ ^0 F! G( V4 V1 z
9 k; T! X% t/ q* L; S6 A9 ^6 B
The following one is the simplest:6 Y! y$ a; U! X$ C- H
' D) d5 `4 [2 f
    mov     ax,4fh! f& |5 ~; f8 M% n  {) |6 @
    int     41h
/ F: X" Y/ c: C% s4 n- ^; T    cmp     ax, 0F386
& f3 I: T8 G& f8 U% _    jz      SoftICE_detected. ?' @5 p) n- R) E  ?0 G

! Y" s  w0 h& Z. H( Z0 c- o( ]; t; V& ^0 x) H% |
Next method as well as the following one are 2 examples from Stone's
/ H0 I' c3 u) ^2 R, A# u, n1 J/ l"stn-wid.zip" (www.cracking.net):
+ b: w8 C: r( m1 I* b" q4 ~  p
9 z$ y5 ]7 ]; ]- F  w- I! v    mov     bx, cs/ J% f& L; d" x
    lea     dx, int41handler2
( L& ~( N' p5 F6 D7 d% D% z2 K    xchg    dx, es:[41h*4]
# R4 R9 M$ Q6 }; m    xchg    bx, es:[41h*4+2]
. C4 T3 r9 E) u7 T    mov     ax,4fh' ?  w( L" I( {% B+ \0 U, Q3 x/ p
    int     41h; J% \* `5 Z$ n$ s6 {2 I* r
    xchg    dx, es:[41h*4]
" @; _6 A2 m; `    xchg    bx, es:[41h*4+2], D5 F1 D& t* a6 ^
    cmp     ax, 0f386h
' ^* v+ J" `0 R8 q- O5 j    jz      SoftICE_detected
1 L) N" C& B$ g' r1 E8 N+ ~
, V, D2 p. s7 f! ?, Oint41handler2 PROC
6 N& T: p. v% r4 o7 q& L    iret
! u4 {) G5 u$ g/ _int41handler2 ENDP
! Q/ a# ^7 R4 F- o* R1 W
. T8 O* |% L' a" `) @
0 w, e' f. K# i' C$ V- F4 a. l& G_________________________________________________________________________+ m( O3 w( ^* y4 F- \4 Q, D

, C$ n- v* q$ z% Y) Y6 q  G' y* r4 ]; a! D* |7 E  U
Method 068 v2 Z  X4 {9 e
=========2 `0 p; [1 _8 ~8 g6 R
$ ^& R- }+ n/ D1 K' e) m

) M( `# F& _* g2nd method similar to the preceding one but more difficult to detect:' H6 e& ?( T' O8 l8 f7 I

" R2 z" F/ B! Y1 O6 O% E: x3 J! G/ a7 d2 G
int41handler PROC8 S2 m% A- D; X! w" ~. G9 B6 W
    mov     cl,al
  T  V+ ~" [) p: J    iret
- r1 T) S8 H% q8 ~& h- h, c9 Sint41handler ENDP
: C( W9 N8 F" {' p# Q1 z) T  u1 A" U+ l2 |3 [2 R" h

! W) t/ m, r: \& m    xor     ax,ax
2 C. U& y2 k1 k# k    mov     es,ax
9 [' {6 \! S' s3 d& q4 ~- L$ h$ J    mov     bx, cs
# u' j6 B2 o5 x7 V# ~" D8 F    lea     dx, int41handler
: b+ [5 @! e6 z( V5 Z    xchg    dx, es:[41h*4]# F0 N& D$ X% z. R& q
    xchg    bx, es:[41h*4+2]
$ ^  J, {, A: Y$ y8 g, w    in      al, 40h
' b" S  [( e4 _& h( v    xor     cx,cx/ H. ]% ^2 S8 B4 L3 T/ U* {& x8 U
    int     41h
9 V& O, X2 H) C: |    xchg    dx, es:[41h*4]# R7 C0 f  F. J" o0 ]
    xchg    bx, es:[41h*4+2]
1 u% [$ |' f2 b: \# K. B  b1 w! d7 b    cmp     cl,al
2 h0 i9 k7 \. K! z6 T8 ]9 J    jnz     SoftICE_detected
" n) u  @( V+ G
7 _* q3 P. L" e; X& ]_________________________________________________________________________) ?0 m3 F8 R& ~1 g$ p

  Q" o* _$ p1 ?( X' [Method 07  J* [3 p  g4 E/ T4 t
=========6 b+ p5 f' O7 o7 I" y. F# S, U8 U
- i3 s  i% d5 F4 o
Method of detection of the WinICE handler in the int68h (V86)1 w- V4 e! a6 b5 m

0 F6 H# b5 t% ~9 Y    mov     ah,43h; o9 D; X1 t, `
    int     68h
) I. ]. b6 W: \7 g* z& G" J    cmp     ax,0F386h0 s7 o' [+ ?9 g
    jz      SoftICE_Detected& v! |/ X" t1 V% f! F/ ^( C
: P9 T1 T; }# s. k5 h
& Q# L0 `5 P  \1 g( U: |- Q* @
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit4 n) W' M4 v! }$ F- I7 n  A
   app like this:' _4 O, M- W; S# Q, q9 u

5 \! N: H# K( T' x, s# j   BPX exec_int if ax==68
+ |* V* z9 P% i" k( j   (function called is located at byte ptr [ebp+1Dh] and client eip is
5 y* ?. t$ l: M) s   located at [ebp+48h] for 32Bit apps)
- K* u" ]& W, x__________________________________________________________________________+ n& r8 B; `" G0 e

* _# t9 w4 k. }' i( Q# ^
( i9 f% @4 x$ y3 S2 {Method 08
, f0 ^0 f0 \9 p& B# f1 x6 n. T=========( X1 F! t! S# N, J! u+ q

8 P6 C: f7 X2 a  N, |! B& UIt is not a method of detection of SoftICE but a possibility to crash the6 r9 v4 g! X5 [
system by intercepting int 01h and int 03h and redirecting them to another
& M9 f. S$ o# j! ?% Uroutine.
# I% y" R% y, K5 B2 RIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points/ Y5 ~7 f1 v# q) m2 d
to the new routine to execute (hangs computer...)
! B2 U8 M4 t5 s# [( E$ {# r; X
6 H& z3 y7 e" [0 A! V    mov     ah, 25h
7 \; a8 T2 Z* P2 M7 ?    mov     al, Int_Number (01h or 03h)8 e! z# G# A3 b5 M" u2 P# N* N
    mov     dx, offset New_Int_Routine
$ e* ~# `  l3 w1 b- |+ U4 X    int     21h0 B( u2 O* e9 M! I- [% S! C
* X, @! J# R% X; u$ F
__________________________________________________________________________
7 K. ^8 x! w! ?: s: x+ h: R  \
' i0 o" h* v# L8 _Method 09
2 T, g6 M& |/ k0 l6 S' P=========! r! w: c7 J$ u- n

" G1 X5 {! q- l# b! }& O2 jThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
+ v7 T7 K/ s1 operformed in ring0 (VxD or a ring3 app using the VxdCall).
( k! t0 b3 \; _& m5 _+ f8 @* r1 FThe Get_DDB service is used to determine whether or not a VxD is installed' w5 }: Z- {. A: N7 w" o. l. b
for the specified device and returns a Device Description Block (in ecx) for
+ Q( y( d  p& Z8 x7 M: p+ y' Jthat device if it is installed.. f0 S" t" M: a# v, @8 D7 k
9 u& P# ~0 n7 h  [- U5 Q! G
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID1 u# _) y- U* N+ A1 S4 o
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
, ^( Q5 H: x* I) W: V& w   VMMCall Get_DDB, X# F' Y+ C9 ]
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed: c" T: U9 c6 y  Q7 ^$ N

6 B2 R0 O5 g' Z6 H' I& y( ZNote as well that you can easily detect this method with SoftICE:: X4 h! R% H% t( B( Q
   bpx Get_DDB if ax==0202 || ax==7a5fh
- ?8 U8 y! H. e5 y' r1 A% M. \- E5 F% r* ^
__________________________________________________________________________
- N4 c* {3 d4 x9 G+ R) K
9 {! w3 J8 I$ e+ I& WMethod 10
* W5 i3 m5 v6 r! g% \=========8 e) i# C) T6 B; |

$ y# ~0 b- w4 Z& }=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with7 j. k, W1 F. n) D
  SoftICE while the option is enable!!
' j( d, N$ C; X5 ^& b
. Q; T! h% H: r  M5 Y/ mThis trick is very efficient:
+ G6 J* f8 U& B, Uby checking the Debug Registers, you can detect if SoftICE is loaded
0 r7 W. Q/ b, k3 @8 M) S9 |9 g& |/ ^(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
# P. A0 U: K! o7 D- k. V1 Lthere are some memory breakpoints set (dr0 to dr3) simply by reading their2 D/ h4 ]; P: ~
value (in ring0 only). Values can be manipulated and or changed as well
* j7 p: y0 u2 y" x/ N(clearing BPMs for instance)
% e) ^; Z+ `1 P% Z8 O
8 ]) ^5 F3 r- B6 z2 U7 A) v__________________________________________________________________________2 ^; K" K: m* @" ~- A6 Y3 v

: Y6 q! P, W9 A9 N  vMethod 111 N: u8 l/ @! \- C6 e; V: O7 S% @
=========
9 r% W& n' e5 {# \1 W/ H
2 X0 X* @, [5 Y9 ?; s# tThis method is most known as 'MeltICE' because it has been freely distributed& I; C) W" w+ G' q% ]) Z+ v9 `* b/ y% r
via www.winfiles.com. However it was first used by NuMega people to allow8 [. O6 y  Y, J6 ^) {9 h
Symbol Loader to check if SoftICE was active or not (the code is located/ V; m" |9 k4 ~, y1 k8 K- I
inside nmtrans.dll).
" R# [' H  Q2 }, r: h, v- L6 y2 r) L6 |
The way it works is very simple:
  ]3 N/ _7 I$ |, FIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
, }8 `$ N5 H8 v, x! AWinNT) with the CreateFileA API.
% B; B8 \7 n; D& Q
8 z" A6 G9 {$ aHere is a sample (checking for 'SICE'):6 X. C/ P+ c8 g# n% N$ a

" z. ]+ Q  e) ^, s  M0 jBOOL IsSoftIce95Loaded()  Y* c* L1 j0 [
{
( w) k4 |5 Y* ~) e3 }4 v   HANDLE hFile;  # A. W' Q; `& ^5 {0 e
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
7 Q/ O; {+ H& V) i; @* H                      FILE_SHARE_READ | FILE_SHARE_WRITE,1 R: {% P1 |" A
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);4 \# T7 D' p: Q4 H+ M: ^
   if( hFile != INVALID_HANDLE_VALUE )
2 M9 z& ~' C- b" @4 b   {
1 e4 N7 x' Z2 f: S5 V0 _) [      CloseHandle(hFile);7 z: n7 h8 F" G$ C# T( l- k
      return TRUE;
* X' }/ i. j& |. `0 _   }! e0 c: C  n# J7 Q' R' z
   return FALSE;
. K8 S; a' q0 ^( \}# N3 y( l4 t' k; w9 |

# I( z9 R9 K% g3 x4 @8 w( B  LAlthough this trick calls the CreateFileA function, don't even expect to be2 `; f6 E+ m: d$ A- t7 T2 ~
able to intercept it by installing a IFS hook: it will not work, no way!4 D: m; t$ y( |, V3 j
In fact, after the call to CreateFileA it will get through VWIN32 0x001F! J% w6 l4 Q& t
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)" B2 L( H9 a# N) {+ k  [7 h5 D, Z
and then browse the DDB list until it find the VxD and its DDB_Control_Proc' Z9 C) \9 V4 d) Z, z7 F
field.
& s9 T- _" j8 N( `9 dIn fact, its purpose is not to load/unload VxDs but only to send a ; O7 m8 ?8 N" F1 `
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
/ J# V) o, k6 ~7 Q' Nto the VxD Control_Dispatch proc (how the hell a shareware soft could try3 n4 j. o% r- V" ?$ G
to load/unload a non-dynamically loadable driver such as SoftICE ;-).' i& r: I* W! X3 F/ O# H
If the VxD is loaded, it will always clear eax and the Carry flag to allow
% i7 G/ Z5 R/ ?. b& Q6 {8 Iits handle to be opened and then, will be detected.0 {1 O" z1 T$ _
You can check that simply by hooking Winice.exe control proc entry point+ |9 F& c7 U! O5 g& R1 K
while running MeltICE.
- R# g6 \. l0 l, g0 L; s: }3 x% Z
6 ^/ t8 j# U9 y6 V
4 ?0 b+ Q( w- n$ }  00401067:  push      00402025    ; \\.\SICE3 d5 l7 N" j# X" X
  0040106C:  call      CreateFileA, G/ g/ ^' y- `8 L5 L& _
  00401071:  cmp       eax,-0011 n) O  }' x, L& c8 E3 u
  00401074:  je        00401091( c$ m9 ~9 |/ A1 Q' {$ T
  x9 r- q) _# v" e

7 U3 a+ b% M" D- r" HThere could be hundreds of BPX you could use to detect this trick.
1 R5 @  X- g% D6 N$ f) _0 E-The most classical one is:
$ X0 Y( y# k0 r5 K  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||; u" H- G5 l  D% @8 j) C
    *(esp-&gt;4+4)=='NTIC'% q, O4 y0 B/ f* o$ ~2 f
7 e, w0 b$ Y1 q& W% o
-The most exotic ones (could be very slooooow :-(
$ A, m  \+ B: P) v6 X   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  / A$ S6 ?# j  t8 k5 s" h' [: Z; I
     ;will break 3 times :-(; E5 m+ [  U0 X) u* q! Q

  ^: T; ~- Q6 f. f, ~/ Y3 S" {-or (a bit) faster: ! @) {& }' O1 Q2 @" B) \
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
7 x$ I( Z" Q/ o; N1 ]5 [: ]+ v& d$ ^" W8 z% p
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  6 a0 ?/ r5 b! R% m" j
     ;will break 3 times :-(, ?1 }2 v: g. l! T& J

, ?/ G% ]# [& J& M-Much faster:* w3 h  j/ d2 ]0 a1 E
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
5 @7 g+ ~$ ]6 I" |" ]" c; R: M) C# M2 @) C( l
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen
/ j6 b! S8 G  f: t1 H; i0 n8 ufunction to do the same job:
" C; i, I7 M1 e, c
, D! Y& p9 I' A1 S" q   push    00                        ; OF_READ
0 g$ _. y5 ]) W4 J! ]   mov     eax,[00656634]            ; '\\.\SICE',0  X: {6 e" V0 W. ^+ N4 f( x- V" D
   push    eax
9 o4 ]% d) U( y6 G   call    KERNEL32!_lopen  g9 O# }& g& d2 [. |
   inc     eax
0 |# ^6 K: H3 t$ c+ P" w   jnz     00650589                  ; detected& o- c% j: ?! Q% J* k5 o- y, ]6 R
   push    00                        ; OF_READ
0 E: T. U- T( P6 ]& \3 V0 C: i. D. X   mov     eax,[00656638]            ; '\\.\SICE'  s$ z' Z: w( l2 [9 k
   push    eax- p5 E; t, z+ n7 h
   call    KERNEL32!_lopen
4 s: }, h: K: I, B/ D8 M. z& m8 p   inc     eax
3 N6 y! Z! C* U/ z   jz      006505ae                  ; not detected/ @$ Z. ?! V6 \7 I# K$ l5 r
6 X2 m4 U) W3 c0 z7 }; T
8 ?% v% T" k& O& c
__________________________________________________________________________
. C8 U: C: N; q! r; @- e& d0 n: c1 N
Method 12
1 |; R, o2 [, W/ b=========) a$ G% A4 l+ n- I# G; L  X
$ {$ b4 c  s3 D5 D/ h+ K
This trick is similar to int41h/4fh Debugger installation check (code 05) v* C6 K1 V, F
&amp; 06) but very limited because it's only available for Win95/98 (not NT)! ]1 S4 N6 \4 Z3 q
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.
4 ~8 W, k: E- M: c# G3 M' B# p9 m. Q  |5 \0 {
   push  0000004fh         ; function 4fh1 G- u6 L* X. b, @3 }* ~# {5 \
   push  002a002ah         ; high word specifies which VxD (VWIN32)& ?# H- \, O) Y/ [1 j* W/ K) E, y
                           ; low word specifies which service3 L3 F. Z0 Z, s0 I' z) y8 _
                             (VWIN32_Int41Dispatch)
7 l7 m: n: j9 s   call  Kernel32!ORD_001  ; VxdCall  u, g/ \6 q* F8 c6 Y0 ]
   cmp   ax, 0f386h        ; magic number returned by system debuggers
, U4 v6 G: p$ p   jz    SoftICE_detected; |+ P& W4 P. m0 t6 S( ]
( Z; ?9 y+ C; q: b
Here again, several ways to detect it:* k4 Z2 X) ]# i2 }, Z
$ K- [1 V! q# b, X
    BPINT 41 if ax==4f
* U4 P+ T+ w( Z& I" `
+ v1 h8 g) v/ X2 j6 b    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one# ~: E/ b) {; A! t' J8 R. ]

" ~1 U# c& v8 f    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
4 K+ W! Y4 G$ u) T7 v% a' z0 ?: x# r% e- ?, e6 U
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!% v4 p$ e$ j1 b7 B6 y9 `# B

+ v: z4 E" E) u9 j7 i; t, e. F__________________________________________________________________________0 o4 L2 D+ v, S, ], V
2 l& X% I9 C- |. ?2 s" U
Method 131 C) P7 A4 P: E/ p/ {
=========
, o6 h4 `6 e  g- ?  ]/ M9 u  ?- h4 K3 L
Not a real method of detection, but a good way to know if SoftICE is
! R0 a6 \9 _4 y  N) Tinstalled on a computer and to locate its installation directory.
6 M" `4 h+ t# f+ n3 l" z, jIt is used by few softs which access the following registry keys (usually #2) :5 \; P' B* {$ I, K: F

& b4 D4 U8 |* L  v4 f-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
0 O9 Y; V( n/ p/ a\Uninstall\SoftICE
6 r% D2 I& G5 R+ W5 p( }-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
0 u9 p) z8 O; s3 j: c. g* t  I-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
5 C/ `. Y$ }0 J) y\App Paths\Loader32.Exe
8 @0 L" N* ^' Q% q8 e
0 E* n0 d: E1 n$ l9 S" z) X( X' Q6 x4 {" u' F3 h5 v0 [
Note that some nasty apps could then erase all files from SoftICE directory1 f2 N: R4 o4 E3 G8 W- O- h  L
(I faced that once :-(' H6 h/ L/ \5 }  R
  L0 C$ _( a9 ?* L* o
Useful breakpoint to detect it:
& H& r. y7 m6 E$ I- m. F* |7 p0 B! ]: h3 Y1 U
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
) M5 |9 V- T; H! M- q& `" t+ p" s8 `# }- b- e- X, k
__________________________________________________________________________
+ L! ]1 X8 C1 {( j
0 {; P) f) n3 s, k% l0 e3 t
; l  n( C# g' |9 v5 r5 tMethod 14
& J; K2 i! Y  N& H=========$ [) q, n# J) r' S6 Q/ q' h
9 b3 `! g; p) `2 G: M8 H
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
( D9 w  G7 d. e; \0 U6 Lis to determines whether a debugger is running on your system (ring0 only).4 |7 \0 F* h+ G% b
5 L% N. i. M5 K8 K' e4 L: C, _
   VMMCall Test_Debug_Installed
# y$ v1 D/ k6 R, W   je      not_installed% W, I1 A* v6 f" c" h! z

" ?2 `" b- X6 e, a2 H. K3 eThis service just checks a flag.' _3 _  E/ q5 \9 j
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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