About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
0 e/ d) w  F7 F* Q; Q<TBODY>
' f4 L- n9 i" g: r* p" j: c<TR>/ \" M. Z% w2 N, R+ K) D  p. e% Y
<TD><PRE>Method 01 $ d5 [# Q% |  y7 K$ p# Z
=========
5 Y3 L& c  B% t/ Y
, {% O; v' }$ \" u" |8 OThis method of detection of SoftICE (as well as the following one) is3 I4 O9 e. [% X8 K/ m6 z  u
used by the majority of packers/encryptors found on Internet.
# ]  [7 x  J( i/ a+ @$ hIt seeks the signature of BoundsChecker in SoftICE
" ?! v2 \+ M& t( u
- S7 g, U2 [2 W. G+ V! h- A6 x) c- A    mov     ebp, 04243484Bh        ; 'BCHK'
& i0 S& S, h7 I$ W    mov     ax, 04h
2 {. [) v% B" U/ T; N% [1 z$ D" {    int     3      
' _" t) S% G* N$ c    cmp     al,4& M; C; Y- {0 K
    jnz     SoftICE_Detected) a( o8 R6 h/ S* g0 ^3 m2 i

2 C3 _' B, X9 ?: ]! ~5 L8 W" ?. a___________________________________________________________________________
1 e5 ~' O( i  V. ^7 a- b# x9 f: j3 p$ r, X
Method 02' i- B- l, h' i( i4 G; f
=========
; j  y0 X0 k1 r3 O, m" U; ~! U/ Z" h! g) j
Still a method very much used (perhaps the most frequent one).  It is used
( {  X0 p) X7 D, ~( B/ e, Uto get SoftICE 'Back Door commands' which gives infos on Breakpoints,
, w# h; m( ?( |  Uor execute SoftICE commands...$ f: ~( c# Y& U" `
It is also used to crash SoftICE and to force it to execute any commands% f1 a# D: n  [& l
(HBOOT...) :-((    ~# d# }: P5 Q( w

3 [, |; t* b/ S/ D, @% WHere is a quick description:' [6 G5 p& l, P* T4 j3 C( N0 @+ E
-AX = 0910h   (Display string in SIce windows)
4 F/ b) m( D( r. F  z-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
8 E$ [" O+ _' H& D-AX = 0912h   (Get breakpoint infos)
  z; R0 b$ q) C* c0 F2 a-AX = 0913h   (Set Sice breakpoints)3 L9 u. g: j$ y0 @# ]; R& b
-AX = 0914h   (Remove SIce breakoints)
! d- k% o# U7 Y8 e  Y+ F" y, L! A) C' C6 g' b7 P
Each time you'll meet this trick, you'll see:. V/ `% B$ u$ z7 v) D
-SI = 4647h) h7 F2 [/ s% N- }
-DI = 4A4Dh
. z. `2 ?8 g/ U$ @# y2 {Which are the 'magic values' used by SoftIce.+ D. ^5 J. M) X( V
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.7 L4 z& S0 {+ _. ^  h' i& H
' K/ ?; t+ b4 C, F/ T+ Y2 m
Here is one example from the file "Haspinst.exe" which is the dongle HASP/ o9 P" N& u8 O6 B1 E
Envelope utility use to protect DOS applications:1 H' r; U- T. [6 {8 O: p; r8 s/ p
& a% Z6 Q- `- G7 {% i. J+ B+ @

2 [$ I# F* T9 S% @4C19:0095   MOV    AX,0911  ; execute command.
( o4 z: W+ t. e. D8 j4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
, o( \6 b) y% \" T4C19:009A   MOV    SI,4647  ; 1st magic value.
' W* H* K7 R4 r9 Z4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
/ A# C( n1 v2 n! C# N+ N* q4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
0 ^4 e9 c% Y9 L" ^" \3 S4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
, f# X# E! X. }. d; S" v4C19:00A4   INC    CX0 C( o7 Z( l) o) ~4 Y1 s/ e( n
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute9 L# s+ A' F7 I' m& k. e2 ]) D2 w
4C19:00A8   JB     0095     ; 6 different commands.
( F; z: E! {/ m  l4C19:00AA   JMP    0002     ; Bad_Guy jmp back., ]* r: T" d6 w- i, O
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :); F0 I  Y; a8 u$ U' k; E- `
4 b, a  H( O$ a( a( S; e
The program will execute 6 different SIce commands located at ds:dx, which
, [: W9 [. k+ m: uare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
3 l+ F4 S; x: |; X9 `
6 A9 d  |+ \, s0 ~2 B3 H1 q4 a9 U' ]* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
7 X& k4 k) [4 Y( w- J) k; w___________________________________________________________________________8 ?7 V3 D& l0 ]6 i

9 N. [! x/ o4 k- d7 w' ~0 V4 U7 z# c5 g( S8 s7 V, |! Y6 Q
Method 03
# G0 h" L0 d6 i* q' W, k=========; x- r8 L. r: c+ u" s  }
6 {6 q; I, Q/ A3 ?7 L7 M) C
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h! V) g- ^' ?% Z" }# z3 [  o
(API Get entry point)
# H, F& Q% I+ I+ t" G4 W        . ~4 p- j' ^) w
( l1 q2 b# O1 B
    xor     di,di2 o# F! c. I6 _1 g4 Y0 H% [  o! @5 K
    mov     es,di
. f; Z0 {  c  Y9 ?( p- g. v    mov     ax, 1684h      
0 T# U. y9 T3 X6 l1 N8 k    mov     bx, 0202h       ; VxD ID of winice
8 F4 U) z! l# ?    int     2Fh
) L: U1 r, o0 A' Z1 {# e    mov     ax, es          ; ES:DI -&gt; VxD API entry point
' |. \$ k& l! D1 ^! V8 v# P    add     ax, di( i( |; u1 ^4 {# y* A' I8 e
    test    ax,ax
+ G$ I3 ]- ~; H    jnz     SoftICE_Detected9 e2 w& r6 \& F6 c2 n8 a/ @
# j  d. |! J. z/ d  B+ V& A
___________________________________________________________________________
; j4 z* U# ?+ V+ d5 m  d" @
6 X  F& A8 z( Z9 W+ mMethod 04
/ N* l6 D" f: O4 a5 w" O+ }9 E6 K=========
+ s0 [4 m! q6 J+ @
3 \: z1 P/ E/ u0 L8 X! dMethod identical to the preceding one except that it seeks the ID of SoftICE2 F9 n! d- A% R- i* R# e8 F
GFX VxD.+ i) f& p5 ]7 E! |0 e9 \
6 ?) s- z7 z6 S2 w; Q' k# q
    xor     di,di6 U, F6 k% F9 a. z3 ?
    mov     es,di
% f5 _% y9 E% T' h4 C$ S    mov     ax, 1684h      
. ~) G; r" X2 N* t- ?2 x    mov     bx, 7a5Fh       ; VxD ID of SIWVID
# X0 C" k- g7 b    int     2fh! ]: `8 ?2 L4 n8 v
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
) F. e9 ]& `; G  H    add     ax, di
% p( G! d9 O  Q  j+ P4 f& `    test    ax,ax
- @8 d, W$ z2 p/ i4 b; g- \    jnz     SoftICE_Detected+ [- K% t  Y. t6 g9 M$ }
+ X6 H  }) W9 E* Y* k
__________________________________________________________________________
3 i: _6 h, o( C' }% t
6 O9 R5 B# H, I8 y  N: i. s7 z4 n4 \. L% J; }" F, ?0 l: \
Method 055 Z/ p% M7 F0 {' ?' P( W
=========+ b1 {$ O5 V0 C* L8 }& \

' Q* V. |  n4 nMethod seeking the 'magic number' 0F386h returned (in ax) by all system
- U  A) N; {* D; ydebugger. It calls the int 41h, function 4Fh.' _2 T- X& N/ `& k8 M9 r
There are several alternatives.  
6 X8 \. `- C* g/ i' H. S9 x# K+ F4 a: L* m+ P
The following one is the simplest:6 `/ N( Y: ]3 u' q! j

2 p5 n7 h5 h. h7 `) S! O% H    mov     ax,4fh
' c. c9 A- `; m- R5 U6 a$ B. h    int     41h
+ }1 j9 d1 G4 }& {  r5 X( h4 h    cmp     ax, 0F386' Y2 N: u4 j4 k  A3 o
    jz      SoftICE_detected
$ `! S9 s: z: M0 V3 _# R. c& _4 L( }" |. E6 g( v" _
0 R) a+ x! I) I( i: A6 x9 L  \1 G0 F
Next method as well as the following one are 2 examples from Stone's 9 [( f1 g1 ~% E, n7 h! |! m, g
"stn-wid.zip" (www.cracking.net):
, W# Y& ~- a" y& |' U
/ B3 A( s4 d/ u# ], }/ a    mov     bx, cs
0 S) \9 R" M2 `4 B$ `& o* ~5 Y    lea     dx, int41handler24 W/ _/ b- [7 @  l" w$ q
    xchg    dx, es:[41h*4]
; [2 i  n  M, H: R/ d) Q. N4 ?    xchg    bx, es:[41h*4+2]
* S; K- \+ ]* a, L3 C- ^' Q    mov     ax,4fh3 z- X# j, B7 E- i9 @
    int     41h
9 C7 [# n7 ?% `2 T/ R" h  p3 L" S( U    xchg    dx, es:[41h*4]
6 ?5 @$ l# I$ E0 Y    xchg    bx, es:[41h*4+2]
2 ^1 ]# N5 {" e. n, S    cmp     ax, 0f386h
; E9 Q0 d5 z- b" Z" _/ o    jz      SoftICE_detected
. q7 _) ]0 ~1 j2 g$ ?2 i7 Z9 c
. n) Z4 j# h* x2 }int41handler2 PROC4 o8 P# A+ M. \* ?0 Z1 j* G1 r3 G
    iret
/ A' d: ?6 y# F6 w9 l) R# y0 G6 |1 i$ rint41handler2 ENDP0 g% d; t% d# @- ~* V' K: P; S

4 v# F+ ?$ p' J& ]. A8 ^6 e% T' m+ J: l
_________________________________________________________________________
6 r1 K+ L; {4 V3 }5 A% ?# S% g/ [( i
+ x7 a' K) q: |: d: I1 p
Method 060 U0 E5 p8 \( [
=========0 E0 I4 \8 E& n1 ^6 a+ l/ n. D

" |- }$ o3 c) T) ~0 O+ u
( x- w) h9 _& @2nd method similar to the preceding one but more difficult to detect:. k. @3 p# M0 Z' {: f! y

; {( N! w$ ?4 V' {( K7 F( Q: B+ E0 Y0 y
int41handler PROC
8 \9 C) u' U+ p- N    mov     cl,al
- M5 Q, z- d2 T5 k) K    iret8 A! [" K, t' G1 C: B1 U5 @
int41handler ENDP
" M: G1 r& _. P% F& F. J  i* o0 a  J

# O9 i2 q  L7 Z    xor     ax,ax9 @7 g. f! W# z2 U# P
    mov     es,ax5 a( n$ P( z7 T9 T. P8 O
    mov     bx, cs
8 B; i% d8 V3 h. w" R6 a    lea     dx, int41handler
& r) S& W* z! _! b2 x/ v    xchg    dx, es:[41h*4]2 O+ a4 Z8 i8 @6 w
    xchg    bx, es:[41h*4+2]
  Y- N2 @8 t/ Z, P: p    in      al, 40h- |1 B0 w0 r! _! E8 c* w8 s" c% p
    xor     cx,cx( l  B- i. n3 d+ U0 D. @" J9 v
    int     41h
: u- }) S" U3 }    xchg    dx, es:[41h*4], a; T0 c' z# ^2 j
    xchg    bx, es:[41h*4+2]4 j% w3 m2 \) K6 y! z' c5 R
    cmp     cl,al7 U. i2 J, H0 R* b2 j
    jnz     SoftICE_detected
, V4 U6 L1 U2 b0 L+ g8 J5 B2 N# x+ `2 t
_________________________________________________________________________
4 {, G& P2 C) b' d& u# ^* Q
& u% C/ ]! K. p$ ]3 B# AMethod 07+ t" R$ ]6 g; L4 t
=========* c6 m4 O4 M- T6 u
& B% p7 @8 B' o% ?8 s3 ]
Method of detection of the WinICE handler in the int68h (V86)0 }& f6 H8 e( U+ ?; u
( C4 V! c% C( r0 R
    mov     ah,43h
8 G& P( p. f7 [2 x* ]1 B. n' X    int     68h, j) {) S& P+ o! {0 N( j
    cmp     ax,0F386h8 f1 M/ z; a+ y; k9 A- w% @0 {8 b
    jz      SoftICE_Detected7 q* g. {! G' Q( D$ [
+ t, Q( f( V' y' K! W# a
" e3 X" A# U$ M) H
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit, i: }- x7 H7 g8 r% C
   app like this:% J; e8 G! Q3 d9 ~: I/ Q3 a# t

+ _. D7 U* a9 Q7 B" }6 O   BPX exec_int if ax==68
7 r7 g) Z" ^6 M- g9 g6 d& h- @( V   (function called is located at byte ptr [ebp+1Dh] and client eip is
9 c' k. l# F5 M1 H! g   located at [ebp+48h] for 32Bit apps)
5 z% t+ q% h5 P; Z; l# l* i__________________________________________________________________________/ q9 g& ?8 l. |

5 m! A: c3 d8 x/ \# W' i# y
$ P2 \! W( V. lMethod 08
: I& U7 F* |/ i' A+ V; i=========% f- ?" L( z3 n0 `9 t! ~; Z. _
& p, D9 i) ?0 @8 Z' q
It is not a method of detection of SoftICE but a possibility to crash the
. K% a" r& Y7 K( Qsystem by intercepting int 01h and int 03h and redirecting them to another
9 e' C9 i1 e/ B# w- _# |( kroutine.5 o2 x: n$ S' ]8 E3 q- g
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points# E1 \* h5 Y, i% E1 e2 e, _2 {/ ^
to the new routine to execute (hangs computer...)% r4 z4 k4 p  o, X# N( t6 H* l5 B

" f; [7 }- F: R' Y    mov     ah, 25h
+ O" ~$ r. x/ {2 \    mov     al, Int_Number (01h or 03h)6 p% Q7 s3 K$ T0 n" ?
    mov     dx, offset New_Int_Routine/ O/ ^7 Y" A& Y" J
    int     21h
5 v4 H7 h& N- ?9 c5 L1 ^5 I9 F- v1 Y( t: s$ I2 q
__________________________________________________________________________
3 P2 M2 s" c$ j- u
, h: F  ]5 N5 B3 w* D  OMethod 09
8 U- `1 G; s  l# f5 G* v=========% r* g; W8 v( f, ~
, n, e; H1 l8 w, T" j8 T$ S
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only  T/ f7 X5 ]! J; B; U
performed in ring0 (VxD or a ring3 app using the VxdCall).
' D/ p9 [- P+ a% n- a7 c% _+ q/ @The Get_DDB service is used to determine whether or not a VxD is installed
& H8 D: R8 ?7 J6 R* \for the specified device and returns a Device Description Block (in ecx) for
+ {) ]9 W+ G: C, I/ i" h. `: Ithat device if it is installed.
8 S6 Z, k* x' Y' k
: `# j0 E/ Z+ Y& Y+ c6 Z   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
2 V* m' q6 O! B$ D   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
$ ~/ D% X; U2 q, k   VMMCall Get_DDB9 I$ H8 [' j9 `* N) z
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
2 k; d& g) E- p' e
6 g+ u3 w) g) L4 J) n. CNote as well that you can easily detect this method with SoftICE:" ]) B, u' o- M/ u! a0 t: S) D2 L! x
   bpx Get_DDB if ax==0202 || ax==7a5fh9 r) I1 U" J6 ]  p3 f+ Y) m% r

& t6 z+ \9 ?3 @+ S5 ~7 z__________________________________________________________________________& ?( c2 i9 a, g! x" I! [
- O: P0 B% G3 B4 }
Method 10
: L# q2 a( H" N8 a" h9 L=========8 c, Z$ C1 C4 k9 e5 B! j

/ X7 L3 Y4 j, O" |=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with6 x- a" Z8 f# w. }1 o
  SoftICE while the option is enable!!, X' L& ]/ \$ B' _3 R& l6 `2 l
! U! c; D" ?8 x& H  p8 o
This trick is very efficient:: c8 M5 v, @( v  ^0 a
by checking the Debug Registers, you can detect if SoftICE is loaded
' X# e; |; a- T& s3 C0 l3 G(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
& [- P# m. R! ^' ~0 d3 Ithere are some memory breakpoints set (dr0 to dr3) simply by reading their
4 m- h5 E/ k) E( gvalue (in ring0 only). Values can be manipulated and or changed as well5 E) g) Y, O4 b* f: w) k; q
(clearing BPMs for instance)3 Y5 I$ @" W7 R4 F2 K% S( p
: o! r7 a0 h  `1 m# o# C
__________________________________________________________________________- D8 f3 C0 ?/ q! B, }: Q' z, A0 D
, Z" i0 P6 b7 A8 ]
Method 115 W  u  j" I- D2 ~
=========
0 H( q+ @6 M! _5 k% t0 b& ~( ^' d6 c) m
This method is most known as 'MeltICE' because it has been freely distributed
: J; H1 y- m8 z8 c4 x0 Avia www.winfiles.com. However it was first used by NuMega people to allow8 s# R% M, `9 p& E" k
Symbol Loader to check if SoftICE was active or not (the code is located, o$ L: n* s9 Q0 _& c) Z4 x( I; u
inside nmtrans.dll).) _9 z! s9 v# T3 }( B1 @
- C  P4 Y  I" v$ K6 ~, e
The way it works is very simple:, N! \' N5 f! U/ [9 U! H
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
/ _  z. s& P3 D% K. Z( NWinNT) with the CreateFileA API.) ]9 s8 E8 E- j0 j
7 u; u& Q' l& a9 k# \* _. n
Here is a sample (checking for 'SICE'):/ ^, D8 d, x: p4 v* k# h$ a

6 S9 f+ @) i* v7 ]6 w* BBOOL IsSoftIce95Loaded()
( d  W2 v3 G; s6 z# E1 k1 `& L{. w# ^5 e9 U: n  P$ T/ O
   HANDLE hFile;  0 f& k, w0 b1 `& k
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
2 m% }  I2 T/ @) U+ J                      FILE_SHARE_READ | FILE_SHARE_WRITE,9 V9 k3 M6 G& }2 C% e
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
- K* O5 P. h3 s7 K# R, K   if( hFile != INVALID_HANDLE_VALUE )) f" {  Q& |* d5 s% N
   {
3 n2 l2 `; W- Q- K3 E& M1 x; x      CloseHandle(hFile);+ ^4 P, J' Q- c: v, X% v
      return TRUE;# ~! O, D6 ?6 W/ q
   }
( L6 j& P  L1 _  P. \* N   return FALSE;5 [. I) `, J* Z2 M2 \, @$ y
}
+ a9 M* ?. q2 a; Q( \0 C
( B2 s- X% q5 x' Q. |Although this trick calls the CreateFileA function, don't even expect to be- G4 U5 X9 U7 m9 J
able to intercept it by installing a IFS hook: it will not work, no way!$ U' G3 G) o0 X8 T7 U& Z4 t4 L- y; q
In fact, after the call to CreateFileA it will get through VWIN32 0x001F
: H7 q- h$ S1 W% zservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)& B3 x& k  E# t6 v& T7 u  p
and then browse the DDB list until it find the VxD and its DDB_Control_Proc
4 U" `( w- ~* p) w, Y! L4 ofield.
# p; ^1 v* J) f+ z. UIn fact, its purpose is not to load/unload VxDs but only to send a $ ]) X2 R* z" \% t6 i) R6 Z; D8 W, F
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE), [+ `! {# o5 [
to the VxD Control_Dispatch proc (how the hell a shareware soft could try/ L4 c, q9 n) D$ L0 i
to load/unload a non-dynamically loadable driver such as SoftICE ;-).' D6 ~0 N5 H- D- E. l
If the VxD is loaded, it will always clear eax and the Carry flag to allow
) I7 B/ N8 w  iits handle to be opened and then, will be detected.9 i4 z' N) ^6 y. l3 N7 m
You can check that simply by hooking Winice.exe control proc entry point) r: M, K: O/ L0 V4 j
while running MeltICE.
- E! L2 m( }) G" |* c. ~
5 X. E: N$ u7 T
7 j; l2 W; S) \9 ]# }  00401067:  push      00402025    ; \\.\SICE5 \/ V( D: f9 B  z4 D! @8 H
  0040106C:  call      CreateFileA
& R2 V, f- S9 T' r5 l  00401071:  cmp       eax,-001
/ S, R/ O+ d2 l; S$ ]: B6 l% ^- E& ~5 d  00401074:  je        00401091
. q9 l0 y+ Q8 p; v- f" a* B& O! H) X& T* r. f1 u3 P, x

. y$ {9 }+ ]' y" vThere could be hundreds of BPX you could use to detect this trick.6 {- A/ _4 q: @% x) d
-The most classical one is:" L1 l- a3 N1 Y* i
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||; ]. u) ]) Y* M  q# |! q% k. }
    *(esp-&gt;4+4)=='NTIC'; W; ]* s3 {; l: B1 j+ Q

- ~; N2 c$ d- Z  ^5 X: z! H+ \-The most exotic ones (could be very slooooow :-(& S2 }6 f/ |- X) @6 W; H7 t8 l
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  ) F7 X3 r0 z- l# c  X" ~7 M- x# f
     ;will break 3 times :-(, j2 y, }1 h" }3 p6 I

2 y) U3 g5 n* u0 i/ s- p-or (a bit) faster: 0 z7 ?5 z2 s/ O, r4 s* i7 m
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
6 q3 A6 q% D% d- G/ C0 s4 H! ]; x
6 u7 c5 `* F9 E" k. S   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  ; y. B: v" B. \, ^) [" p; {  _
     ;will break 3 times :-(
' T. S! Q; F5 ?# [, t; s( E
9 G; ^+ E7 D" y% k8 T5 T" {-Much faster:( d& ~' R2 t. N% G6 w( X0 h! d
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
  j- j  u& n5 p0 M' b( A% H
& J4 d( p4 x2 c' |" c4 b: D' d1 YNote also that some programs (like AZPR3.00) use de old 16-bit _lopen
* p/ R& h; x3 H7 `6 v: M: u: ~function to do the same job:
8 B& R! q/ x2 [
* q. i; M4 U" ^   push    00                        ; OF_READ
# T7 K0 o: a6 K/ A; x! P   mov     eax,[00656634]            ; '\\.\SICE',0
  x; m& T" E! p- U   push    eax0 ?: v& V/ f6 }$ H+ a
   call    KERNEL32!_lopen
+ P8 D7 O& s( z: [# ]   inc     eax
9 o1 Y9 v, V' z0 c( }   jnz     00650589                  ; detected0 I4 q1 J8 G) U. w% C2 Y: p3 v7 a
   push    00                        ; OF_READ
0 ?7 b; \/ k! Y# O7 d' J6 p   mov     eax,[00656638]            ; '\\.\SICE'* o, r2 |; i( O0 j- M
   push    eax% U# Z4 H3 J' g& P2 ^. c: N) f2 w
   call    KERNEL32!_lopen' D' Q3 l2 f. j% C0 m
   inc     eax% |6 V9 o8 k; B1 l" M" G; n8 `
   jz      006505ae                  ; not detected) u7 Y2 c+ y; a: ]  ~3 J

1 B9 F: t/ A% O5 d9 {8 c: p7 A& |" k0 U+ |" W
__________________________________________________________________________# C: {; \% q4 V% A
/ y- O* Z$ M, H3 x4 V1 G* P
Method 12
3 }8 F8 X& T9 r7 x1 Y+ e3 V  T: Q=========
1 c) ^& v9 G  H2 \7 Q0 n  ?( z1 m  ]1 [/ U; G( g) e4 x
This trick is similar to int41h/4fh Debugger installation check (code 05
$ R& W8 j* p, z# j% y&amp; 06) but very limited because it's only available for Win95/98 (not NT)
- z+ ]) S) m" P4 o2 o* p- J7 ias it uses the VxDCall backdoor. This detection was found in Bleem Demo.
- W; R' a- N0 V: M6 r# m  R  K" B  G; p. ^- m$ X' T
   push  0000004fh         ; function 4fh1 r. A, L9 _# f3 g+ p# s; j( p. u
   push  002a002ah         ; high word specifies which VxD (VWIN32)
" x9 o# v4 z! K' h                           ; low word specifies which service
9 P1 @7 `% k! I1 e% Z' S                             (VWIN32_Int41Dispatch)2 E! b  _7 f" M2 y2 m
   call  Kernel32!ORD_001  ; VxdCall" l1 a" B2 v$ y$ S5 n4 d
   cmp   ax, 0f386h        ; magic number returned by system debuggers
. c- Q5 @& u1 P! Q   jz    SoftICE_detected/ [: K9 x$ |* o! e% ]& K6 Q
: q" P# o( P2 {0 w* a
Here again, several ways to detect it:
' D/ d9 g+ i0 u7 \0 J3 O2 j" _8 h* @" e- h0 M
    BPINT 41 if ax==4f
$ k, ?; z: \5 k* t0 e, h, H
4 R  m& I+ k" L    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
* d/ d( Y; ~0 C- U) X" D
7 U( K3 E( Q0 }, C    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
8 R! W6 z* p, E; b( |8 h
1 e# Q+ z/ R2 I* o$ k    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
$ D/ D/ o  g# f- ^: D* y& e
  K; s& N- `# s  w__________________________________________________________________________8 R( @$ q8 l2 N" E0 ~9 B' t

0 j* ^6 U" i0 i, _( [4 QMethod 13
4 a4 O' O% `' F& _=========  ^4 ]7 q8 w6 t) u: {& C) t

8 x( j7 W" g* W: f; E( R( m5 sNot a real method of detection, but a good way to know if SoftICE is: I. a$ T) n- R8 z, B
installed on a computer and to locate its installation directory.
! ?8 }( D+ K* m; j& }: r; {* _It is used by few softs which access the following registry keys (usually #2) :
: i4 e$ j) V6 j! K
" p  K. _. n2 ~# X-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
5 L/ _0 x3 G! `# @" a\Uninstall\SoftICE
' ^6 e$ q( B+ Z# _7 i; k# c' ^7 q-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE& ^, m, i6 N3 f- ?7 ?) Z
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
3 v) \& g  q9 b" Z" @\App Paths\Loader32.Exe
) T6 P! G  A+ L* t$ G9 @. {  u$ @% x) O6 T
6 p, \5 j. x. h& V- n
Note that some nasty apps could then erase all files from SoftICE directory
5 K; ?4 `$ Z  d' c) C' A(I faced that once :-(9 I) {+ y) X& M! g
" @7 b* ]+ ^+ |3 ^: r- X' X
Useful breakpoint to detect it:
  u6 I% q' O9 N9 H6 C( ]0 E( J3 c6 J
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'8 G$ b9 r! J- B; X

2 U8 T4 C/ q- i/ c5 q: r__________________________________________________________________________
- A! O, P  `0 Z. K7 f, O5 R/ t- Q6 M: B* ~, Y

" d4 ]" v& C+ ]( YMethod 14
  R( Q  P3 |0 i, e=========
+ Q8 R1 D0 {" P% E  j9 \0 x' {9 i
* p# b& d4 D; @) Z. ZA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
. ?6 b2 s1 M* D7 E. Q5 \# n0 b& S3 jis to determines whether a debugger is running on your system (ring0 only).3 _' G1 |. J1 w6 ~3 m( c

4 ^# `: u' r4 U  i6 K% z; Q, @: G   VMMCall Test_Debug_Installed
# O, C4 \  r5 Y   je      not_installed3 S( u$ @: F) I% l: W  Y  F
7 u+ d1 A" C5 {5 S
This service just checks a flag.3 b& J; X( _( ]8 e* ~9 ^1 ~/ |
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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