找回密码
 注册

QQ登录

只需一步,快速开始

About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>; c4 l8 p& d. R# g) m3 t: c1 u
<TBODY>9 z: D. c4 O1 _& C
<TR>
1 b0 l' h. }% C6 M<TD><PRE>Method 01 : t9 @% S2 L/ G4 O( F
=========6 C  R  ~) z. p& Y

0 ?/ q# I0 `$ TThis method of detection of SoftICE (as well as the following one) is
/ r( s! S) H! E2 j6 D, lused by the majority of packers/encryptors found on Internet.
$ b' D2 i2 l1 B8 x) j6 v7 HIt seeks the signature of BoundsChecker in SoftICE
/ x# C7 B* V% P4 M4 N7 A9 c6 T% E( m. d; ]. M5 o- h' t/ o& [
    mov     ebp, 04243484Bh        ; 'BCHK'. S2 V7 f; o& n5 n2 n4 K4 V
    mov     ax, 04h
9 K+ ^0 C( Y7 K    int     3       6 D0 I  i7 T0 l5 C2 \" h
    cmp     al,4" Q5 T8 ]; [8 t4 J1 |" T& Z/ q% r
    jnz     SoftICE_Detected
$ t: H% o) n% }( |0 a
5 F) E: e$ c& m; v& u___________________________________________________________________________& b1 x# X5 ~1 t% @& y! q8 q! W* C

. S# {2 U( k& f9 O7 r" V" \Method 02
8 V' l: x! X1 D' R=========( I6 _7 a3 t2 @; u+ G: q- ^. {

$ V% S# S5 [. ]; [0 kStill a method very much used (perhaps the most frequent one).  It is used
( k6 n2 }$ I6 V3 ?% B! Lto get SoftICE 'Back Door commands' which gives infos on Breakpoints,
7 ?& ]" w, V1 \1 W9 j+ X( @; Yor execute SoftICE commands...0 \* B2 ?$ Q3 K. K1 R
It is also used to crash SoftICE and to force it to execute any commands5 ~- k) [! |2 f- L0 J2 V4 T
(HBOOT...) :-((  1 [7 V2 V+ Y, ^
) a" r' J1 B$ ^
Here is a quick description:
( ~! G! Z$ b$ p& c  i-AX = 0910h   (Display string in SIce windows)5 `. Z3 z8 u6 c1 j
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)9 G* d1 l8 O; a+ W7 W
-AX = 0912h   (Get breakpoint infos)! o( h" v" I; ~( _1 g
-AX = 0913h   (Set Sice breakpoints)* R- M: J8 n7 p0 i! j
-AX = 0914h   (Remove SIce breakoints)% g+ H/ q& z2 C& `4 v
+ K7 J6 t" E: M+ R. `9 b9 t
Each time you'll meet this trick, you'll see:5 F% N' b( j' u. Q9 h9 j  _; e. b* X
-SI = 4647h
3 O+ R/ s) j9 v-DI = 4A4Dh7 U# p3 l* k) E
Which are the 'magic values' used by SoftIce.
2 q( z. e8 P3 d6 t" HFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.
. `- J  @3 a( [9 o; x* j
! M9 E! z) D7 {Here is one example from the file "Haspinst.exe" which is the dongle HASP! K; a* I; O. V& C$ o* {8 C0 U; @
Envelope utility use to protect DOS applications:; k' W" a( O: l( ]+ h7 w% D. A
& B/ Z2 ^$ L5 {6 r  A- y

7 t$ g8 D" x% {+ W. v4C19:0095   MOV    AX,0911  ; execute command.3 f* e! Q/ p7 S0 s& X# [! l
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).* ?) S" i# i9 n- D( h! l$ x
4C19:009A   MOV    SI,4647  ; 1st magic value.( d7 f4 h7 Z7 Y( M3 \+ Q
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.5 v7 p  K& i4 [2 D7 d: O
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
  F3 J! o- G/ j2 r% a. i4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute( W$ i# U# Z) p$ e. Q$ I8 D
4C19:00A4   INC    CX6 {8 L' H) f' ?5 C$ v  n9 @, l
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
$ c7 ]6 t6 ~$ k1 O0 R4C19:00A8   JB     0095     ; 6 different commands.  ~7 r- j+ W# a7 A- S
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
- A# ^8 s+ F7 J4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
4 p! x, d# g$ T- p0 a. {2 L. w  _" c) W5 g
The program will execute 6 different SIce commands located at ds:dx, which$ t! V4 x9 j# v2 F9 z' _+ K! s, w
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
$ S$ u8 j; z' E& M# C5 B1 Y
" w; k7 R* u" S; F# U* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded., ~) x" v3 Y5 B1 B: G2 X
___________________________________________________________________________
& S# r- l' M4 ?
; n( N! P: A) d/ B+ W0 e) k
( t2 f; J. v/ s' d1 ~( D# DMethod 03$ f2 G; J, F) V; J8 d* j$ j5 ?! v0 [
=========
. B& m6 p$ ]2 [, o" l- I
7 g" m! s& o# x. l/ JLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h' j) D0 f8 k( ~
(API Get entry point)" I8 u7 v: h& |* K$ f7 W( T
        ) n7 Y8 k' ^: _. C7 `

# @2 W2 M' {( C) j9 ]    xor     di,di
" w5 O2 L$ r1 g: l/ U    mov     es,di
8 j: ^  s$ x( q# b, W1 c    mov     ax, 1684h      
8 G5 t" D4 G; Y! j. y    mov     bx, 0202h       ; VxD ID of winice
0 k. Y& a! O, q9 ~" r    int     2Fh  E3 F8 Q* V* Q: S2 {! X
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
& Z. O) Q$ F5 F    add     ax, di
0 k& R- G# Y& X; z- \- M    test    ax,ax) O/ Y3 z$ J. b+ q7 r: o: p0 d
    jnz     SoftICE_Detected  L6 F* O2 I; x" `" T' Y
6 f# Q! Z2 M- R$ m! x, H5 G
___________________________________________________________________________
: k1 i; a5 U* u" I3 f9 i3 |. h, Y: _3 v& e
Method 04: [) }9 w# w% _# Z5 ~' T
=========
1 }7 F4 h6 A! M; ]& x! `, o5 j, ~; D, Y
Method identical to the preceding one except that it seeks the ID of SoftICE. j: N/ u: t6 m4 e! E# |
GFX VxD.% P" u+ x; d& }( O3 E

0 q$ h4 `; s6 K, j% ~" y" }    xor     di,di+ c+ a2 A8 K0 p$ U
    mov     es,di% U8 X4 M, j1 V1 s
    mov     ax, 1684h       # I5 K& |' t! h3 E& x0 |
    mov     bx, 7a5Fh       ; VxD ID of SIWVID8 L+ Y# C. S; Z& J  |& G2 U. k$ Z
    int     2fh+ e. n8 U' n$ `, H  C
    mov     ax, es          ; ES:DI -&gt; VxD API entry point$ P( [/ u6 p9 b" X, H0 P
    add     ax, di# r3 E4 a4 t& G! r* ?
    test    ax,ax
1 o3 {( e7 z% L3 z9 c8 I  ~" }2 I' h    jnz     SoftICE_Detected
) y- z( H# m5 Q) K" s7 N( F( t9 ~% E; \
__________________________________________________________________________
# [: [$ E1 n9 b5 ?& u+ `1 t; K% D/ `9 O' r
( |( {+ L1 _$ G6 f' S9 ?
Method 05
# e( R9 ^4 M) `# M) m=========, j' J8 w$ v) X
% ?* k' R4 ~' @# Y
Method seeking the 'magic number' 0F386h returned (in ax) by all system
4 O) F9 |7 K& v) _8 g5 ~debugger. It calls the int 41h, function 4Fh.2 I" Q) ]. ]. ^/ C$ D9 _
There are several alternatives.    e- w; n. O* s5 P$ n0 O

$ V* U! Y. y: ]& yThe following one is the simplest:
7 R9 _+ ~& G; q+ _' O* b2 @% r* a3 O9 M+ o9 H3 c6 A4 X
    mov     ax,4fh
5 V2 ~0 S  S* O) S% o# `0 B    int     41h
. c4 [1 a% a8 J  s* N6 d    cmp     ax, 0F386
" v7 w) u1 @& a' z& l7 A    jz      SoftICE_detected
! ?9 P* x* r3 f/ m3 h% v' Q' H$ ]- e3 P- C9 L
. g. ~+ J& r! n' \  G! P: T
Next method as well as the following one are 2 examples from Stone's 6 ]& V' S" U% w+ X1 C7 d$ q) E9 T
"stn-wid.zip" (www.cracking.net):4 m. }' f# `& |; p0 d( A
. W; G; A$ V0 E" L0 i
    mov     bx, cs
' Q" B4 Q0 k# u' @* P) a    lea     dx, int41handler2
7 z9 \  W# v- U0 |" q1 G    xchg    dx, es:[41h*4]
* ]: A! Y1 T, N* s: X" n1 q. D( N    xchg    bx, es:[41h*4+2]) \0 v" s5 T/ z, `4 w
    mov     ax,4fh2 |- S+ ~- _( w2 u
    int     41h
0 f1 J/ @% r, f. O1 o7 ?0 g    xchg    dx, es:[41h*4]( B9 n' M5 `+ K/ K' Z2 q
    xchg    bx, es:[41h*4+2]: H" t/ x8 l4 J0 w! S9 {( c8 M: R
    cmp     ax, 0f386h0 T5 l- t, u3 F+ P0 R( i8 @; {
    jz      SoftICE_detected( S1 n- B1 m* E; m  R. }/ W9 z
: L! Q# D' a! C1 J5 [3 ^
int41handler2 PROC
% X3 ?' n$ Q0 ~3 H9 @    iret
0 Z, u, V* L$ I7 j+ rint41handler2 ENDP
% J. ?0 s5 I- |$ Y& h
$ p& `2 P% {! o! m1 Y1 S- Z4 m2 {  V1 Y  a( ?. q' g6 K, b
_________________________________________________________________________7 B: d" h* G6 J! l. w' Z0 Y
  E' z& Z( v5 I

: ?9 J- e, U1 z2 E5 `: T6 WMethod 06: T' O, `, q' t3 X8 w( V
=========
0 ?3 [# l* l  C: ?9 L" J, q! `+ C6 o- {: I" r. W
; c& x+ y% L: g7 _# \6 l9 U5 X2 D( a
2nd method similar to the preceding one but more difficult to detect:4 G0 W- E; X" i! f/ T2 X
: e' A/ D  n6 _' M) k9 `
9 B  \9 ~8 p, A4 G
int41handler PROC6 k) k9 [5 C  B7 D
    mov     cl,al  s- p- K) u; W6 S
    iret# X& k+ J6 y7 n2 l- Q9 D, l8 O
int41handler ENDP
5 }8 x9 T' \9 ?$ v8 J: ?9 Q
  A+ a/ y" K0 o
7 W7 K9 F2 Y* g    xor     ax,ax! z0 d, I& e; i. [' |
    mov     es,ax4 n1 |( W' n" Y, c2 L6 M! X) {
    mov     bx, cs
/ t; m+ [% J* U4 A+ f) t7 t    lea     dx, int41handler8 p$ Q  }, _& u' J
    xchg    dx, es:[41h*4]
% y8 O' l4 s5 T. k    xchg    bx, es:[41h*4+2]
8 n, Q8 g+ C" d& x) z9 B5 n    in      al, 40h. H! n) x- [7 _1 i; K, p9 F! f0 A
    xor     cx,cx
. a) ]. d; `1 M9 D, R" M    int     41h2 u& x, t0 V' x/ \: r8 k
    xchg    dx, es:[41h*4]
; i3 Q. e2 H: f  d$ z1 ?* ^: `    xchg    bx, es:[41h*4+2]- l, z( s3 o0 D* [3 o& t
    cmp     cl,al
3 i$ G3 s& e. S* T4 o% l3 c    jnz     SoftICE_detected( w5 S9 h- p6 P
3 ?4 `- j) x: r' B3 `" i) a
_________________________________________________________________________: \& Y9 s) |& j4 w5 q6 }
( I- B* s6 c5 e- r
Method 07
6 ^. f5 P) f! Y* A2 u1 g4 d=========
' B+ x0 Y9 q$ `' L; j. d0 N: r2 k( v* _. t8 v4 B* i9 {
Method of detection of the WinICE handler in the int68h (V86)
3 ?( B+ Y+ h4 a6 y0 W7 l8 B' c, h- S; y3 G  ^$ ?
    mov     ah,43h
# w' Q0 C4 _8 N& a    int     68h
4 O+ @/ v$ @+ Y) d- T5 Y! y    cmp     ax,0F386h' M; Y8 c/ o1 c( X  e1 \% ^
    jz      SoftICE_Detected
; O+ k' O  x9 w0 S+ w; ]/ T- E0 b& o6 g
8 {7 [2 m  g8 v. c" x; Y% s
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit: e: {! q8 n, I
   app like this:! \7 K" G* F2 g& K, P

2 H1 c+ Z; w. Z   BPX exec_int if ax==68$ _' p) h3 s, k8 ~2 n
   (function called is located at byte ptr [ebp+1Dh] and client eip is" Y" v$ k; ]! v4 z( I$ Q! _  q
   located at [ebp+48h] for 32Bit apps)
- G* ~$ G7 B. W2 a% f1 D__________________________________________________________________________2 j: ~) A: y" i" R$ b7 p! N( [
7 U- X4 y; ?4 O& d2 R. U& P, ^
4 g5 {. g9 G6 z# t, l8 H2 a# Q
Method 08
+ q# W9 X; x5 Y2 N=========
+ X/ d4 U& x3 H1 P, |$ D+ f5 I6 i4 L) T: p) O+ Z( e: ^- Z
It is not a method of detection of SoftICE but a possibility to crash the& X2 H6 k9 X: d) J+ f1 C
system by intercepting int 01h and int 03h and redirecting them to another" C( I% Y% V% R0 a8 d' G! _
routine." h: ?# j* Q2 O+ U) A
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points# [) f, I' Q* s* j
to the new routine to execute (hangs computer...)4 z8 k  [0 ~( y

7 a7 l, T0 o  e- I3 ~; L  a% a    mov     ah, 25h
7 u" P; b( j3 N8 E4 o    mov     al, Int_Number (01h or 03h)
/ Q7 G# [* i# D    mov     dx, offset New_Int_Routine
- j; ?( K9 U7 ~3 p5 b    int     21h' `7 q* E1 [2 Y9 H
, c0 l, E3 g. N4 v  V
__________________________________________________________________________
' |+ W- I* q0 p. M5 n7 q, @+ r9 r- B+ Z: ^5 K
Method 09
6 X3 f+ v! q' k$ }0 b0 T=========
7 {. i0 w3 {1 O8 J! H" T4 i. q' I7 O0 J' Z! g0 v
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only1 ~, ?) ]: u' O
performed in ring0 (VxD or a ring3 app using the VxdCall)., F% A/ s- U9 z  j( ]5 D$ }$ h
The Get_DDB service is used to determine whether or not a VxD is installed
; V3 k( |% j3 @2 d, f! Mfor the specified device and returns a Device Description Block (in ecx) for
, k) U) j% W) c# b2 I( H0 jthat device if it is installed.
" b* l/ u' N/ ~4 f9 b8 |/ [5 o. a/ U
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID( ]/ y. y3 H6 I* z9 [
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)- k" a* z  h7 [: o; _1 v
   VMMCall Get_DDB" E* y. {5 {  U' ]$ J
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
9 U) {' e1 j. A- O
9 \" a4 u( l0 b# tNote as well that you can easily detect this method with SoftICE:; u  o0 D1 r$ W8 Y6 W8 G' ~! F
   bpx Get_DDB if ax==0202 || ax==7a5fh& N5 P% E0 ]9 z, V
. D- i+ B6 T& E! M
__________________________________________________________________________" T4 s2 p- `1 V0 Z2 ]7 o4 s" V

# Q: G9 s2 j3 `6 `* kMethod 10
7 f( y+ ^9 \7 n/ n4 G=========
/ B1 J5 k7 N! D) M. ^2 o% L! W7 D* {% b6 o" X% W6 c
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with# v, o+ t" n- {' d9 l8 f# P$ z
  SoftICE while the option is enable!!3 g" Z# ^3 w5 k
- l7 Q5 f- T, I2 n8 y1 x
This trick is very efficient:  I% H5 k- {5 ]; N
by checking the Debug Registers, you can detect if SoftICE is loaded  S( _7 m' a7 S! T8 b) O; a
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if0 z& G$ q) P1 b- V# a: ^. G$ i
there are some memory breakpoints set (dr0 to dr3) simply by reading their
5 t9 g) @+ A: n, [( svalue (in ring0 only). Values can be manipulated and or changed as well5 I! A' k( M# I% Y5 v/ V1 E. @# o9 @
(clearing BPMs for instance)- r0 l5 }1 t$ A, e

1 C3 \, }0 k! j__________________________________________________________________________# k# s: j. p! V' K" K
1 _% b8 q, L( l0 }" X
Method 11) D" X' F' d. \+ e% C1 `" ?6 R, k6 {( B6 V
=========
) r9 P( d9 W! d- F0 M' T. V8 J: X- _1 X
1 ?2 Z5 T  I8 M/ ?% ^5 ^$ b- A7 WThis method is most known as 'MeltICE' because it has been freely distributed
) i3 J. `1 ~& H; E) V! tvia www.winfiles.com. However it was first used by NuMega people to allow
& h% J- M* X  ~) m8 bSymbol Loader to check if SoftICE was active or not (the code is located
, Y  T2 r4 E/ Q7 _' `5 Rinside nmtrans.dll).
" u6 \: ^4 c. o  K3 I- j
3 N& y1 a: B% y% Y' vThe way it works is very simple:
( Y! m8 ~) v8 {0 w- N( G- ^It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
6 E3 J/ E# U# XWinNT) with the CreateFileA API.
& M2 A* ~) D5 t  d0 b6 U& s6 m# U
Here is a sample (checking for 'SICE'):- w2 t7 `& \2 p' d/ Z% f' Y  H
% v4 n3 M( `% }
BOOL IsSoftIce95Loaded()" B# ^( h4 d: m6 k% r: Z, |' S0 `1 f( ]
{; g/ Y) B& i0 V5 E
   HANDLE hFile;  
& s/ M/ z2 a3 Z0 O$ n   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,; l4 U* a7 E+ K7 O0 o
                      FILE_SHARE_READ | FILE_SHARE_WRITE,
0 }0 z, a# V. O2 H1 G                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);' @4 q; v2 H6 F: q# o/ p4 T" V
   if( hFile != INVALID_HANDLE_VALUE )( W- d0 B4 O- {9 L+ o/ u3 o/ o+ X! {
   {
$ r9 u2 ]0 E, C: z1 w      CloseHandle(hFile);+ M& |+ ?  y* y  R5 h3 L" h5 N
      return TRUE;
( q5 @2 i9 g* n3 a  ~- C   }& f' y5 d4 c; O6 y5 T) i* \( J6 K
   return FALSE;
% e3 V: O9 }& f+ A0 g- @( v* ?}
, [6 M, ]& Z2 c. O6 V4 W! @! z1 |% }" ]- j0 }3 G% Q  ]
Although this trick calls the CreateFileA function, don't even expect to be
( O: B; u( H/ K5 @" i+ t/ mable to intercept it by installing a IFS hook: it will not work, no way!
: {* L7 Z  }+ T- D3 rIn fact, after the call to CreateFileA it will get through VWIN32 0x001F  k/ s, n0 {) W* L
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function). e$ Y/ v' b9 p9 `7 c. N
and then browse the DDB list until it find the VxD and its DDB_Control_Proc; W1 {- L9 P6 C
field.: X0 I0 k5 P& {( t, F1 m
In fact, its purpose is not to load/unload VxDs but only to send a # f! g% e; F' q7 _! }. w5 W* n
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)6 Y; j/ {; k! I4 J, V) X8 O6 f
to the VxD Control_Dispatch proc (how the hell a shareware soft could try
- a4 B& I" J; W9 f: ]& Mto load/unload a non-dynamically loadable driver such as SoftICE ;-).: l7 W* i' H- e+ Z
If the VxD is loaded, it will always clear eax and the Carry flag to allow
  ?+ s/ S3 E+ ]6 j+ z8 h6 uits handle to be opened and then, will be detected.1 a8 |* E, r1 U1 Q5 e9 O6 q; h. ^
You can check that simply by hooking Winice.exe control proc entry point. J: h" y. d; k- k2 z
while running MeltICE.
  b2 ~3 ~8 h! [& ~/ s: H2 D$ Z7 N8 ^7 r1 F& d
, M* V. K' V. ^% y1 ~% R1 v7 B
  00401067:  push      00402025    ; \\.\SICE, `* ~3 F! B+ K9 `& M' l( j( z
  0040106C:  call      CreateFileA
) \8 R4 p* v& P* q( e  H- v, w5 [$ |  00401071:  cmp       eax,-001
/ b% t# K2 l9 J( K  00401074:  je        00401091
% D) a6 F+ Q* U! K& N, S/ I+ `. V
$ C! V7 `( D% E
& F6 O$ l! o2 o8 {% m  e9 \) w) I3 |There could be hundreds of BPX you could use to detect this trick.
" D4 C2 O5 d7 A! ?. S( i6 o% ~0 e-The most classical one is:3 E" e+ S2 L; M- B9 Y8 ~
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||# c6 E8 U5 |$ [5 T; Q) V
    *(esp-&gt;4+4)=='NTIC'
# \/ Z  D2 L, N  ]# B+ i( F5 w' [3 p( \
-The most exotic ones (could be very slooooow :-(
4 R3 d- k+ v: S( d   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  - r; ~7 f; g# d4 ]* W1 C+ I) @) A
     ;will break 3 times :-(
& \: C& w! j% m, a$ B' i3 I) N+ D& J7 Z6 c7 K
-or (a bit) faster: 1 U: j' y- u/ u8 o+ ]% w
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')& `4 \7 V3 p" r. f$ J
" k, `: s" b& H1 ?  u: z
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
" S2 K# u6 f# r; n  k& `5 Z     ;will break 3 times :-(* e% J# h" }& |
% u5 i1 T7 @7 Y5 g' U& ~* [  A. l
-Much faster:3 E2 Q5 Q, k1 o
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
. h1 E. M  a. o4 x( i. q
( |8 [4 z& _9 o) k9 W  `Note also that some programs (like AZPR3.00) use de old 16-bit _lopen8 m7 G* G7 t% x7 B1 E1 v: u
function to do the same job:' h/ S' D( ^7 l+ \% P

( M$ O" s! ?' u7 h8 H# @7 f# b. m   push    00                        ; OF_READ
2 m  L6 x2 h" o6 f3 r  e   mov     eax,[00656634]            ; '\\.\SICE',0  z* b) V4 y2 R% s
   push    eax! L1 W9 J- {3 `& p
   call    KERNEL32!_lopen
9 w2 z8 h  Q2 _0 K" t" \   inc     eax
2 K: t' @: j! r1 {* q% E# O   jnz     00650589                  ; detected! h3 N+ d. k% V+ I7 N7 v
   push    00                        ; OF_READ
6 P$ i, d! k1 t. ^, b: z4 Z4 M   mov     eax,[00656638]            ; '\\.\SICE'1 e! L& v/ q: T7 g4 ]8 F
   push    eax& ^0 F1 x% `; S& t+ {
   call    KERNEL32!_lopen
1 H5 G) F- m/ a+ z# `   inc     eax
8 b5 r9 J8 S, a$ ^! S4 {   jz      006505ae                  ; not detected2 O2 l$ o  b1 f4 g' z
5 Q# Q8 U2 q$ o9 j$ f
& N, e2 y5 w( t& o! O9 {0 O
__________________________________________________________________________
8 }+ I* Q# f9 d$ x
+ z8 y' e6 g6 K% Y, NMethod 12- m- ]7 i2 x: L. W8 Z' y1 U
=========
6 V7 w$ ]& `% C( \3 @% A/ P; L( Y# m8 W3 y0 ]* B
This trick is similar to int41h/4fh Debugger installation check (code 05
! K# y# i' f. h  h2 f&amp; 06) but very limited because it's only available for Win95/98 (not NT); \# R: l1 G* J$ X/ n
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.
9 Q: a. R- n# m7 n# H3 t* v1 A( a- X. E' J
   push  0000004fh         ; function 4fh  M# o( M* U' p+ T' D% F
   push  002a002ah         ; high word specifies which VxD (VWIN32)
* [- ~% E4 t) K                           ; low word specifies which service
8 r# Y4 P7 @- L  V! n- M# [! U                             (VWIN32_Int41Dispatch)7 L' \3 Q* Q2 ~: b  _
   call  Kernel32!ORD_001  ; VxdCall
, o$ z6 `. `# a4 T: a/ r   cmp   ax, 0f386h        ; magic number returned by system debuggers  s/ e) X6 v# G- c7 R
   jz    SoftICE_detected1 z) O. L0 G) `2 T7 a' r

# t6 y% I( `! r2 i4 IHere again, several ways to detect it:
+ V& }+ M/ m% t. k6 B1 i, ~4 T: o* q1 W* C. \
    BPINT 41 if ax==4f
% \) f: P8 d% h3 Q! L. U) d0 Q: W2 H9 E2 _
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
5 ^! C# h" {, z: `4 `; @7 ~) Q
. {' U5 O2 U$ n! }7 \! O    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
, z8 h9 }7 l9 T8 f8 e% w
* X; I+ o7 j" C' O    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
& b/ o" N$ E8 r+ }* H( A: y* Y3 g
3 g( j, a% P" r3 w) B3 |__________________________________________________________________________
0 _$ _1 P9 T) U2 [5 W( U+ f: ?  G: J5 a- }+ u; q9 \/ @
Method 13
1 s+ e- a6 q4 Z$ j) |=========
. O, Z( u! ]7 A% c. g" X: }7 Y) n
2 `7 R  d+ U7 i1 a, HNot a real method of detection, but a good way to know if SoftICE is! d" T8 s! Q4 v0 V- H- y, Q2 R6 `2 s
installed on a computer and to locate its installation directory.5 X: O6 p  V* l8 E
It is used by few softs which access the following registry keys (usually #2) :
- q+ }  h( P2 G' ?+ Z2 J' ?/ ~7 [, n, K& W( d9 L
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
7 l+ F1 V2 l! |) S! T; x8 Q\Uninstall\SoftICE
# w4 Q3 F# P2 o4 x* {# o3 H4 m  v0 _-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE7 j* \4 Z6 t: _% Q$ u
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
' b6 W6 t, z+ ]/ s0 I\App Paths\Loader32.Exe' L( R5 V. i8 x3 w, X0 b: @' R

" [9 O# c  U8 R+ {2 ~" u
5 J+ o+ D# I# cNote that some nasty apps could then erase all files from SoftICE directory6 M$ @6 d6 Z- L7 c1 @4 i
(I faced that once :-(# v. A) ?, K9 Z, p2 |; v
% ?/ \3 I/ k' L  ~: z
Useful breakpoint to detect it:
% `; R( z8 b" f; _7 [
% m* y5 @' |1 c     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
, x, ?% A" @  U9 L9 E, }' i" h; U. [7 y, X; t4 N3 \6 d4 z
__________________________________________________________________________
9 n. R7 L/ x( h$ G, z' i: m5 t3 Y7 d& s3 Q& `4 ?; a
4 |2 D% s" {' ?+ O, Y3 U5 C6 t/ S
Method 14 9 W, O/ P4 k( I
=========6 G* U- t- E$ o$ P8 c

4 Z' w& G: J. W+ v9 PA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
1 c- ]$ G' N" ?1 w$ O7 J" D9 E+ w9 m; vis to determines whether a debugger is running on your system (ring0 only).' [) [! [& D2 [' J) _: R

2 j9 ]2 c- y& o2 m   VMMCall Test_Debug_Installed6 G; [5 s1 f$ i0 o. J+ Q2 W) }, s
   je      not_installed. A3 b! G* a. K# j5 Q7 L+ F

# X" Q9 C* H5 S: p' y+ pThis service just checks a flag.
6 m1 v0 }' c* U* `</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|本地广告联系: QQ:905790666 TEL:13176190456|Archiver|手机版|小黑屋|汶上信息港 ( 鲁ICP备19052200号-1 )

GMT+8, 2026-8-1 03:44

Powered by Discuz! X5.0

© 2001-2026 Discuz! Team.

快速回复 返回顶部 返回列表