About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>% t; p, v1 q  j
<TBODY>6 V6 E$ e6 [% d! Y' _( [
<TR>
2 g" t( W% ~$ R6 _5 {<TD><PRE>Method 01
! u4 b; D! i* t0 C# F. C  ^% {& p=========
; P3 [2 Y, c8 o0 z5 }' ?8 U7 }6 v7 R! J- \$ z: o
This method of detection of SoftICE (as well as the following one) is
3 r1 P, m1 G7 `7 K8 u( X1 N% lused by the majority of packers/encryptors found on Internet.5 L+ s* _* j( c' s
It seeks the signature of BoundsChecker in SoftICE2 w+ D; |" Z( ]# P# ^+ ~
- j- A# r9 K8 ?% @( M; U
    mov     ebp, 04243484Bh        ; 'BCHK'
8 w& q6 H# H: ]7 [6 Z: L    mov     ax, 04h
) h" ~5 ?8 P% [3 U    int     3      
0 z9 g' \; X6 k- {4 c    cmp     al,4
7 U) ]7 S2 B8 U- s' h' G. b, ?    jnz     SoftICE_Detected
& }  f% ?; Q# ]$ S" ?5 j6 s
2 D( ?! Z; a* P( M+ ?+ R___________________________________________________________________________
1 ]9 ]5 ~0 P3 a  ?, n
* O! H& E- C& f$ c( Q1 hMethod 02: {3 U% W5 b. W; b3 c* c* m
=========$ W0 U9 g8 n8 t2 ^

# s# a4 d% _, a% FStill a method very much used (perhaps the most frequent one).  It is used
+ K- S3 T" d5 ?$ dto get SoftICE 'Back Door commands' which gives infos on Breakpoints,7 X5 [0 L* y7 M! H# h# u6 H# d
or execute SoftICE commands...% T/ M" l* f( c  U6 C1 B4 c
It is also used to crash SoftICE and to force it to execute any commands
4 V/ D) K; l. P8 U/ |* i4 y(HBOOT...) :-((  " h0 e) ~& p: _5 S- T8 B

) \5 \6 s3 D5 z; S$ F, O' J. ZHere is a quick description:
8 Z1 @; S: R8 C$ Z' u1 B3 [2 J6 A-AX = 0910h   (Display string in SIce windows)- \" C, E* @$ Q$ ?
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
8 d' w- B* `5 V! f5 B: A  `) \/ l-AX = 0912h   (Get breakpoint infos)
: g. z* F0 d7 r: W/ ^8 Q. U  }-AX = 0913h   (Set Sice breakpoints)' O: |9 E9 v7 A8 X
-AX = 0914h   (Remove SIce breakoints)6 v! f: H+ N) H

, y) [, z* x& aEach time you'll meet this trick, you'll see:
: O, D( S# {0 w" j: |; W* |! X9 f-SI = 4647h
" u, l5 `& L( o4 F-DI = 4A4Dh- i1 k9 W( Z. c
Which are the 'magic values' used by SoftIce.) V) Q7 ~/ }  a# \7 W
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.1 o- \! i1 a" a

' G3 h; t# M' gHere is one example from the file "Haspinst.exe" which is the dongle HASP9 |2 }% b( |7 n# l$ g
Envelope utility use to protect DOS applications:
' B. S* U9 ^& C0 _/ C% X
, M+ y4 ^# _8 s  B4 H
! a7 j3 b5 x6 n  y4C19:0095   MOV    AX,0911  ; execute command.
4 p+ t! ~/ M' D6 o* }4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).6 n: U6 ?5 k6 V; o3 b! m+ [0 t
4C19:009A   MOV    SI,4647  ; 1st magic value.
# o) b( w, n8 O. k4C19:009D   MOV    DI,4A4D  ; 2nd magic value.0 K. J) A( z, O0 m$ w" v% p0 W; {9 m
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)1 a* K" G: E% b8 p3 s
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute) z  N# o, u2 C/ A5 a  {* P4 O
4C19:00A4   INC    CX
& s" N5 w! q( ]4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
: x$ `5 i4 f2 G; `. V! a: X) k4C19:00A8   JB     0095     ; 6 different commands.
! s# k2 S! c3 E$ L4 ]: |: `4C19:00AA   JMP    0002     ; Bad_Guy jmp back.7 P/ N% t: H2 m, j& g; _7 k
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
. ]* ?8 ]4 `2 L' d3 H0 J# R
$ y9 [# z5 W: H) r9 [The program will execute 6 different SIce commands located at ds:dx, which7 I+ ?* W) P" }% d$ }
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
1 q( [" i  N3 ^% W
) S6 f8 B) P8 j# L3 ?* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
' b) ]# m, E0 G0 _2 J# a___________________________________________________________________________
) f3 G  t( b) l( P$ f+ Y
' F% B7 ^8 r3 d' z  g4 \; I- w0 X0 w# Q# {
Method 03: T5 S' _3 o$ _0 Y; I
=========
3 P& V  c/ i' n1 M3 ]$ a& i) M7 H2 ]1 j7 t, n
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
/ \4 L# h& g5 G. ]4 F$ x7 y) X" t(API Get entry point)& t: C* f- P3 D) M) d4 {
        : Q8 g3 r- a! O7 @* U  G

) @1 A  ^/ c& U8 Z" A    xor     di,di" Q7 c; b) e3 g
    mov     es,di
) V4 C( L! K3 [) b5 D: {9 y# [7 w! E    mov     ax, 1684h       4 D- u1 W0 Y( i
    mov     bx, 0202h       ; VxD ID of winice
( @0 X; `: _. ?. w- U# t8 J) ]3 U    int     2Fh7 F: i9 u% ]# S+ C- U
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
9 A  r7 C" d0 Z  \7 |$ I! o    add     ax, di0 j( @4 w8 x: t& \3 ]; |
    test    ax,ax
4 r0 b' P6 u' Z: O* p* }! N    jnz     SoftICE_Detected
: l2 u% t1 f" K+ E# y) H! j+ w& Z+ H# @- _# U$ W
___________________________________________________________________________
2 r7 R  a! ~) ^9 S  P; L/ z- X- _; H5 L
" e* F; D. v" a' H; P* ^Method 047 T; g/ d8 L* a  x3 W
=========
+ O: Q% h. `" i3 \  z! G! ^- Z* F: c$ ?) f* M7 J/ @
Method identical to the preceding one except that it seeks the ID of SoftICE! P6 ~* y- T/ l
GFX VxD.
' j' g: }6 a' M- |% Q9 @( r8 l* u  ]/ t4 K
    xor     di,di, F+ Z# G( F9 u, u5 n- G9 K
    mov     es,di3 n0 s" X' D0 q  R. P2 U
    mov     ax, 1684h      
! I( Y# C! m9 A0 i% ?5 K    mov     bx, 7a5Fh       ; VxD ID of SIWVID
* e$ T, `) z, i, a% n) l: o' S    int     2fh
' F. v# Q5 C% b1 Y    mov     ax, es          ; ES:DI -&gt; VxD API entry point
* Q2 t& P+ U3 ?, E4 s6 S    add     ax, di5 a" Y% v" W4 b7 Z
    test    ax,ax
/ D: [/ w1 }/ _8 b    jnz     SoftICE_Detected6 k+ h2 i) Y& X' O
3 o2 ~  u. v, Z& `; r
__________________________________________________________________________: K6 Q: L+ _! Y5 `2 N0 l# {
9 s: ]7 O4 H- N- {% d
, u' s# m! y- g' q3 A& @  B. ]; R* ?
Method 05
4 r/ r2 m8 }: {8 K5 x/ N5 k=========
# A- V" \- A( Z1 z3 L3 q: I/ H( F( `% o4 p$ f% [/ d6 ~; F
Method seeking the 'magic number' 0F386h returned (in ax) by all system: v$ Z0 l4 A( X* l+ e
debugger. It calls the int 41h, function 4Fh.+ V! W. u1 d  Z1 J7 @" ^
There are several alternatives.  7 P  o5 K  }& z3 f: V+ i
+ v4 V1 s, t7 Q! L0 g9 r4 F( V
The following one is the simplest:
) F8 z5 l0 G1 z& X
' u/ t( P  n% V9 [- `  C0 ]  p5 g    mov     ax,4fh: F4 I, B! n4 F
    int     41h
+ M# f0 b1 Y% Z! F) a3 E4 c' X5 v; X9 O6 E    cmp     ax, 0F386
: h! W; h; g$ s1 t    jz      SoftICE_detected
0 E# `! P; U* f3 I+ B( `' a, X$ }8 [+ l& ^. i# d  L8 O# P
9 Z) O& U5 t! Q$ ~( a% @
Next method as well as the following one are 2 examples from Stone's
) t) E" M& r1 ?- N+ i: a% X"stn-wid.zip" (www.cracking.net):
9 k0 o0 t& @/ e. s  N: n: C0 t. n6 m/ `
    mov     bx, cs( ?+ T6 E& [& R0 |
    lea     dx, int41handler2
' H, }) |+ y& x* f" R5 S; N    xchg    dx, es:[41h*4]$ ?% u( p# P. Y: e2 t2 @3 W  n
    xchg    bx, es:[41h*4+2]2 S) P3 G0 P' F6 x' z$ t+ I
    mov     ax,4fh. u7 ]" V, J. L! }) o% z9 m
    int     41h
5 H1 c$ g' ~; L; e7 n4 t    xchg    dx, es:[41h*4]' Z( p/ h& ?- {3 W
    xchg    bx, es:[41h*4+2]
$ P5 u( T3 z9 h  i8 p* Y    cmp     ax, 0f386h6 d) K7 s( O6 [1 |6 q
    jz      SoftICE_detected
8 m8 W# ~: J8 v
' ]$ s. Y5 @+ uint41handler2 PROC# T3 [+ o- ?7 ~( v
    iret
2 K- h" G: G# o. G3 @int41handler2 ENDP
3 \. s4 Y, e2 J& ]1 _8 s$ q0 ?9 i9 @4 s) ~. }% d/ {
9 p0 K/ @/ l: E7 r
_________________________________________________________________________& \) [: f; z4 m2 x5 q# Y& q
5 V8 v1 u! {& j$ J7 M

+ x8 e! ?3 @7 k0 ~/ f% mMethod 06- G) v0 m& f: H" o$ s& q
=========
1 H# s+ W* c) ?5 k. t& {0 ]  ~  W# D. Z- X7 p1 E

9 v. |% i3 ]8 e* E- u$ k! H2nd method similar to the preceding one but more difficult to detect:
$ p# @- {0 v5 N# }; E
0 _& a: s! M+ ^+ S  P1 Z% s8 H- G& A' C( J& M3 h. V: f
int41handler PROC8 M* r3 `, l" e6 S8 y6 |
    mov     cl,al
# C6 U2 f- |1 T8 `+ ?8 Z    iret
& F4 A+ q% p9 z& Vint41handler ENDP8 ~. y3 _( d. n6 m
. B& j& t5 D6 }' X# f2 J
  d) V8 L0 n) Q# n7 o/ V0 \
    xor     ax,ax) B; l$ O( L: f' D; ~2 R
    mov     es,ax
" F* |* f% k0 Y    mov     bx, cs# a8 `! i1 o' V
    lea     dx, int41handler% M7 F( l6 h: s( A. ?+ h2 C
    xchg    dx, es:[41h*4]* V& ^  O! I* K& `( V7 W2 P1 s) P
    xchg    bx, es:[41h*4+2]& V. E+ A5 c% Y! W5 _' G: U8 C
    in      al, 40h" ^9 c& f6 S* Y) o- y9 O
    xor     cx,cx! e$ z; o. q2 f1 B7 v
    int     41h
; k4 Y: ]7 M" k6 C: M+ A: Y5 ?' N    xchg    dx, es:[41h*4]
+ C$ I6 t8 T* q+ k7 }    xchg    bx, es:[41h*4+2]
( r7 f" d' f& r. E    cmp     cl,al
5 V# t) Z/ A) j1 Y% \* p, @" \    jnz     SoftICE_detected
& P9 d: Q& b( D) O& U  `, S+ o' D0 ~- ]! ^9 ]. x6 E
_________________________________________________________________________
1 n3 y4 Z/ V$ m6 l
2 t/ T! @* v6 B7 E$ I! YMethod 07
+ F9 ?# J! i0 z; y4 \& E* O=========* j1 f  G8 r8 v- f( }' D
8 l2 ~% q$ J& e* H" x! H
Method of detection of the WinICE handler in the int68h (V86)4 f1 z" e1 f& g) ^8 a9 s# b
. ^' v  q+ L1 z4 R5 u
    mov     ah,43h
% C3 @: ~- [. K    int     68h# \" F5 Y. B1 u4 G9 ~/ u
    cmp     ax,0F386h1 e2 w8 R) m% ?% r# v
    jz      SoftICE_Detected% z) L; v7 _5 H0 s% z

) c0 ~5 n' ~, X5 J4 {$ H+ t( x5 X6 R/ `: F  p! n. o: r
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
# D) O# a- ~* x- {. ]! m   app like this:
8 p3 J% h# Q' y5 p8 l0 Y! t; F0 a4 G/ l( f  A& R* M
   BPX exec_int if ax==68
; P! ?. X% |" O. R   (function called is located at byte ptr [ebp+1Dh] and client eip is3 r8 n$ b( k' Q) P  U0 J, h
   located at [ebp+48h] for 32Bit apps)
  Z, w( ^: }4 w3 y__________________________________________________________________________
, S: I/ I. T5 \# o: x
( L4 G( u' `: A$ Z/ V6 Q5 Q
6 U, X/ ?, u7 u# ~: D6 X! OMethod 085 @2 j$ X7 w# l3 I2 c& A
=========
* k! T6 v6 W. @8 y
9 x- t" r9 s3 P. _It is not a method of detection of SoftICE but a possibility to crash the
9 C* S& G4 q# Z" ?! \system by intercepting int 01h and int 03h and redirecting them to another$ ]* P* G: B8 v
routine.( ]9 n; {( i& k. l& Y4 [
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
/ S% n# t# E+ u1 ~0 Uto the new routine to execute (hangs computer...)
' Z. p+ r5 ?9 W7 M
. P' K" k- M. _, f$ o    mov     ah, 25h
$ `4 p# g. I# Y$ ^# X2 L* q; T    mov     al, Int_Number (01h or 03h)) C  I  v& y) V5 j* x0 t
    mov     dx, offset New_Int_Routine; i4 }) }3 a% {5 B( G6 I
    int     21h! H. C* R/ u  k2 `" D+ w4 S( i

( A* I/ b5 Z/ e2 i+ n; E__________________________________________________________________________( q9 y: }5 s, d8 ^5 U; D4 j
5 c+ T4 H. I/ w" D# ~1 L
Method 09, e+ B& R9 T5 Q; T0 t
=========
: F- u3 j6 e; K5 l+ T& y* M- P3 J1 Z+ \% i/ W) D, U/ v
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only+ O3 G7 q' P2 c' M7 c
performed in ring0 (VxD or a ring3 app using the VxdCall).- a7 N) o9 R. ^. L2 ]
The Get_DDB service is used to determine whether or not a VxD is installed
/ T! u7 M& e( [2 `0 Dfor the specified device and returns a Device Description Block (in ecx) for
4 j* m& S! L+ o1 W" R& wthat device if it is installed.  @5 U  t; D& E7 n- Z0 d9 t+ N$ h

4 c; F: ~5 Y3 E5 f, F9 h6 y! B   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID9 i. l; _% w8 a% ?& f% R7 \
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)/ g4 k" ]" }& ~8 Z5 X
   VMMCall Get_DDB
: Y: H* m% n, ~7 h   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed1 j, F. |& p2 _# ?" Y
7 {; U  m- U. y
Note as well that you can easily detect this method with SoftICE:; I5 P9 r, d" J5 R5 Z; w! N
   bpx Get_DDB if ax==0202 || ax==7a5fh9 K3 s- g5 q' ^  V' K" a3 I. g

+ m6 q- N4 l* E__________________________________________________________________________' z3 @/ g6 _; K. E4 H

8 d& c: P1 {. l* r! A. I! |Method 10, d  a  X5 Z1 O. i
=========
8 w4 g% V/ q- R; N$ l7 v; t1 X, U0 h9 c# b( [' L
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with% {2 a( }/ v" k- Z. @+ C0 l) W
  SoftICE while the option is enable!!
% ?" m$ B8 Q% U3 B) E! ^
0 J' f; M4 b! ?* h- S( n$ ^This trick is very efficient:
6 q) r" D. y! @0 L- Yby checking the Debug Registers, you can detect if SoftICE is loaded
+ h7 D6 h8 |) V+ W4 K  f7 P. F9 ~3 ?(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
  A6 n$ C2 L! p5 xthere are some memory breakpoints set (dr0 to dr3) simply by reading their  L2 N" \0 R' ~7 p+ A
value (in ring0 only). Values can be manipulated and or changed as well
9 D% S( G3 d8 m; U- g) ]( m(clearing BPMs for instance)
+ N2 B1 [1 [: _( y) `+ k/ ?$ p1 k9 V9 C4 Z. z: M
__________________________________________________________________________
8 ^, K3 E( g3 o+ u6 Z0 x
, v6 N/ W  h( L' N  Q+ X. W& kMethod 11
; K8 y# K! o3 j" ?  P- o=========+ V. R; \  ^- x: U
3 q0 ^6 M# Y! y
This method is most known as 'MeltICE' because it has been freely distributed; n3 |5 c- X# Z$ G7 Q
via www.winfiles.com. However it was first used by NuMega people to allow
7 W- p9 t: O6 q' JSymbol Loader to check if SoftICE was active or not (the code is located; K, c! n8 ^1 |
inside nmtrans.dll).
% \8 C' v  t/ X
- B$ M; n! N, v/ f( vThe way it works is very simple:
3 d7 z6 R) i5 z: l, H% aIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
/ f9 D. r+ V9 U- b/ Q: BWinNT) with the CreateFileA API.$ J9 }5 j2 |" k' b) {( u
4 P# @& ?" O1 F) @8 J! u
Here is a sample (checking for 'SICE'):
( n/ l! z0 G& f( w2 H& @7 d% I
/ v* R" E* ~7 Q" P& J. n8 U# J# nBOOL IsSoftIce95Loaded()( x. r! ]9 K! c# P7 R# p! z
{
9 T/ x4 ^9 ?( X2 Q   HANDLE hFile;  + U+ I8 ]- Q! p4 E) o. H! h
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,; w( [- I4 u1 G- g
                      FILE_SHARE_READ | FILE_SHARE_WRITE,$ _# v' Y6 I( v: O3 V0 L5 P
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
; `9 L8 W0 ]9 r, D) @   if( hFile != INVALID_HANDLE_VALUE )7 ^, S! v" t3 \6 S0 C) `
   {* ?4 a0 r  q2 x4 t+ n9 Y  P% h
      CloseHandle(hFile);
# c3 @6 o5 g" i# \      return TRUE;
* f* \5 o- z+ k6 n   }
* q8 U1 ^: E* T7 N0 G   return FALSE;
# ]* ^( V7 F+ s. q7 p# m0 G}% n$ ^- z  C9 ?% d* `/ h

1 u! {- T, N$ C9 i* G* RAlthough this trick calls the CreateFileA function, don't even expect to be
  g. H3 u+ I8 A- E, @able to intercept it by installing a IFS hook: it will not work, no way!
( O6 k+ j3 L" m$ ]& k0 J/ |In fact, after the call to CreateFileA it will get through VWIN32 0x001F1 q# A! v. j; ~% |5 C8 o: P
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
; w( q# v7 O  Z. Rand then browse the DDB list until it find the VxD and its DDB_Control_Proc" W$ ]2 ?9 X" ]& k* z' P% u! p
field.6 |5 C( Y0 C% m: s/ }7 _
In fact, its purpose is not to load/unload VxDs but only to send a 2 E& E5 o8 @* @' i6 b- @
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)' Y6 K9 ^5 p4 h* W# q8 `
to the VxD Control_Dispatch proc (how the hell a shareware soft could try5 x5 t3 Y: [& n+ h
to load/unload a non-dynamically loadable driver such as SoftICE ;-).+ ]5 U0 F" x7 T9 G( }9 i
If the VxD is loaded, it will always clear eax and the Carry flag to allow1 v1 R& ?, S# c! t+ v
its handle to be opened and then, will be detected." Z( w9 c+ m6 ~3 g' N# @( x  {* ~
You can check that simply by hooking Winice.exe control proc entry point( C; p) L" t( }: _7 i: v
while running MeltICE.; i/ i# }: j) d4 z6 O( A

7 X) h! y5 y4 J* _3 t) W1 H: e
9 s6 q7 h- c' _& Z* V( b  00401067:  push      00402025    ; \\.\SICE6 F9 ]' e; R; Y# i! j
  0040106C:  call      CreateFileA
+ W! q3 b! C! ]3 ^  00401071:  cmp       eax,-001. B* S+ J! W6 k8 |' h8 r% q
  00401074:  je        00401091
; T: A' p- ]( U8 Z. M2 [: S( @1 U) G
, U4 `* W+ u- F& k- v4 {& x$ A! Y+ i% N% W  b9 K
There could be hundreds of BPX you could use to detect this trick.
. o4 t- c& X: @/ H+ |9 L-The most classical one is:# k% \$ t9 [  F, w, h; D$ n
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
4 x  }& B3 c( o    *(esp-&gt;4+4)=='NTIC'4 |, E' x6 E! |" ]; }9 m" A

2 l: H  t) |2 }1 M-The most exotic ones (could be very slooooow :-(
% K6 i% A+ v+ q# F7 m7 ?  L8 \) f   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
  Q% d% I  o- {: P     ;will break 3 times :-(
8 i, E5 m. }$ o& B# N. `: u$ k4 Q2 ]. Y9 g7 v( Q3 ?1 L( ^+ ]
-or (a bit) faster: $ e/ D+ @  N% r( ~0 Y- y
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
0 v# `. e. A, u* d& y  y; @* j6 c8 N- f7 E: R9 U
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
* I) O7 r' y/ y- U/ f6 {9 s: ~( {     ;will break 3 times :-(% e; B$ @; D* G$ m- w* q
+ P% P) A0 B( n5 Q
-Much faster:
) @3 A0 z: \, ?" ~: j6 C* N   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV') L; B. V& F: }/ W' N  j- o4 S
; K- }) ]7 E/ U; ~+ K
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen0 S% Y: H% A* V8 }9 i& a
function to do the same job:; H. G- r% X/ P

9 @1 I. P& z4 O+ b4 v   push    00                        ; OF_READ
& |: `  e: `# x5 Q, [   mov     eax,[00656634]            ; '\\.\SICE',0. m5 G8 B5 Q. l& S5 t+ `
   push    eax
5 B2 L7 G3 y+ O, d9 v   call    KERNEL32!_lopen8 K, \8 F$ Z) F  i
   inc     eax( N- q: G' n+ W. u, S
   jnz     00650589                  ; detected
$ j) Z  }. B4 C$ P% U5 `   push    00                        ; OF_READ# _/ C8 S, y: c
   mov     eax,[00656638]            ; '\\.\SICE'7 k5 I3 T* S7 W0 C% h* L
   push    eax
$ d8 `5 ^& S9 ~7 j3 }# e% U7 P   call    KERNEL32!_lopen+ {4 g1 R2 _: Y4 z* U- o+ ~7 F
   inc     eax) `" n8 h: V$ n8 I) Y
   jz      006505ae                  ; not detected
( g, d  f2 x5 e
, \/ {2 E8 h2 ]! z+ G
' r2 R+ _3 M: ?4 l  m__________________________________________________________________________7 V. `7 q0 {. ?9 U! p
! j4 d/ J0 Z6 _% L% L( H
Method 12
# p* r5 X: O/ T" d- n=========
! }0 G" V6 }5 n; @$ ]6 O0 u& [& b; L) u1 V/ L% U! r
This trick is similar to int41h/4fh Debugger installation check (code 05
7 y1 g- O- x7 v0 ?&amp; 06) but very limited because it's only available for Win95/98 (not NT)4 ]5 \8 j/ ~% ^* L0 T) |
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.0 ]7 |, W* Y7 g- ?7 a
. z/ y; K# Z3 N- \* v: o# {* ~
   push  0000004fh         ; function 4fh
. A. R2 m& _& I5 u) r   push  002a002ah         ; high word specifies which VxD (VWIN32)% P# A& C% q+ Q# p4 R
                           ; low word specifies which service0 [. p/ [+ F; i: _3 _& v
                             (VWIN32_Int41Dispatch)
. M% `4 F; h: Z, I- l   call  Kernel32!ORD_001  ; VxdCall9 {* Z) n( O6 x& F1 L
   cmp   ax, 0f386h        ; magic number returned by system debuggers9 q7 r2 W# n, O( ^8 e2 c/ Q/ w
   jz    SoftICE_detected
2 }6 ]) x, R- v$ P: ?
" c4 i; r$ r7 `Here again, several ways to detect it:* B! X, a# U8 N7 c8 O6 r
8 E; f+ ?. s3 J6 B/ W8 \% S/ E
    BPINT 41 if ax==4f
' `4 ]* B0 k+ v  @3 E3 u+ u8 f) ]& ~8 P9 ^: g# `
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
) o& e6 w  [: b+ r6 _' ?' |( Y1 }6 @+ P# {
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
9 {7 V  T  Q- @- Q. G$ `( I+ r/ i& R/ Z  c( T4 |! T
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
1 j) y( K2 T& K" r% A
* w) q+ d- x9 D- L' [$ K, Z5 W__________________________________________________________________________' d2 P5 q5 J9 x3 J

0 e3 U( b# j# n6 p7 v7 L  NMethod 13
* I" U: p) d- C! G6 Q& U=========) R6 B5 m& |! U
0 X1 Q3 S! O8 H5 a0 g
Not a real method of detection, but a good way to know if SoftICE is/ @* e1 h/ S: n# }4 G" r% s8 D/ q# E
installed on a computer and to locate its installation directory.
+ l0 p7 `2 l2 Y/ }It is used by few softs which access the following registry keys (usually #2) :
& S# B0 [1 |' j. Z) a. g* m
% F2 u$ M3 G8 D# I3 A6 h! _4 d-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion9 H  U8 ?9 M8 h5 h! ^+ }) d$ x, m- u
\Uninstall\SoftICE0 h0 f* Y/ J3 _. U
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE7 b0 `3 C  @$ Z' M
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
1 j( I* W' T$ b8 n( c. Q: C) Q\App Paths\Loader32.Exe+ x3 ~& I2 p/ d$ e: d) ~3 M( R3 b
) \+ M- O. @% N: ]( W& {: Y# j- c

) t" |8 N8 ~4 g2 ?Note that some nasty apps could then erase all files from SoftICE directory
0 I; L2 |7 h$ \, |2 a, m& [; F(I faced that once :-(, M. H0 H( G; N. [1 M8 n

( ]$ N0 @9 G3 Q1 DUseful breakpoint to detect it:
9 e9 K- B* J' \9 _( l
" T$ p8 X' l: L7 o     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
9 V  ?- H0 L+ e+ X' G: [1 I: |$ V# D+ N0 y* K9 o
__________________________________________________________________________
/ @9 |  H" b1 z) v6 o2 {* I$ D
8 k" T: x$ h. O' H. Z; x& z
1 n# U' s" _. u: K9 L# z, AMethod 14
; t9 G" N0 E3 B$ O: s) {6 k=========0 u4 C4 Q3 g4 i% Y* \8 T5 I
6 I4 q# w, ^  E$ H, w4 ~
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
- p2 i2 ~* I3 qis to determines whether a debugger is running on your system (ring0 only).
. E( y, S7 F: M% T, ?2 M3 \3 a/ G  e" j% M8 m
   VMMCall Test_Debug_Installed
) ?& v# @( \! |: y* C; W& J   je      not_installed
. p+ Y& J6 k- e- d/ L' D) F- v& C% P6 g
This service just checks a flag.
+ T& Z- F1 b0 P, X4 m</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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