About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
; J! E! V/ A8 \4 W  P$ C& P<TBODY>) c' v5 }2 P5 T( W
<TR>0 [0 D% p! h9 Y  Y4 ^
<TD><PRE>Method 01
! h; C+ n, ]1 t/ g; s+ F=========
- p$ U: U# K2 M3 D) {" ]
! p; b+ g; K+ UThis method of detection of SoftICE (as well as the following one) is
- D, r5 R1 N* H; X1 Aused by the majority of packers/encryptors found on Internet.) i, ]6 I! \' J2 B* B3 @" c
It seeks the signature of BoundsChecker in SoftICE
' c4 R1 |, q; n, R( d- J0 N/ i" u. H+ f
    mov     ebp, 04243484Bh        ; 'BCHK'% R. X& x; l% q9 T2 N& N
    mov     ax, 04h
) ^* [6 N" X! `+ K# |9 W0 X. \    int     3       % ]& D8 k7 X. g8 ]
    cmp     al,44 l5 ]2 n$ i6 h1 l
    jnz     SoftICE_Detected
& n2 \2 Q# J5 X" g0 L% r4 f7 S9 n. q
/ |/ q  Q. @) G. I3 a, E0 c0 o" ]___________________________________________________________________________. C9 [6 h- X( H- h
( H" p) U! f: y( F/ S
Method 02
* {: U4 h8 }5 ?. u=========& W  r3 c6 @: ~" u# e+ ~

! f# S6 ?7 h3 xStill a method very much used (perhaps the most frequent one).  It is used1 L$ i' k6 W: s& M# C( v5 g$ I/ k
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,' b8 l) _$ Q8 K
or execute SoftICE commands...
0 v6 \" \2 M8 z) j* J. AIt is also used to crash SoftICE and to force it to execute any commands
; j4 L8 l0 D7 B6 U2 ~8 S8 O(HBOOT...) :-((  
/ K* B; f& I) Q; j; g, R) M8 X8 J* Q7 |# e0 N3 @
Here is a quick description:6 ]8 @2 ^. D& X$ l5 r& i7 Q0 }
-AX = 0910h   (Display string in SIce windows); @& @( }! C" v4 S4 G
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
" t2 Q7 i* i7 U" }-AX = 0912h   (Get breakpoint infos)
5 C- _+ |9 q* N. f0 c! S; n$ _-AX = 0913h   (Set Sice breakpoints)
  Z3 p6 w0 I3 Q" b3 P-AX = 0914h   (Remove SIce breakoints)9 s# f5 k8 ~/ Y- H$ M; U

, n( O. n/ w6 L  LEach time you'll meet this trick, you'll see:
# b$ V( Y/ G& j+ ]  g$ D-SI = 4647h
( `" q3 i0 s' ~3 F-DI = 4A4Dh" g2 Z& @: }* M2 N
Which are the 'magic values' used by SoftIce.& c; P+ j* ]% I
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.
0 F- {# P7 g8 ^5 d* q0 u: ]+ s
$ c1 G# F3 U2 G, n1 q" W# JHere is one example from the file "Haspinst.exe" which is the dongle HASP
  t% W3 w- }5 ~6 o/ s* bEnvelope utility use to protect DOS applications:
4 X/ n- a! s8 g8 q% U" a9 |  @, f" N3 D* k2 H* L8 Z
+ [; h9 ^' a. x6 a+ W( [
4C19:0095   MOV    AX,0911  ; execute command.4 }4 K$ P9 c) o- Z' M: s5 H
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
0 a( `2 ]& m* |8 f3 E4C19:009A   MOV    SI,4647  ; 1st magic value.# v+ j$ h  C: \5 n
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.4 X& c2 X0 _- \: o/ S3 ?( H0 b
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
+ T5 \  r, Z  X# C4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute% U3 p6 e1 ^& T$ q/ h
4C19:00A4   INC    CX, _/ P: O) L# g5 f2 h* N
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
9 ?, R2 O* m# ~% w  Z% Z' [1 {4C19:00A8   JB     0095     ; 6 different commands.
4 K% N  q/ p* e4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
3 c! |9 r# C8 n& V4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
: ?2 Z# P" S9 r; k- k2 W9 [, Z+ K' K9 O
* W+ T0 F6 V. y  G8 P5 ^: nThe program will execute 6 different SIce commands located at ds:dx, which
7 i1 S, [$ ^" N* a# V. M. `" Ware: LDT, IDT, GDT, TSS, RS, and ...HBOOT.4 F  W/ b+ f7 Z8 \( p2 d( f
2 e2 p, a8 v% d
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
$ \  D/ G, y* O  f___________________________________________________________________________
4 [5 l" J& m* c5 U7 R
* X6 j) R9 g* u/ P% t: F# _8 V, h6 l7 l$ E& c: D
Method 03, d. B/ ]% q& K* l& t$ r
=========' J: ~2 L  H, e2 {; N

0 `* K3 `# k. e3 G% }Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
  e0 H2 O( Y6 w" b! t- {3 V(API Get entry point)& U5 p7 K! s( H
        - @. S- i5 |! B# C* l. z

% `" H% d% B* X/ n    xor     di,di; _# ^! o# c6 S0 k9 O4 C$ }
    mov     es,di
( m! ?. t& h0 @% D7 J6 K    mov     ax, 1684h      
1 i8 p( W- Y# c9 {3 J! V$ Z3 k8 g    mov     bx, 0202h       ; VxD ID of winice
9 M  ~- J% n' b4 D: y+ H    int     2Fh
3 T4 a* E/ R7 U. ~- P7 ~$ b    mov     ax, es          ; ES:DI -&gt; VxD API entry point
( n# i8 v" u1 R5 ?! k0 Y    add     ax, di4 M& J, l" {4 ], r
    test    ax,ax
2 [4 Q) y+ }; {3 x    jnz     SoftICE_Detected6 |; C9 Z, J, Z5 H
+ K) }3 j% C7 O9 @9 F
___________________________________________________________________________
4 b1 ^. Q7 S) u3 C3 p% S1 ~" K* G' F( _
Method 04
# f0 a+ a. G% g/ ^7 t+ {8 K3 W=========% e; e% ?5 O' _  \  a' Y4 v
9 m$ t; `( ?+ M6 |6 G
Method identical to the preceding one except that it seeks the ID of SoftICE- k2 F6 b) ], ?" I- i% j- x( b" H
GFX VxD.
; @8 R# @; l" e& v! g
% d8 E3 j! q8 }8 W4 k    xor     di,di- J1 T( W3 a4 {  Z% j
    mov     es,di: _" ]7 v# x( Q& }$ T% a- y
    mov     ax, 1684h       % z$ F5 H, N. G9 G1 O0 |$ @
    mov     bx, 7a5Fh       ; VxD ID of SIWVID
: p: t! V  h- C5 Z# m    int     2fh
" V/ j3 a- J' @  A; a    mov     ax, es          ; ES:DI -&gt; VxD API entry point" e4 w) ~5 @; z& S- w
    add     ax, di
- ?# s& q2 x* N7 D9 \, J    test    ax,ax' ~, E2 y' k( \! C9 n
    jnz     SoftICE_Detected
; r9 p' ^, W- u5 V* @* R& c2 x+ z
( w+ k' D& o( e__________________________________________________________________________
! T# A8 W7 V1 F( R- p, v' ^' V# t* M
' ^2 S) `" d4 o
Method 05
! u2 T& o( R7 [/ H=========" x! D; _6 [8 o% J
4 M  e$ C" `: ~" J+ P4 S# {' N2 m
Method seeking the 'magic number' 0F386h returned (in ax) by all system
9 F0 P' K4 V1 U& S6 O% U( adebugger. It calls the int 41h, function 4Fh.
6 l1 J! U" Y5 y6 j2 U6 V5 A2 P# N( jThere are several alternatives.  9 U* h7 u: i3 a, g& e) ^
. ]/ F1 a* {  o7 S  v+ M6 [. U
The following one is the simplest:( Y$ |2 {4 o3 t% V) Q

' R6 j9 w2 a7 |    mov     ax,4fh1 {( ~: ?, j% S: J+ r
    int     41h% U# p, p- R1 R
    cmp     ax, 0F386
! q) q7 c, B6 X- z& j- X    jz      SoftICE_detected2 f2 Z6 D4 X4 b! ^0 G( V- H3 T

4 U4 s5 y6 C/ {/ Z) F. o1 d$ }+ I- d3 k2 o( y3 n2 c
Next method as well as the following one are 2 examples from Stone's
4 S5 K$ m% i$ ?# p$ B" a' U" F"stn-wid.zip" (www.cracking.net):. r! b/ ^" f% W4 v) I* m, F
+ h/ t% q& M) r. S$ M: s3 {  N8 v! n
    mov     bx, cs3 W  N5 o2 D5 }) k6 d
    lea     dx, int41handler2
- A) f  M, C" X. ^    xchg    dx, es:[41h*4]$ `1 a( P* W' S( h: H& \. U
    xchg    bx, es:[41h*4+2]4 b% F1 B$ y, l, W. @: c. O& }
    mov     ax,4fh
4 ]7 f5 |  P1 a. K* G  `    int     41h
% h' H$ h' |- g' K$ p    xchg    dx, es:[41h*4]
2 ]9 }/ A3 \6 _. @, x/ b/ e4 z    xchg    bx, es:[41h*4+2]' Q2 r4 @4 X' D% F7 s4 E
    cmp     ax, 0f386h
, s% _- P: i. t( Y* L* g    jz      SoftICE_detected. C; P  R4 q4 o2 s5 M
/ R4 w" B% g- Z& ?
int41handler2 PROC
( |1 L& \& v( {% Y7 i    iret  k- H& P7 v4 t4 U" ?
int41handler2 ENDP8 @  ]; W5 t9 Y* m

& s6 u0 }  Z- p# n$ [! V, S. D; P* |2 C/ T
_________________________________________________________________________, h) S) W2 N  _

* j7 R0 q* ^+ i$ ?" h$ O- A: n4 x# E  E. Y
Method 06# I" h9 ^2 t) P2 v/ G+ i% V6 {
=========
. ?" J& R! v) k$ d
( k8 Z, q. L0 B! c& a' m% c; I1 X0 _6 w
2nd method similar to the preceding one but more difficult to detect:  _6 E( r6 i) c. N' F+ L
4 t7 L, B) d$ x
& A' N+ Y0 F( N8 U
int41handler PROC$ [( T1 r# w- j
    mov     cl,al% C1 f6 K$ p) L( V% F: {
    iret
! P  A) [7 B/ _  V5 S8 R$ Kint41handler ENDP
8 X7 W: m9 q" u9 d% D7 v8 h# j& A1 |3 n- F

$ |. G% G: B' j+ p+ C( p    xor     ax,ax/ P; @$ m6 F7 p
    mov     es,ax: q+ J# t/ b1 j
    mov     bx, cs
9 _# I' p! C+ x# }0 M    lea     dx, int41handler
% w# i0 P6 q0 b; R. d- ]& K! s    xchg    dx, es:[41h*4]8 Z+ S" V( y. a5 R
    xchg    bx, es:[41h*4+2]
; T9 `1 d% n9 j( f: l4 o. `    in      al, 40h* [$ C3 h) u9 t
    xor     cx,cx
) ?' _. ]* H3 O3 \    int     41h
& b& ~& |; W; d/ U) }% D1 A    xchg    dx, es:[41h*4]/ C7 b1 f" x& W9 b0 N" F& G) ]
    xchg    bx, es:[41h*4+2]
  B( b% E( \9 O; x& Y4 h    cmp     cl,al$ f, K/ A) K8 j4 ]6 @
    jnz     SoftICE_detected
# m8 x7 x+ ?7 F+ ~, q  V
# E$ T  e9 H4 v! T% l+ P% Y_________________________________________________________________________
" P4 D# g  Q* f- `$ d  f
8 s4 t2 {( g: S1 p' w" VMethod 07; X4 F2 }6 e4 a* P- q1 f6 a
=========
7 E7 |7 H5 B* c, s1 P; n
. M1 l* g, w# T, V$ _! P  X9 j* w4 eMethod of detection of the WinICE handler in the int68h (V86), E, _6 F, f- _$ Y& j
7 a% A. w) T7 `- S: t
    mov     ah,43h
6 z" x* W! D3 c6 I0 L    int     68h; q% Y- X! X- c; h6 ]
    cmp     ax,0F386h
) @+ |5 Q: k! W, M; v% |3 i    jz      SoftICE_Detected' B3 @$ @! U+ _" M3 V, n1 e
. _7 f4 o& [8 n2 p) R

; h) ?3 I, A! n# e1 C, K  |; @' n& Y=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit: R- N4 E2 W8 n2 N1 d/ t) \
   app like this:% e! C$ H( s1 F4 w+ L/ ]& D

/ W1 q) T1 Q( [* `   BPX exec_int if ax==68
, M+ n7 X( ?  J, W2 e  y- [   (function called is located at byte ptr [ebp+1Dh] and client eip is
( f+ r& }5 P7 ^  F   located at [ebp+48h] for 32Bit apps)) @3 j& G2 }* g- x
__________________________________________________________________________+ U% \9 r* q& B1 }7 h$ I

- @: B+ Z9 j$ m- t& ?6 U  z! R
4 h, j1 L. V1 oMethod 08
- ~! q9 E  C: Z=========. b6 L0 J! |3 w7 w
& D2 K: ?' T) K- R( H# _+ |4 v) h) u$ q
It is not a method of detection of SoftICE but a possibility to crash the
  {& R1 \+ {& S" O8 x! j/ e7 y) tsystem by intercepting int 01h and int 03h and redirecting them to another
& \$ B# K- b9 u7 y( _/ Groutine.
% h% B/ L) l8 ~  Q$ \7 xIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points; [- M* b7 s$ p5 ]$ e# P2 n5 ]& i) C
to the new routine to execute (hangs computer...)( A# G8 v4 {9 j+ `0 Y5 Z% ~
- f6 o: l2 H' q; o9 |
    mov     ah, 25h
5 S3 }) ?0 X8 N" B7 z% r  L1 F    mov     al, Int_Number (01h or 03h)5 K& w& Z6 {) U5 m
    mov     dx, offset New_Int_Routine" W7 [2 b7 A' n9 N' d! ^
    int     21h" |3 j4 K  b2 X( P0 F  e8 I

6 O  d" X8 l. e; X" Y__________________________________________________________________________7 A) r" u) O- K" \8 Z% ~( ]

: i7 t( ~' d7 V3 R- VMethod 09  G  x, S3 y! Z3 K2 {# g
=========) k7 L0 c8 v4 {  D

5 k+ a6 U( F. d9 VThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only9 n% |  ?1 L: ?
performed in ring0 (VxD or a ring3 app using the VxdCall)." }4 H# D) {  T
The Get_DDB service is used to determine whether or not a VxD is installed
& W' u; n# g- @  R! c6 _for the specified device and returns a Device Description Block (in ecx) for, `3 T' G- @  q, k2 g; Z/ R. A
that device if it is installed.) p- f( ^1 C1 w7 w. ?
/ m" ?$ D, w2 G6 E# g7 X
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID  F2 ^) W8 n$ T+ ]% `
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
4 n# ^( B9 c# M( V9 O   VMMCall Get_DDB
% v% f! m6 R: g2 g/ Q: t1 u   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
; M$ Y8 T$ g/ n( A4 I# f
% m8 ?/ W1 U9 ]( D" Z3 VNote as well that you can easily detect this method with SoftICE:
0 k8 V) [+ T" L$ e   bpx Get_DDB if ax==0202 || ax==7a5fh1 f8 L0 |1 @, B; `9 D) e! G

$ i0 @0 {& Y) u$ W! h) K__________________________________________________________________________
# k- {$ `2 v9 z- d/ h& [1 t7 G4 S" h9 Z+ H4 r0 h9 ]4 b8 e
Method 10
" J: w% \/ J& S0 a5 i$ Z=========: D6 I; B& m8 L( b/ e% [$ M
$ y6 }0 |( w& P  w- _: a1 G
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
- w$ {3 H- x" u( ]3 [  SoftICE while the option is enable!!
" h% O0 \7 b# i+ J  X5 Z
) v5 o+ h2 A- N4 j3 B( ?; MThis trick is very efficient:" Z0 s  b. P6 U7 y
by checking the Debug Registers, you can detect if SoftICE is loaded
8 B4 R, r2 J8 k7 z( R9 f(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
1 V2 m1 ^/ V2 B- y$ x: D3 ethere are some memory breakpoints set (dr0 to dr3) simply by reading their1 l5 n& v9 }! x& T
value (in ring0 only). Values can be manipulated and or changed as well
/ ^  |0 n5 l0 |& F2 K( V; Z9 b0 ~/ A(clearing BPMs for instance)
0 k8 y1 n$ ?( f( v; q' f) L1 t. W8 R/ V$ F* k3 M* ]: M. y
__________________________________________________________________________
6 M$ o$ O; I. y" f& h9 u0 D0 g" g( ?# G7 n
Method 11% v/ ^+ `! I$ V
=========; z8 A9 R: @' o" B" [; u  n
  i+ l7 r7 w9 X) P4 A9 L( v1 ^4 ?
This method is most known as 'MeltICE' because it has been freely distributed4 h+ T. \, b3 B3 R! K, A! t
via www.winfiles.com. However it was first used by NuMega people to allow
* m/ F3 U. v( V0 cSymbol Loader to check if SoftICE was active or not (the code is located
: r8 t6 o5 c- f2 minside nmtrans.dll).5 V. B' z5 S. d$ K- x0 T1 X
( p* ^4 W7 g7 R
The way it works is very simple:
& }1 [3 ~- A9 w) b" dIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for. x) ]6 o  O: z- Y4 L
WinNT) with the CreateFileA API.+ R/ A, ]) D2 f& G8 c6 G9 Y

: D. L6 ~- T9 Q# E# k' aHere is a sample (checking for 'SICE'):2 ]4 y/ t: x4 ~6 E

: q8 K4 O& u8 DBOOL IsSoftIce95Loaded()
% o$ y/ F( q7 T' Q* \{& e) R  t9 O6 P0 \* _' B
   HANDLE hFile;  : L7 Y  J* b& d% f
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,! L" `) x2 h2 x
                      FILE_SHARE_READ | FILE_SHARE_WRITE,/ k' e$ S8 }' K5 }) t1 G
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
2 V4 D; b) F6 G$ ~4 s   if( hFile != INVALID_HANDLE_VALUE )% H7 y+ k% F3 F4 h+ h
   {* |, {+ ~9 D& N4 _# a* `
      CloseHandle(hFile);
  z* m/ u) {# O4 i* |( g7 r  v$ \      return TRUE;
  N. t6 e( `& N4 _; P  G$ @1 t   }6 r/ b) Y& P% e! f6 `
   return FALSE;
$ _; W" J  L6 ^! Z+ E) E' v) V1 X* D}2 i2 _# H! x/ C7 p, m* V
  |( {, O8 F% n
Although this trick calls the CreateFileA function, don't even expect to be
* R4 [3 N$ a5 S  _* }8 cable to intercept it by installing a IFS hook: it will not work, no way!
" R* W8 z4 j7 hIn fact, after the call to CreateFileA it will get through VWIN32 0x001F
- V- i+ l  Y; M% ?* {$ pservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)4 i; y/ V, U+ v/ g
and then browse the DDB list until it find the VxD and its DDB_Control_Proc( C+ K8 B0 ]/ m8 t9 |3 V: r
field.) Q$ v" D  W/ c, A! e# V
In fact, its purpose is not to load/unload VxDs but only to send a
$ F- ^& \% ?% G' O# `W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE): b5 r, D  {9 i4 E- N
to the VxD Control_Dispatch proc (how the hell a shareware soft could try
6 s6 e! W, K% F0 p. {to load/unload a non-dynamically loadable driver such as SoftICE ;-).: a- P9 w- D5 T0 h
If the VxD is loaded, it will always clear eax and the Carry flag to allow
' C7 ^4 y5 ?9 Q) u) |3 c6 Pits handle to be opened and then, will be detected.! V4 [0 |1 k0 R% m4 Y
You can check that simply by hooking Winice.exe control proc entry point- R. K6 H6 e" \; t) ~
while running MeltICE.
- p8 b) K5 a0 S, G8 t% u
  R9 u2 l5 F  E4 Y- j. a% g8 X: N' y% _$ ^& r
  00401067:  push      00402025    ; \\.\SICE( j8 g4 Z2 p- }" |" i
  0040106C:  call      CreateFileA, N/ H( U& j: }$ b5 H& h
  00401071:  cmp       eax,-001
1 v/ z2 O: K! K, N  00401074:  je        00401091
8 ~; `7 S! L* w% i; t& D3 t+ V2 W, h# v: m# C

' ?' k) G8 D$ P/ v& m, u- FThere could be hundreds of BPX you could use to detect this trick.
% k( o# L; |7 f) O) V-The most classical one is:
& \1 o! l. T7 p( O1 r" q, E: A  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
( |& ?/ R  e3 r" H/ _    *(esp-&gt;4+4)=='NTIC'
4 j  y$ o, I, ?. b
2 ~8 d+ a" R% G-The most exotic ones (could be very slooooow :-(( w' t# x7 R3 h3 Y/ C' e, W1 ~
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
1 Z/ V$ ]& D# p     ;will break 3 times :-(
/ p1 t  W& P+ [! n0 D
* Z8 X& j. N/ [+ z; ?-or (a bit) faster:
+ r( m* B2 Z) o- G6 ^   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')' O8 x% j8 p& K8 m$ E  g9 O+ z
& c1 _  O( @0 m5 i. W. t
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  0 L( J4 h1 D9 [% k
     ;will break 3 times :-(5 n5 {1 @9 W$ K  u2 L
7 G! M5 J6 b# {/ @# \) v: F
-Much faster:
9 X7 P) U  ~% `. S/ D  f6 T   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'& B4 x+ K: X( ~* a# ]# S! X1 S+ C
* ?- j/ X6 h2 l
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen$ L4 d* k" h# Y
function to do the same job:
+ f9 v6 }$ K. [" M0 d! q5 L( v+ u8 f  \8 H
   push    00                        ; OF_READ
$ ^. \" p3 P: k: r+ J   mov     eax,[00656634]            ; '\\.\SICE',0+ f! z. o9 F2 g
   push    eax  T8 }" }- Y, D4 j; D
   call    KERNEL32!_lopen9 Q4 V( o( [2 {6 M/ F6 N% |
   inc     eax
- C) C7 A* m' {. A% ]   jnz     00650589                  ; detected, L/ t# [2 V, A" k) z0 J8 P3 P
   push    00                        ; OF_READ
- A7 ^: ^' @4 T% S& q2 K3 x/ W   mov     eax,[00656638]            ; '\\.\SICE'/ k9 @; a5 T5 m' b. S
   push    eax6 E% O, K- B- r8 L/ F; x
   call    KERNEL32!_lopen1 \3 @, P1 j- J7 [4 g# W
   inc     eax
6 j  n6 N9 k4 a) C' V   jz      006505ae                  ; not detected. ?% K- Q+ i) s! u$ F0 }+ ~4 j$ O

/ E8 P# ^- m4 y: a- D( m; O
. U/ \$ n) I, a8 @5 a2 I* s__________________________________________________________________________7 J: t3 M/ }$ z$ R
! F% g% o' D9 t3 m5 B6 e) b
Method 121 C1 G4 A2 \9 J% @: x5 u& C4 r' j& J7 C: F
=========
' @: T( \1 s, N% E* X" ]2 [( K$ d/ e: j# m. e, j" e
This trick is similar to int41h/4fh Debugger installation check (code 05
# O( F9 K1 c- c7 H' U&amp; 06) but very limited because it's only available for Win95/98 (not NT)
: D5 W! B. L- u0 i8 |as it uses the VxDCall backdoor. This detection was found in Bleem Demo.
* x: I; p1 i/ d! s0 b9 h2 r* N" g8 j7 |
   push  0000004fh         ; function 4fh
9 w4 D; u7 C# ]$ K" o2 @1 |) _8 h   push  002a002ah         ; high word specifies which VxD (VWIN32); J6 P5 j/ a: K2 N
                           ; low word specifies which service/ O' ?( O0 S( Q2 P' k* ]) `7 q
                             (VWIN32_Int41Dispatch)
- t8 G) |& [% I- X: p$ @" s   call  Kernel32!ORD_001  ; VxdCall
0 F* a2 q; f6 T+ b   cmp   ax, 0f386h        ; magic number returned by system debuggers) u0 J& M) |" X, H' t2 M
   jz    SoftICE_detected0 i# D. D7 @2 f5 J
- L0 S' A' D6 R$ u+ j* w
Here again, several ways to detect it:; t* w, o4 y4 a" K# J$ O

& \" k7 g* l- b0 c: y" ]    BPINT 41 if ax==4f
( p- Z. G- P! G3 g: B. k
4 [  B  S; n8 w1 ]    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
8 F% b  ^# H. p3 M, p# Z
* C) L' r! p  u2 t! s$ I    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
* K. d3 y. H8 B6 F) T8 U
8 O6 {5 ?# t  w1 r. w    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
( u6 ~7 E+ c+ M
& ^) Y, Y1 f4 |: ?& k" z__________________________________________________________________________
, H2 t1 x, P8 V9 i! t+ f, O/ Q, D! F! D; a$ Y
Method 13
5 `- M& ~: C& i& z. u=========/ F; k! e0 J' f

6 ]% d+ B+ p& f1 k- @Not a real method of detection, but a good way to know if SoftICE is; {7 f$ U1 F4 \. p$ j% V1 g9 z* `2 E! P
installed on a computer and to locate its installation directory.: _9 v5 V+ j3 T5 _6 c7 |3 E
It is used by few softs which access the following registry keys (usually #2) :) q7 l& y. D+ Z8 p# p% f6 z

. A# G% W& A9 Q3 h8 D' w' d* m- u* \-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
3 U2 {, n/ h; A9 K\Uninstall\SoftICE; L0 n8 f; p, ^
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
5 @6 i  S- Y# L4 h' @! e. g8 X* s-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
# v1 f- D/ m! p- m  P0 |1 K6 K! ?\App Paths\Loader32.Exe+ c  f2 x- H0 a
" p! c2 |7 \1 y2 T% X2 U' P
, A# U( V# x( K5 j: s9 p
Note that some nasty apps could then erase all files from SoftICE directory: J- U. [) U  u& H5 ~/ w
(I faced that once :-(
$ Y2 X2 D* @3 m7 V- c, ]
: ]- L1 W* @) q3 M6 q6 pUseful breakpoint to detect it:
  O5 D% A& b6 C7 B1 y; H) p) ]6 H- Z
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
: p' c: P& x; u  B
: M/ ?. @3 k8 U6 z4 U: f__________________________________________________________________________3 Q+ F+ f0 w3 e2 K9 s

! W  r6 V1 C2 b- ^) K7 R4 b" }. V6 M: z5 b  r* B
Method 14 ! l. ?* |% \" s0 p4 a: d2 Y+ o
=========
) N' I4 i3 n8 E/ B2 Y$ x  P/ F1 B* i" t3 `9 {+ j
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose3 v% X  j  G' J) C+ X+ m
is to determines whether a debugger is running on your system (ring0 only).2 ]0 }; O/ s  w7 N; t$ k

, {) Q; C( y3 O# b& \   VMMCall Test_Debug_Installed' s3 K. q  Z& A7 t/ O9 h& w+ \
   je      not_installed2 T& f4 ^8 U. a  z  d
2 ?0 @) Z9 n/ U% G
This service just checks a flag.
5 c) h" A. S& ~/ Q6 S</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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