找回密码
 注册

QQ登录

只需一步,快速开始

About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
5 `6 @' t" z) h8 ^, q<TBODY>
! k/ H) B1 ^- y- I- a' j' v<TR>
$ B3 z; [7 U( _9 Z& s( |' D6 D6 ^<TD><PRE>Method 01
. y! V/ O/ p: }0 }/ s* \+ ]=========1 u0 z2 w9 U9 D
' G+ P" }. _- e) _0 H# ^
This method of detection of SoftICE (as well as the following one) is
1 n/ o$ W7 C. [+ gused by the majority of packers/encryptors found on Internet./ S0 G# W6 p! N
It seeks the signature of BoundsChecker in SoftICE) E) N3 D1 Y# c9 @0 X* a
3 m! Q  d* q6 M3 ^* H
    mov     ebp, 04243484Bh        ; 'BCHK'' ]1 ?+ s5 m& n4 v( o% m
    mov     ax, 04h
/ _! T% Y+ L: X: I7 Y+ b    int     3       " Z* f% E0 M1 Q, {: j
    cmp     al,4
; n7 m- o# j0 W# y8 Y    jnz     SoftICE_Detected' Q/ o% f: m* R3 a! w
6 h' ^  u. o7 R
___________________________________________________________________________; `0 ^4 Y  W, y$ J

/ B4 s) H* c6 c  EMethod 02
: }- s2 i5 C, a2 w3 q1 g% J0 T=========) \/ b5 a% z6 ~8 u' L- t
4 {9 a$ h5 b' s% K, X* v
Still a method very much used (perhaps the most frequent one).  It is used
- m) N; `8 n+ \: T  Ato get SoftICE 'Back Door commands' which gives infos on Breakpoints,' [7 h8 K9 f7 |* m+ f  s
or execute SoftICE commands...
6 F! Z+ ^; F7 yIt is also used to crash SoftICE and to force it to execute any commands
  N! s. Z' Q) D4 Q# s(HBOOT...) :-((  ( n4 ]/ D$ t& B" E# V7 l

; W4 I2 o1 t! ?, w' WHere is a quick description:7 I. y5 k! T! ~3 G% y+ K
-AX = 0910h   (Display string in SIce windows). o' Y6 Y" m' c4 B4 t: D- H( U5 W3 o
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)5 W$ Z# }6 m3 \
-AX = 0912h   (Get breakpoint infos)% n6 q, F/ X8 I! e) {% F
-AX = 0913h   (Set Sice breakpoints)" _) a5 U; M' I* p! w. _
-AX = 0914h   (Remove SIce breakoints)
1 @; D, t3 a3 I: h( W# m
/ n4 h8 Q1 l; q; E" NEach time you'll meet this trick, you'll see:
5 ]6 I" v: j& l* L' z6 W-SI = 4647h
6 D" I3 f! G+ J5 e. R& A/ V-DI = 4A4Dh* r+ A2 ~$ ?. S
Which are the 'magic values' used by SoftIce.3 O0 g1 R- Y  j( z/ F6 |
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.! _  R7 f8 Q" J8 Y1 }
- T  e& x3 J$ E. j! u
Here is one example from the file "Haspinst.exe" which is the dongle HASP% h' g% w" \: g! k" z: Z( q
Envelope utility use to protect DOS applications:
1 U% j2 X" |9 c2 C7 F; j& M; ?9 @* E, f+ y8 q  P( B" q

" q7 E: T9 ^# D1 p4C19:0095   MOV    AX,0911  ; execute command.
1 n: x, x; _- V6 v0 ], z4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
, ^5 E/ y, \0 b# C! O4C19:009A   MOV    SI,4647  ; 1st magic value.
; m. o. e  ?# X8 O4C19:009D   MOV    DI,4A4D  ; 2nd magic value.8 @# \* L% y1 Q) Y8 p3 c
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
3 D6 y- ]; _3 T4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
- `" Y/ k. Z! U4C19:00A4   INC    CX
0 Q. G$ n4 Z1 U$ g4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
+ t% o' M6 w  g6 J& {. K2 B4C19:00A8   JB     0095     ; 6 different commands.
# G" c- z! ]5 j4C19:00AA   JMP    0002     ; Bad_Guy jmp back.1 w& t- N0 ?; P* O( J
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
: h% p7 k0 P, C! H/ X5 H$ ^6 f3 e, M' Z" T8 _; D6 @
The program will execute 6 different SIce commands located at ds:dx, which9 L$ t) ]! a( p: X0 Q9 S0 B
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
4 p9 ^% h5 Y5 G! H
; t4 o- y! }1 [' V; b5 M* q1 o* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
/ _0 ?: h+ `. i0 F4 p7 r& [/ b$ f___________________________________________________________________________" W- s0 C3 B4 ?6 C/ U
* M3 u6 R  ^3 H# P) q$ c5 x4 @& q

1 V" K) R- f  RMethod 03/ u% W6 `1 j/ Q/ w! |, ]
=========3 S/ z6 X' K6 j$ d2 N! ]
* b2 `7 A% u. b; w
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h/ j( S- F& E; i# c
(API Get entry point)
1 H; J, n1 {4 _7 ]2 g        
6 A5 I" a$ ?0 A$ N$ ]* \6 S! Z0 E% b: ]. Y( w6 i) U" Y
    xor     di,di! |8 h2 t! p2 h9 z$ \1 h
    mov     es,di
/ L/ u- M0 `1 F, k5 H5 u0 i    mov     ax, 1684h       0 v6 D* R0 A/ s
    mov     bx, 0202h       ; VxD ID of winice
( F2 o1 i. Q3 z, ~, G6 Q    int     2Fh
% \( O# y; n( p    mov     ax, es          ; ES:DI -&gt; VxD API entry point) j. ]( }7 N2 B$ Q$ t# b  q
    add     ax, di
( g( J3 Y$ e" u* ]) k    test    ax,ax
$ N: Y& I( B# u+ S    jnz     SoftICE_Detected+ i# K8 P" D8 |) s, i; c2 S2 B
, ]4 w% j& Y' l7 R  v# t  p7 W
___________________________________________________________________________5 @4 ^4 W6 K# h6 l" q, @, C0 p6 z" Q
3 R, d  j+ J; K1 t
Method 040 R- p7 C  f3 ^* P& R9 I' V+ s6 O
=========
: P5 ?$ a9 f) U- k9 v* ~( q) |. x0 L
Method identical to the preceding one except that it seeks the ID of SoftICE
1 r. _$ K! a: e) FGFX VxD.
. o3 \4 M' q1 b# t1 A2 `
2 M4 I5 `, ]  {    xor     di,di) v/ c5 X- [0 j. s3 U: B3 P4 V
    mov     es,di( h! Z% H8 S" m4 I+ T% o  k
    mov     ax, 1684h      
7 @# F! P1 M5 ?* {' J3 X    mov     bx, 7a5Fh       ; VxD ID of SIWVID
% E! `3 L: K4 s! z2 i' w: O, Z3 M    int     2fh; T0 x! T, h5 n; Y1 b/ d
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
! f1 C1 o8 y9 g* b8 [    add     ax, di' Y$ g  a/ w- E& n, J
    test    ax,ax2 B* `3 y% S/ G- X2 s
    jnz     SoftICE_Detected
( v3 d3 u. Z7 J# P' _! C, g& ~) I5 C
__________________________________________________________________________
6 `" f1 d) @0 Q# f) Z* U8 s0 P; N8 I) F0 A8 w/ n
: D7 M9 z2 _8 p/ z9 x4 ~
Method 05! `: t: a8 j/ h% m0 H
=========
4 x% q* O! [2 c+ ?- g0 b3 f8 z1 c. P. O8 z" u. T5 v4 Q
Method seeking the 'magic number' 0F386h returned (in ax) by all system# L: m# j/ E. d& U
debugger. It calls the int 41h, function 4Fh.
5 u# v5 Z& Q! B& c, VThere are several alternatives.  
" b* }5 l- k5 ^; w
, ?2 ?4 L, [; z2 rThe following one is the simplest:0 S* [. Y: ]4 V( J% W, t

$ Y, M! _, a" m9 W    mov     ax,4fh
& ~) o2 r, o; }; g) e8 h, F# a  r8 d    int     41h/ o* z% y( \" F' b# s
    cmp     ax, 0F386$ Y% e! k6 ~4 a4 N$ F6 }7 v
    jz      SoftICE_detected
" y9 _9 \# o/ H' H: _% Y
7 S3 C$ i4 U' R
2 \6 ~8 z. B; m) f& }5 vNext method as well as the following one are 2 examples from Stone's
! A" G  _$ P5 B/ z( @7 \"stn-wid.zip" (www.cracking.net):
" v' s+ d5 m' @/ O" l8 U3 A7 @" `, \9 o. n1 K" U
    mov     bx, cs( u; i1 D& |) a0 {& t
    lea     dx, int41handler2
8 E+ W8 h) p5 i* M( a2 ~    xchg    dx, es:[41h*4]
1 ^7 G: h" i5 T8 z. ^: c3 W# q  ~3 j    xchg    bx, es:[41h*4+2]! X( V; k3 o5 ^
    mov     ax,4fh
- T4 D, z4 m, {3 G    int     41h
3 h9 u, ~' P2 a; e" r* ~    xchg    dx, es:[41h*4]
$ `! c/ }) C# \, T* W- b5 B' N2 q2 O    xchg    bx, es:[41h*4+2]
8 z! P7 F2 |+ Y! E* P8 s    cmp     ax, 0f386h
6 r1 U; N) [6 S    jz      SoftICE_detected$ F! y6 U4 p( F1 a# `, B2 Z# g

) r& P5 y2 A$ j! \8 j, L/ A8 `& a3 cint41handler2 PROC
8 @% |. h  A. O3 C0 V/ @    iret# v8 z6 U  F7 j# o# u: ]
int41handler2 ENDP8 I; \/ Y: u$ \# T7 i. x
: o( D# u: N, `- H- N

  c# ]6 f  B$ }2 Q5 ^& z2 B_________________________________________________________________________$ r4 y( Q; b* ~( W  S$ v' Q3 L

9 O7 a/ ~( U" r
" o  w$ F4 a  gMethod 06! c3 M; S: Z8 Q% ~
=========, \/ w. O1 W' O. m- f

5 I- O5 v/ T, a$ S* \  c6 e& i( u3 @& C- ~
2nd method similar to the preceding one but more difficult to detect:
4 L1 c9 {) J* {5 `' e7 q% H$ f1 i0 ^, ?& K
0 u2 B/ o& d2 ?) V' @2 f
int41handler PROC2 l9 h4 v, O! q* K! ?) V
    mov     cl,al
, q) N% }  b- N( h1 R+ g9 a# y' }2 r1 N5 Z    iret
& P" C2 @/ G: ], I4 s/ q8 bint41handler ENDP
* s8 [$ [; \' @6 U
( h. m. l; E# N* z6 E+ y
1 G5 F& C* J; S% z3 I2 Y    xor     ax,ax
. \8 q- K' a$ T! |8 k6 ]    mov     es,ax# G* [% _0 L% C: H/ ]5 |
    mov     bx, cs
, I2 S$ G8 j5 R1 v    lea     dx, int41handler
7 B7 ]' r" [0 U& n9 p  K    xchg    dx, es:[41h*4]
# x% g& a9 D: p7 U- z8 s. c    xchg    bx, es:[41h*4+2]
0 o0 a6 B, b! `, K    in      al, 40h  i+ B4 b5 b  w* s
    xor     cx,cx9 ^: }; x5 {$ j; P0 q& l
    int     41h
/ G0 X: c' j* O2 e    xchg    dx, es:[41h*4]# Z6 q' d& E" i7 j/ C9 I+ l
    xchg    bx, es:[41h*4+2]
! d" ~( i# _& l$ h' }    cmp     cl,al! Q; J, [' K7 N
    jnz     SoftICE_detected
  N& w) O- G2 ?5 H. [6 x) Y$ {' ]' l# {7 c; ?9 E
_________________________________________________________________________
# T3 G# k# S7 C0 t8 l/ p7 k+ e
1 \$ D. s. w% H7 c& J$ ~Method 07
: O5 V3 U4 K4 G) O, `# I=========
# d* Y9 c. a3 W, a% r3 D" e
+ j6 v9 J$ G. m3 F9 g0 u( T4 N; VMethod of detection of the WinICE handler in the int68h (V86)
4 ]6 U# N3 U: T$ g; m$ o" D/ t# w$ h( B0 |7 `
    mov     ah,43h6 K; F# a3 e4 b5 C$ H* a$ ]6 d6 T5 ~
    int     68h. n  ~2 [" @4 a" `* j6 t& v) b# L
    cmp     ax,0F386h
& ?# i3 r5 o0 P- x    jz      SoftICE_Detected
2 E! x1 j( V9 m4 m& e" p+ L2 w$ C- F% p
5 ^3 |+ f" [- s; w  s3 B1 m
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
2 N, I" y6 P) E) S, ]% E   app like this:) r: L! R7 e' @+ N
& p' F+ t0 n. ^- s& C: c1 C# O
   BPX exec_int if ax==683 i" h+ D3 O9 u* W
   (function called is located at byte ptr [ebp+1Dh] and client eip is; s) M# S) [4 U1 @/ g
   located at [ebp+48h] for 32Bit apps)
- j2 f% N' f+ h3 Y# o2 x. w__________________________________________________________________________
+ O+ L* Y$ V) j" G0 X, v7 |7 M" p5 v% E: {, X/ @; x/ l- P  ]! ^
+ H2 b: Z* b# r; W& D
Method 08, M/ ?: H& T( z4 Z  |2 ^0 j
=========2 f" f% Y( W% F' p9 N: g" C& D% B
& k1 a+ M$ }! m5 H
It is not a method of detection of SoftICE but a possibility to crash the9 Y) {& H1 _% O( X# x2 j
system by intercepting int 01h and int 03h and redirecting them to another
( J/ D. x0 q+ O6 K! J- \routine.
% I& v3 G' |, T6 H2 K5 QIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
8 h* \8 j  v0 Y8 rto the new routine to execute (hangs computer...)0 D2 c* }' B- v% T
5 n% U& Y" O' b) i
    mov     ah, 25h
" t4 z9 T4 a% v$ L4 q    mov     al, Int_Number (01h or 03h)7 h. z7 V8 \: i# f
    mov     dx, offset New_Int_Routine/ J1 T, E& ~5 H% C# e
    int     21h
* G+ d% j% s9 g: o9 o
: z1 z1 ?9 m% r3 u0 D$ j6 W__________________________________________________________________________4 q7 [% y' u# `  M2 Q' F. ^5 V) R; b
* r6 l( a$ _/ g6 L6 A
Method 09
5 |7 N7 n2 g3 ~8 h  ]+ q=========3 H3 G. _% H7 ]- d
5 ~, Q4 i/ v& b. y
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
) C% u5 I: K! y. E  kperformed in ring0 (VxD or a ring3 app using the VxdCall).
- _1 t) n/ p, l0 fThe Get_DDB service is used to determine whether or not a VxD is installed* f1 T5 D* |( ]3 s3 ^6 L( e0 z9 d7 D
for the specified device and returns a Device Description Block (in ecx) for6 n% O; q( k1 q5 q, {! G5 k
that device if it is installed.
# l2 F2 [& `+ H, Q' s5 c. r. P+ T9 i' R8 R
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID# @) P5 ?' j. B2 ^+ ^
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-). j. V0 q! q  D
   VMMCall Get_DDB
: b$ g; s) p" [0 {% A; v. p3 w# y   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed* x' t3 I$ X! k; t
$ H9 L* A+ [+ h1 c- F/ I
Note as well that you can easily detect this method with SoftICE:
9 W: R2 r3 q7 a! ~   bpx Get_DDB if ax==0202 || ax==7a5fh$ L8 @0 U& @$ d4 T( M1 Z+ p( C
  `" b6 ]0 L' T3 j5 {7 l
__________________________________________________________________________
3 J  Z% ^* r6 `$ T1 W! u/ H0 X" ?+ p2 t( v- K1 w
Method 10
% s0 z9 U2 I- ^, z" l5 {0 E=========
: W1 W. e8 O  x, Y( ^5 }+ x$ f9 o) m9 A: O# W
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
  d& _0 D' P+ i+ \! Z1 \  SoftICE while the option is enable!!9 S: l- P* b$ C/ P+ A
" T) D( M7 ]" o/ a9 v+ \" a
This trick is very efficient:( N# w  S# p% t7 \6 ~9 ~; A% @
by checking the Debug Registers, you can detect if SoftICE is loaded
& R5 s* e) t. m3 E& o( |$ o! U(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if, H5 t+ r% |- B% A& f0 J9 _  q
there are some memory breakpoints set (dr0 to dr3) simply by reading their
; e* k, {  ]4 |. M7 Qvalue (in ring0 only). Values can be manipulated and or changed as well; _' h" n' P; C3 G
(clearing BPMs for instance)
) V0 C  G6 K' K9 ]% B4 l% r- [5 x& K. M0 T
__________________________________________________________________________
( w; g( ?3 d- a2 B/ t3 H6 E  G- Z: s% J
Method 11
. k" N( ^- e; S, k5 Q  t=========
  U) L: h  E! d. f- j1 `8 O7 S, m
) ]. e, a; b9 SThis method is most known as 'MeltICE' because it has been freely distributed' w" J* f0 k& ^/ n9 w
via www.winfiles.com. However it was first used by NuMega people to allow7 N; A# P& d* M- v5 {
Symbol Loader to check if SoftICE was active or not (the code is located7 X6 o" N, E4 h% h2 P3 I
inside nmtrans.dll).3 X) z# D$ ]- B
- K; B2 G! }3 @* a+ y
The way it works is very simple:
! o* Z5 q8 I' a, p& a4 [- [) KIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
5 C  u  j. S  K% D/ {+ c% |9 b" bWinNT) with the CreateFileA API.
/ ^9 n9 @" G! C; H' O% ~% R* P, j# z+ P0 z
Here is a sample (checking for 'SICE'):4 a, ^0 K5 w0 [) [3 j

9 W( O. N: ?" x8 ^2 J- mBOOL IsSoftIce95Loaded()
* m& x# |# v. s# y{
/ M% D4 W* f+ x( F   HANDLE hFile;  
& S& i+ Z$ b, B5 g4 ]; |   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,# p% v8 ~# Y$ L+ ^  z
                      FILE_SHARE_READ | FILE_SHARE_WRITE,
/ b) l) w& S/ E# x8 Y5 \( v                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
; p2 V7 x* ~- l7 ]& {7 K9 a   if( hFile != INVALID_HANDLE_VALUE ). I- h: L6 z  C+ u7 `* Q+ P
   {
' [. [5 h0 [! e! D1 w" I: m      CloseHandle(hFile);( c" h, a" h2 \6 f: R2 u) t
      return TRUE;5 G, d, {/ d4 p) Q8 A( l! W4 P
   }( A' G+ y5 D. N! b* S( C$ V" h, X" D
   return FALSE;& a7 k5 ]( e% a1 E
}
* J0 \$ U4 R" c% t
2 B* H) e; s& ?  sAlthough this trick calls the CreateFileA function, don't even expect to be9 }8 R, m1 k5 t" @4 p: W
able to intercept it by installing a IFS hook: it will not work, no way!
  e% w5 s8 F( h+ W7 z1 ]. I* qIn fact, after the call to CreateFileA it will get through VWIN32 0x001F+ t& z' z% p" {& H0 q
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
8 V. a3 {, ?3 m( xand then browse the DDB list until it find the VxD and its DDB_Control_Proc6 Z7 c  B* m+ _) n5 E$ @- V2 G; w
field.
% L+ A$ _- ~# D9 r& d" NIn fact, its purpose is not to load/unload VxDs but only to send a
4 Z0 B! b! ?" |" ?5 K) b: oW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
! D+ E  g4 o8 M+ @5 q% G" Z9 `) zto the VxD Control_Dispatch proc (how the hell a shareware soft could try& C' Q9 Y( A) K1 V1 {
to load/unload a non-dynamically loadable driver such as SoftICE ;-).0 w; u- Z" X& Z
If the VxD is loaded, it will always clear eax and the Carry flag to allow
/ }( D: C6 N, S6 b: k# V. c9 ]its handle to be opened and then, will be detected.
7 h7 b. U( X( h$ O; I8 AYou can check that simply by hooking Winice.exe control proc entry point
+ r3 d' e( C; b1 _; h2 h* swhile running MeltICE.
" c. N; f7 ]5 N' A$ V+ @3 P8 ~
: X6 i$ i+ y" q& ?( A5 ?/ j# U
5 I/ X$ ?) y- }# h  00401067:  push      00402025    ; \\.\SICE
9 \& e1 W  G  ]* m; j8 O5 G3 W  0040106C:  call      CreateFileA
4 q( u3 W1 z5 [8 J, o  00401071:  cmp       eax,-0016 ^. @# _2 Z: H* C5 s9 b& }: }
  00401074:  je        004010915 N8 p, ?* J9 l. C5 u
/ u! T( M  W/ Q' U4 \+ V1 c
8 h0 m! w2 R+ B
There could be hundreds of BPX you could use to detect this trick.
2 A  \: l* {+ s+ [  s; Z-The most classical one is:
5 ^1 f) u" o& t. F% X7 g7 A  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||9 t  D6 q) {7 l% Q
    *(esp-&gt;4+4)=='NTIC'4 M& }3 c# R1 q' F- A+ U
9 a5 N* K+ i0 t
-The most exotic ones (could be very slooooow :-(
/ j1 q* c3 s* w0 N0 `' Z8 d   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
% N! g3 e, g& t     ;will break 3 times :-(' V; H% j9 h; [3 I+ p2 y% s& l9 Y

. q+ A. f+ o0 K% ^7 w  f-or (a bit) faster: 0 j+ `: j* S+ U1 `9 P
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
/ e% s3 S1 e& ^7 h1 j. u( }+ ~
! X" P; _* c$ M  x( C# I   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  & Z' ?% e0 D% t
     ;will break 3 times :-(1 x* U& `3 D* Y$ O+ H
" S$ ~+ L* E, _; U: l
-Much faster:8 w6 ~6 ~4 Q* x/ z5 K) U
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
" V4 W1 x! Y8 B- O# t+ h# a
# H7 o- _0 q4 ?: m/ F2 `! x3 [Note also that some programs (like AZPR3.00) use de old 16-bit _lopen
) g$ }& ^4 h5 P2 K( G0 Cfunction to do the same job:$ R% }" f8 W, _, R4 z
3 ^& }, Y. u1 v! T7 x
   push    00                        ; OF_READ' s' \& r# z5 U
   mov     eax,[00656634]            ; '\\.\SICE',0
! m0 ~  `4 B; I" W9 c   push    eax
3 w- A* B7 C( @  l8 A   call    KERNEL32!_lopen
  C, U; Z# S- n1 F   inc     eax; v! T2 P/ {* f
   jnz     00650589                  ; detected( w. Z* e" T. R; @" i( |
   push    00                        ; OF_READ
; r  ?! |' v& l# Z' }9 {6 D   mov     eax,[00656638]            ; '\\.\SICE'
* Q  P* |, d) V! K6 k   push    eax( ?% V- C* u% o4 W8 q7 B, |  f
   call    KERNEL32!_lopen1 Q( [: ^7 g5 c. \  |
   inc     eax# O) l5 E6 o5 x2 z+ W
   jz      006505ae                  ; not detected
/ i+ f7 T/ a+ y# R, ]3 D% `. m" I# X8 E1 l% v* c
3 T0 ?) Z2 [. B1 i9 x( m8 l7 |
__________________________________________________________________________
3 O! ^; U0 t( S( G- |5 K3 M
/ j$ J2 ~1 U5 T$ X9 pMethod 12
1 R' C2 m2 ~* L=========
7 D* W0 u0 X) K5 \6 p& Y
" y8 I, Q: }  L! PThis trick is similar to int41h/4fh Debugger installation check (code 05- i$ x4 c  j1 D- w8 Z6 X& }# G  T' r
&amp; 06) but very limited because it's only available for Win95/98 (not NT)+ J" ~8 e$ j4 i
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.
  I; P* O- h. v1 z
, ^3 j# \' b4 \' Z; x   push  0000004fh         ; function 4fh" c) L  ]% y, {5 R* Q  a7 Q/ t* n6 v
   push  002a002ah         ; high word specifies which VxD (VWIN32)
; L, _8 S, Z5 L' X                           ; low word specifies which service3 j6 c+ ~3 H2 G: X7 E
                             (VWIN32_Int41Dispatch)
+ u' R0 Y6 n% w! B   call  Kernel32!ORD_001  ; VxdCall
9 H. z" `( l( V; g   cmp   ax, 0f386h        ; magic number returned by system debuggers" }0 y7 f6 m3 z1 f2 w& J: L$ A
   jz    SoftICE_detected5 q- |) c  B- R2 {0 J- v
' I7 @) t3 G" |0 ?7 H8 Q
Here again, several ways to detect it:- S) n: {6 L8 W
# Z4 m( Q5 m8 Y, V" Z
    BPINT 41 if ax==4f
# [' t0 s& T( h* W6 w- h+ |& R2 J" O- d4 @8 J6 s
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one1 D' O  G7 {% `( Z9 g

) ^, a7 a6 o9 f& B- J( @    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
) m! x- e- M- D% n1 }- X5 ^0 i! U, \' D+ |7 Q. S, p0 Z! A
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
4 c9 i$ i# ~% a9 G4 x! l( B3 N9 u+ C  F( S, N) ^0 u
__________________________________________________________________________; V9 c4 r! j, \+ k9 `

: F! E7 e1 Z. MMethod 133 n+ i  J( B6 ]
=========
! u7 t1 P' J' V0 o- O" g2 ]8 L% _
- o5 U- j# W# H8 a, {6 |: mNot a real method of detection, but a good way to know if SoftICE is
7 _8 O7 q9 ]4 B1 ?1 G6 ~3 Finstalled on a computer and to locate its installation directory.
! f* u9 }0 Y- E) S) iIt is used by few softs which access the following registry keys (usually #2) :6 M' q  ]9 q5 a! ]
4 t8 l/ E, [* G+ }+ a4 E6 G* ?
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
' A$ R6 ?* v$ _5 _* j6 D# Z\Uninstall\SoftICE
+ f5 K6 z& A7 x- d-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
, Z' F( G; @! i" y-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion- `3 [& A& {) z$ Z
\App Paths\Loader32.Exe
8 r( P" |  @- w0 a) i4 [/ }- K* U; B# U; i1 k  G8 P# Y

! e, E" y" J/ z4 WNote that some nasty apps could then erase all files from SoftICE directory+ A$ X$ Q% K- `5 j; w: l( z- j
(I faced that once :-(5 ~* v$ V: w! H  b& o$ `; k
4 y" X% e* n% y' t% `, T. T, ~
Useful breakpoint to detect it:
/ Z! B' S5 J' O2 j& ~- \% K
0 K; f' |: w' H- U5 Q     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
( w) P: q+ j. p% A6 y) N# s
" g" M1 _0 C' o# H: _; b__________________________________________________________________________. w- p6 ^+ K) D$ s

& ]) I  U4 U6 q
, u& ^) R5 F5 hMethod 14 6 a) f- ?1 J4 z! N9 d
=========! B; Q2 S3 n% m# ]
% S1 y% Y" h$ g( @2 y
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
( D3 q2 d% `4 K! z* ?% u6 R5 R7 h: gis to determines whether a debugger is running on your system (ring0 only).% X; ]) o5 s# R/ Y+ H" p

! d/ S& t* Y9 \1 [6 O2 ^   VMMCall Test_Debug_Installed- Z' a+ Y; F- |* D# ?
   je      not_installed
5 Z3 R: V* ], X6 q) P3 B
3 b* q7 @. R0 J: W9 G3 `2 Y" YThis service just checks a flag.
2 z" h& T6 z/ c/ u</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2026-8-17 00:56

Powered by Discuz! X5.0

© 2001-2026 Discuz! Team.

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