About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>: q: \9 A: D0 |' K4 \
<TBODY>" f) e6 ?0 j- X% e
<TR>9 g( g" x. j% o3 s
<TD><PRE>Method 01 ) l# W: N2 b: i9 f  D4 n( Z6 Z2 Z
=========
/ P# r$ P7 p; w" i4 x7 l
4 Z; M: J* m0 H) A& n2 HThis method of detection of SoftICE (as well as the following one) is' O/ `0 }4 d+ p6 g4 ]
used by the majority of packers/encryptors found on Internet.
" l; n! A  z: T- F, q6 DIt seeks the signature of BoundsChecker in SoftICE
) x$ c" V. F! A' _2 Z; z% K2 k% P  T( f- W
    mov     ebp, 04243484Bh        ; 'BCHK'/ A* [' D0 o9 c: t9 l
    mov     ax, 04h
5 U4 u3 p+ x  D  b# W3 z" J/ x    int     3       * {8 N) v, z$ {
    cmp     al,4$ n3 g, }+ d; u* `( _
    jnz     SoftICE_Detected
- f  H/ m8 Q' b! G$ M* {3 ^" K6 A6 G
2 W& c  M2 W7 f" V5 W. P) {; @% V___________________________________________________________________________
& T1 ~7 v1 ]8 V9 t. q8 {) h9 ^( W2 x7 u: R, m9 @
Method 02, \8 t2 @. T. A$ ?% S1 E  a
=========+ h: [5 q3 f) K5 j

* L8 ?0 B% L; j1 p. W+ P' z0 QStill a method very much used (perhaps the most frequent one).  It is used( c( [7 X8 I6 H- G  A
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,
* C  w$ k: d8 _& @) X0 g1 _' Y1 d- eor execute SoftICE commands...& O/ O8 I" R, l* ~1 r
It is also used to crash SoftICE and to force it to execute any commands
; o8 }: e" G) r(HBOOT...) :-((  ; d: Q6 E% y/ Z
+ h5 K5 @& `( Y' c. U! T( |
Here is a quick description:3 p- L% u6 r: E# O! E6 g
-AX = 0910h   (Display string in SIce windows)2 @& ^: d, K5 j- j3 C& U7 P) G' I) h
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
1 j" F  ~* y7 o; c-AX = 0912h   (Get breakpoint infos)
6 f% v8 V) A2 k& x( x8 {/ w4 q& \-AX = 0913h   (Set Sice breakpoints)' V9 _- A; \: M: S/ W# ?
-AX = 0914h   (Remove SIce breakoints)/ \6 w3 X+ m& G" [
! \; a! H7 j  C8 @% e4 R
Each time you'll meet this trick, you'll see:4 U( J( Y* K, y
-SI = 4647h3 J- Z& c( G% D- r& u( V
-DI = 4A4Dh
/ g: ~/ f5 v, IWhich are the 'magic values' used by SoftIce.
! B9 s4 m1 N8 y* q* UFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.
$ I# c* r6 D0 x4 U1 Z# e& l
; m1 W4 l9 t; H: {: nHere is one example from the file "Haspinst.exe" which is the dongle HASP/ M' Y, B  F6 A* H; A" ^; g8 E" l
Envelope utility use to protect DOS applications:
6 `7 ~7 C# U1 ^9 t* U
( m) X8 Y) E% V/ V
3 e" ~+ Z7 O3 S) {4C19:0095   MOV    AX,0911  ; execute command.
+ \6 k4 m8 ^  r2 U6 s5 e4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).- i; e0 i; w* ^  r1 U" y
4C19:009A   MOV    SI,4647  ; 1st magic value.
/ Y, C( B6 s* w3 F$ I4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
- u4 \5 A* l, h4 @5 u8 P, |4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
) n$ c  _2 v& j  k4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
$ l1 _" j0 v1 |/ L4C19:00A4   INC    CX- j) X$ e- }* u. S6 Y0 v1 u$ l
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute1 n1 u  F2 g0 K
4C19:00A8   JB     0095     ; 6 different commands.
" l% X/ J/ j3 \  z7 o- h4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
2 c# j7 P  x$ c6 `& N4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)  c* z8 N8 F. M. O/ q
% ^  T+ a  x2 j
The program will execute 6 different SIce commands located at ds:dx, which
0 w" N: @2 M1 M5 L# `" Y' Xare: LDT, IDT, GDT, TSS, RS, and ...HBOOT." b4 p3 ^: j+ h* Q

0 C' b7 f$ g, E* t! I" I1 q! O* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.# d7 w* \2 ?' j8 a+ h
___________________________________________________________________________
! O- X5 A0 b1 A' K$ x  A9 N4 t: V7 {3 A  D

9 f# S, G7 v6 r& A& g2 W# tMethod 03) m8 y4 b4 {$ w
=========8 n. [7 r+ k* t+ X/ A

/ d, g* `2 j0 m4 KLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
: v: v. f& }, ?* T, O- R% P(API Get entry point): P3 }. i# S9 f/ s
        
1 }0 p& F: x! N3 K6 f" y& p
# I. i3 C+ z; \7 |1 w    xor     di,di
: @0 R% y7 J* x7 V5 J    mov     es,di
$ E1 C1 m( {# }( y    mov     ax, 1684h       / U! W4 B4 Z: E( {$ T. z
    mov     bx, 0202h       ; VxD ID of winice
  h0 S; h. P/ t9 O+ L' k% I- F    int     2Fh
2 S3 X& p0 J, o  [3 e% C    mov     ax, es          ; ES:DI -&gt; VxD API entry point: L, ]% S) L' }0 m6 p/ X
    add     ax, di/ s( D/ v3 D) S, x
    test    ax,ax& K) K2 R  n& @4 E* R
    jnz     SoftICE_Detected5 O* G, S) q2 b5 E

! W4 n0 t! G+ N6 R! `$ s" a3 ____________________________________________________________________________$ O& v! U, `. C4 g* F4 F

; ^, h" V6 g( h) a9 o, tMethod 04- X0 C  f% ^( Q4 _; I0 ]1 w
=========) d: x( b7 t) m+ B

. C7 b4 H! r6 Z8 N/ {( gMethod identical to the preceding one except that it seeks the ID of SoftICE7 K: t9 g. T9 x* g) U
GFX VxD.- O  d' {- `1 \
( D/ d  [% q0 N# p& t8 N: c
    xor     di,di( |2 h+ C5 P( D, b" R. U+ ]0 T
    mov     es,di1 ]4 B' M: I. C5 h% z
    mov     ax, 1684h       ( `; Z! B3 `; o; x/ \
    mov     bx, 7a5Fh       ; VxD ID of SIWVID
! w4 G9 z6 E* D. i7 d$ i    int     2fh4 N; t: P' d7 N5 k
    mov     ax, es          ; ES:DI -&gt; VxD API entry point3 }% f: m; K4 a# v2 w+ y
    add     ax, di$ X$ i/ u0 Q; g! w
    test    ax,ax
, B, O- d) i1 J# C; [+ o  J1 j2 {    jnz     SoftICE_Detected
$ l$ w  U6 C5 e. M
# m  b! v8 g% U8 ^, Y) m__________________________________________________________________________
2 b  m, N$ x0 t3 k$ m
* V7 Q6 t: e$ y4 Y+ [) l4 r. S4 n7 D" N4 W  P
Method 05: W6 G) O7 S4 |2 p- T# L
=========
1 R" D8 w* L$ w  I* s* ~/ ~- k- A* t3 V2 P
Method seeking the 'magic number' 0F386h returned (in ax) by all system
1 X' t$ B0 \+ Idebugger. It calls the int 41h, function 4Fh.
- u8 E: [! g/ OThere are several alternatives.  
1 d- v; L/ x4 s# I4 c1 b: `+ q2 O' q& B# L  T# U1 w
The following one is the simplest:- Q+ G; Y, F' F! O0 _6 o

1 g* t* A  w/ P  M4 ]    mov     ax,4fh* f# m8 X/ ?) c# O6 f+ R
    int     41h2 D2 j" w& K; A* i7 z# Z" f
    cmp     ax, 0F386' |% W) {; P7 O& u# ]. u2 l
    jz      SoftICE_detected
: j+ Y' M: V2 }" h7 ?
- n% i' x6 N$ b  P7 _! U  R; V, X. [! A& m2 \
Next method as well as the following one are 2 examples from Stone's
+ i+ v1 U$ l7 R1 O& d. c0 R1 ~"stn-wid.zip" (www.cracking.net):! ?- H$ `0 |5 f8 ~9 H' z

( D. a$ |$ {( b1 s! X    mov     bx, cs0 O5 p' G# ^& L* Z: ?
    lea     dx, int41handler2
+ z9 U! ~. G* V- h" a) s    xchg    dx, es:[41h*4]- d. i  A' c( ~9 B
    xchg    bx, es:[41h*4+2]
7 _, P' z! ?& I2 X5 y    mov     ax,4fh
$ V/ \3 t0 N9 g, c, g" ]: @    int     41h8 Q" q" C7 B9 j0 E
    xchg    dx, es:[41h*4]
: m- Q/ P  {1 v% X. K" O    xchg    bx, es:[41h*4+2]- D( K, L. w8 F" H! W
    cmp     ax, 0f386h9 F, J( y. F; U4 j2 e
    jz      SoftICE_detected" h4 R. F" `) @- m3 @
! `$ C* j- z9 I- f4 x6 d
int41handler2 PROC0 g. g& ?! F& ^; U$ ]5 s, {4 c
    iret
, i/ U- r  X9 q5 P* g4 ~5 gint41handler2 ENDP  n. E. Z- v. r$ Y# }# d& n4 o
. d0 R& m/ f) L8 h# d& V

. e* r5 b3 w. S: Y; ?/ l_________________________________________________________________________
3 M' l- e, j8 v8 ~5 ], ?0 Q3 [
. \, }$ O; {: s- ]! p5 k. G! u; Z$ g  s
Method 06
$ F/ E; y5 D" Q1 O1 g=========
5 y: P" T* L& M( f+ l( j- g8 O- _# X! W" ]6 l' N, Q7 D2 {

' b" V: X# d2 S0 D2nd method similar to the preceding one but more difficult to detect:
( L6 s/ D( R3 A% [8 w$ g: K% |. }: ^( G; D6 `& q/ B, t* K
; W( d; @& b  b5 {$ B
int41handler PROC6 @8 h3 b7 U- ?+ y4 a
    mov     cl,al
, E0 G% ~9 O& F/ ]) k2 L( X    iret
" m! M& w: f4 Xint41handler ENDP
! u9 h0 z# `  t/ |& v$ Q; r
' `" E1 L0 X6 x: V+ R# V: e& x! a& B$ h$ Y0 G* |: a
    xor     ax,ax: {( L3 K6 e5 G
    mov     es,ax
7 m5 O2 v3 Q# P( D0 P* s! Q    mov     bx, cs
7 j7 o9 v0 M, r0 c+ P+ W0 k    lea     dx, int41handler
0 d6 s1 ]# l6 K# d5 F/ J  R    xchg    dx, es:[41h*4]( e6 N- Z' i& k6 q' }) ?- _
    xchg    bx, es:[41h*4+2]% a6 q2 c! E3 C9 E" H
    in      al, 40h, X' p5 }# x1 M4 b' m; ^/ o
    xor     cx,cx; b+ j+ d  z$ f6 B, W- G* f
    int     41h
" f2 `& u: J, O: w$ i/ W    xchg    dx, es:[41h*4]
, Q) G9 ~6 e2 G+ E( O9 ?    xchg    bx, es:[41h*4+2]. L3 u7 o2 x4 C, b8 M& _" O! K- N
    cmp     cl,al
, r* K. f8 v) x+ z/ @" }1 Z- p    jnz     SoftICE_detected
: ^, p' S( ]. u' y
0 F! {. Y, t6 d2 P$ m_________________________________________________________________________
3 I4 x# F" ~/ Y# c, z
7 O2 Z/ j% a4 [Method 07' \, k+ n0 \: Y) [
=========* {: b9 e" P0 w9 s7 ], l

% r" x. L: ~1 ^, i8 wMethod of detection of the WinICE handler in the int68h (V86)( F6 {: P: `& O) g- S

4 C1 B5 @+ b* w* d3 e( R% h* w    mov     ah,43h) s) `& `) Q* {
    int     68h
* z& r/ \1 O; q& R  k0 i6 A    cmp     ax,0F386h, [( L5 e- |3 M7 e8 k
    jz      SoftICE_Detected0 O1 a3 o2 ?* z- G6 A

$ f$ \( H* V& u: k4 P1 l$ G& z4 V) B& f. }2 D
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit) t; }  ?( f. t' O
   app like this:
! Q: t4 B: }( _! X. Q8 l, ^# x/ c/ t5 ]# a! Q8 N! l
   BPX exec_int if ax==68, t& ?" v0 M$ [& }; c
   (function called is located at byte ptr [ebp+1Dh] and client eip is, U+ b8 I, J, y$ a! B6 c
   located at [ebp+48h] for 32Bit apps)& [  R/ Q: o# T9 r: X( Z: K) @% u
__________________________________________________________________________
0 N+ `$ Z2 v, }/ ]4 J# I% O
1 p9 l( }. v& k
$ F, g: @# e" ]* P/ k' DMethod 08
7 p& o, ^/ _$ j9 h$ R9 }" I0 [=========
' ~' Z& d/ _6 S" k$ o- `% u
5 _, Y" q6 b4 F# O, }% y' m8 EIt is not a method of detection of SoftICE but a possibility to crash the& s7 f: t$ W4 Y$ P: Y
system by intercepting int 01h and int 03h and redirecting them to another' c/ E* n+ u2 g1 [* `
routine.
1 C9 m' z6 f; cIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points% V- b. Z8 I4 q0 \: x/ {( B, b
to the new routine to execute (hangs computer...): d4 z$ x; k! _0 E( z" i

1 P" e1 X" S6 H! ~+ F    mov     ah, 25h
) l5 H7 t' Q- Y- ?    mov     al, Int_Number (01h or 03h): Y& k0 v7 q/ H8 G8 u
    mov     dx, offset New_Int_Routine# R4 ?6 F0 e. {
    int     21h% k1 K  s' s) \' J# e4 p
" s4 A- m' v8 m. ]7 L4 o& W
__________________________________________________________________________
3 ~0 R# O$ d5 p% T5 w* [) [- O- E4 R7 Q  i9 W5 X
Method 09
) o: E# ?$ z6 w; L- x# s=========
3 W$ K% ?  l. V* h
; }  {2 w- `% X# cThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only% k# P* y2 e: n( R, V9 a; T
performed in ring0 (VxD or a ring3 app using the VxdCall).  A/ _7 R1 e! L  ?
The Get_DDB service is used to determine whether or not a VxD is installed& |  f: `" f3 [& w' H' r/ U4 B
for the specified device and returns a Device Description Block (in ecx) for
" ~" u! ^% `. Q2 g1 `, qthat device if it is installed.
) P5 `& S6 V2 o7 k. \) B3 h$ h( a8 X; N# b: H4 Y6 `6 \4 B& Q/ c7 @
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID$ b* d5 A! _* e
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)" z- ?) k7 G3 t; \
   VMMCall Get_DDB
* z  ~4 i5 ~( P' `+ V9 D9 ~1 V   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
/ O/ f, |! t, k  I2 s$ |/ `4 m( B' B
Note as well that you can easily detect this method with SoftICE:
6 t2 \, y) O: ?  }9 D, G   bpx Get_DDB if ax==0202 || ax==7a5fh
" ^# F8 P0 b  l% V! ^# M  B9 W" v6 E+ p
__________________________________________________________________________
" i1 D) m: Y/ O6 `" F* ~0 ?% j
' C/ J: d& f6 N' G$ w4 m( \Method 10) I. |  S) J) {( [
=========8 ]( M* j3 ~  S* Q1 Q, r3 m

/ ~" _* i" R& B9 Q# W0 j. r+ w=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with" C: }, q  z" n3 Q
  SoftICE while the option is enable!!
8 {* b* f. _$ m, G) z: j6 f: |/ }% \" X! L" D  H' a
This trick is very efficient:
) y& l8 H2 o, t& w! J* F% X3 J: ]by checking the Debug Registers, you can detect if SoftICE is loaded7 Y4 j+ n, K. M0 D! c& ~& x( X
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
9 Q% X0 l8 I4 r. d! M6 ]6 U1 Rthere are some memory breakpoints set (dr0 to dr3) simply by reading their
0 z3 b4 z" {0 G) [value (in ring0 only). Values can be manipulated and or changed as well3 e" Q4 B7 J. y% T# h
(clearing BPMs for instance)8 l! u7 j) ]& j9 z

$ p( F$ v+ _( i; h" [) u6 e, A__________________________________________________________________________9 {/ x0 D. ~- f8 W. Y

$ m( X( q- e. W% D9 m( @0 e1 {" s6 XMethod 11
$ ~7 }" G6 C) w3 _' z- ?) p=========& d( R0 g! \2 L( L& D4 s+ u
$ ^6 Z% X0 t% e7 u
This method is most known as 'MeltICE' because it has been freely distributed9 I- b0 ?% i- c! ?" ~/ q" n1 d
via www.winfiles.com. However it was first used by NuMega people to allow* d9 W$ P/ N7 L! q: R& V% U2 j: f
Symbol Loader to check if SoftICE was active or not (the code is located# l3 l; W- T- H
inside nmtrans.dll)./ v( C1 _6 `; f8 k
$ i% e  b1 }1 A- ?) R% t1 h0 P8 G: F
The way it works is very simple:
; o, ~% F0 e' I- b# Z0 q  Y4 f' fIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for9 e) ]4 ~0 G$ ^# a- R) e  }
WinNT) with the CreateFileA API.
5 f# z/ T6 M3 h! V7 `- t) R% v
# `$ O+ D$ Z! W- ^# oHere is a sample (checking for 'SICE'):% M2 p9 c. o& Z3 @( g- l

; K$ M  j3 Y" C  GBOOL IsSoftIce95Loaded()9 Q' N+ }2 n; \/ v9 T* @
{
& C: Z& w8 X) U& i# ~  z   HANDLE hFile;  
- i+ h/ M% V. D, A   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,4 I4 D: R7 C' a! {4 L$ ~
                      FILE_SHARE_READ | FILE_SHARE_WRITE,
% o- W  H! i. ]0 z1 X" a+ d                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);) j0 i2 W0 w) j, @6 G
   if( hFile != INVALID_HANDLE_VALUE )
9 V& C# X* Z0 d, h  c   {) t" a% s. ]) s# J( v6 o4 u
      CloseHandle(hFile);' ~: d4 W% D' r! p2 U
      return TRUE;6 |' c3 j: H5 H" B" {# u" w
   }0 v0 X0 X: i0 {) K+ [
   return FALSE;
( E" m' R* ]7 h1 s}; X: R2 {4 B6 W9 R/ ^7 i

) r' X$ ~# [: g$ c) JAlthough this trick calls the CreateFileA function, don't even expect to be
+ j, {1 k0 M( W  B6 B( w3 cable to intercept it by installing a IFS hook: it will not work, no way!) t# z2 q# w8 h$ Q. y9 ?* q. z
In fact, after the call to CreateFileA it will get through VWIN32 0x001F: s5 W; e& C2 P- l! R4 B7 O
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
. ~, P' m- X* y) [7 X6 g" Band then browse the DDB list until it find the VxD and its DDB_Control_Proc& x. w& o# Q0 t
field.
& ]3 X$ |- y- J! @* W" m9 Z" c0 WIn fact, its purpose is not to load/unload VxDs but only to send a
- _2 T, n4 _9 G! tW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
, `1 y8 k& j. s7 B+ {& S4 nto the VxD Control_Dispatch proc (how the hell a shareware soft could try
- Q  {$ f; l6 gto load/unload a non-dynamically loadable driver such as SoftICE ;-)., Q: d9 v* J& }; a+ W* a
If the VxD is loaded, it will always clear eax and the Carry flag to allow
2 B- o6 M5 j3 @( _+ Y* eits handle to be opened and then, will be detected.! F$ p  o6 ^; T1 ?- }1 E2 F
You can check that simply by hooking Winice.exe control proc entry point
# A! ~+ ^  j0 D) iwhile running MeltICE.
/ w  ?6 k$ e7 h. z7 I; O2 q5 Y  ^2 Y0 u- i) [# n( F& r

0 E1 q+ ]% ?* q. Y  00401067:  push      00402025    ; \\.\SICE" Z9 G/ W8 g; N. n3 H
  0040106C:  call      CreateFileA
6 Z1 }  q0 U+ Q# I  g  y( A  00401071:  cmp       eax,-001
% @, Q" K, V( Z  @  00401074:  je        00401091
2 g& t% e6 L8 E! E: a8 R9 H% x' M
  k) p5 f- ?/ k1 m1 [* I3 `
There could be hundreds of BPX you could use to detect this trick.
; B$ G/ J. X/ b7 W, O# W  B9 B-The most classical one is:( n: d" y* G2 t; N4 _
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||- R* o: X9 o1 n& f
    *(esp-&gt;4+4)=='NTIC'7 z5 X3 I1 L! d# R

+ C* x, @4 u: x+ R; c& V1 k2 y-The most exotic ones (could be very slooooow :-(
# I3 ^3 H0 v  E+ W   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  , ~5 a7 X. q" _/ x" y8 P! ?6 m
     ;will break 3 times :-(
' A, N( ?, }% R$ |
  D! \7 L& |9 m1 `' P6 v-or (a bit) faster: $ p2 U) K. w  N7 z; H7 [
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
$ N5 q- a! U, f
: K7 f! l: P+ d% |$ ^( X   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  3 ~) o7 v; q$ O2 O* v: H: ?
     ;will break 3 times :-(  _4 Z$ o/ g9 S5 s% Y: O- \# j
# f6 F3 S4 E# X% {
-Much faster:4 M" G2 q  W& U: z
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
( Y7 }6 j5 j- E) B) p
$ P  ]+ o+ @  p  u1 PNote also that some programs (like AZPR3.00) use de old 16-bit _lopen
+ o( Z, y9 Y, G# N( J" U! ^7 Q8 bfunction to do the same job:; t8 n* I/ M$ d$ a& X8 K7 O

& j: g9 s. r# T$ V   push    00                        ; OF_READ
; t' b5 J* g) ?3 ^: x6 z! r; L0 J/ t   mov     eax,[00656634]            ; '\\.\SICE',03 }# l" n; W1 b" z5 Z
   push    eax- Y" }' }: `- L! V4 v7 h
   call    KERNEL32!_lopen
' g0 `/ V& J9 D4 c' \   inc     eax
5 V( `: t5 I" _7 k$ ?9 M   jnz     00650589                  ; detected
0 g1 `6 k' n" z8 I3 L7 I- ?# j$ {   push    00                        ; OF_READ
1 ]1 M- r9 j* E, k  H: V7 k. O   mov     eax,[00656638]            ; '\\.\SICE'
$ p5 E- n9 U2 m1 _, z2 |$ S   push    eax
* c- L2 u0 ?- h8 }8 W   call    KERNEL32!_lopen( x4 x4 m( s2 \. R
   inc     eax" F. D0 v! t/ r; \/ [- o9 f
   jz      006505ae                  ; not detected
* L8 C- G) C: g* ?; r6 k8 Y6 n6 Q& h9 t- j; s  D

6 ~; y) V+ \' y8 x__________________________________________________________________________
0 U3 H: L3 M0 ?5 D
+ g; ^- P( \% d! e1 @7 }! ]7 mMethod 12
1 d! a- X. z. E& O( k=========
) p' r- V2 d" Y
& U4 A% V1 W  t; wThis trick is similar to int41h/4fh Debugger installation check (code 05
9 {. Y+ U+ Z( V0 F$ z&amp; 06) but very limited because it's only available for Win95/98 (not NT)# @% Z* J  d& |: T+ m0 o- q
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.  h0 y4 R4 n5 l- e6 N* {7 H
: J' l; u: ^' X5 j# ^
   push  0000004fh         ; function 4fh9 r6 ?- l8 [4 Y3 |- ^
   push  002a002ah         ; high word specifies which VxD (VWIN32)1 p9 s2 X9 A9 B; v/ w
                           ; low word specifies which service. F: f8 ]" n( `5 e8 x; y& c
                             (VWIN32_Int41Dispatch)
7 w! ~+ E+ \+ A% |   call  Kernel32!ORD_001  ; VxdCall$ Y8 y" D9 @/ Y8 s
   cmp   ax, 0f386h        ; magic number returned by system debuggers# d5 U9 o$ R5 c, R! P. q9 a
   jz    SoftICE_detected
+ z! j; X+ u: i2 Q3 I' v( [7 y! a4 D; i! l
Here again, several ways to detect it:
$ b$ G/ R( W( a6 C8 Q! e4 w' s& x3 n- G6 Q! q0 ?! C0 ]
    BPINT 41 if ax==4f0 _9 d7 J% U9 q1 P  M* S

5 r3 d4 C2 @6 i% h" C    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
1 X& ^3 N9 H; B, \! v. k5 @( i8 Z! A" m" V* ]6 M5 i0 f3 d$ |4 M  T  y
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
9 W  _+ y7 D+ o4 n% J. l% V, k. @. {* v% t; E+ `& a! ^2 Y
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!! p$ `# \5 n9 |9 w

7 h& M+ I/ K9 L7 v__________________________________________________________________________
+ F9 M% p2 |5 q9 n6 }& D8 [# _
: Y; U/ w% X; r9 N/ N/ P. aMethod 13( F9 d; B1 W9 z& v* |5 j
=========- `0 @2 f  q0 C' ?5 y, D7 K
+ }$ L- W+ v1 x) [4 p! }4 O
Not a real method of detection, but a good way to know if SoftICE is$ z: \7 }2 J- Y
installed on a computer and to locate its installation directory.6 E5 `% M- c2 D) T; x
It is used by few softs which access the following registry keys (usually #2) :
* q( Z  E3 b$ g/ ^5 n) W6 Z+ J$ {3 B: r6 E1 ^+ B3 Z8 Q4 ~- Q
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
9 ]4 T; V+ ?+ g7 ^0 J\Uninstall\SoftICE% D2 k5 k" l* |$ V/ h& i7 l
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE) H/ t) B/ t2 X! J
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion* r& t% s. ]1 X- S2 N8 ]; C
\App Paths\Loader32.Exe
4 C+ T, z$ T* }- w* d4 j. g; S
. Y! ^7 I& ~- v7 L/ m! U
4 a6 h# `5 U! c9 i& cNote that some nasty apps could then erase all files from SoftICE directory
* `( G, w+ d. _(I faced that once :-(3 U& D5 }; ?  r- g0 f, {2 M

( E7 R$ s& @' nUseful breakpoint to detect it:
8 d( z( F% _; k2 F3 s5 P, z8 Z2 A# y3 ^* [* s, W! ]: ]1 h& |
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'4 V" x: e8 t4 v5 \0 D
8 ~7 F1 s1 A$ e
__________________________________________________________________________7 v3 i  B3 J2 `# Y. p- \
% `# O4 p$ R* a0 F" G% D1 {+ {

; r% Z6 N5 }4 y: t% MMethod 14 ) Z7 q+ A" e) n2 Q" |; r! t
=========
4 a, q# d, ?% P* x7 G7 F6 }# Y+ g) @( m/ ]% ]! H% J: K
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
# K$ b" `) m6 q2 H1 Jis to determines whether a debugger is running on your system (ring0 only).
% T/ U4 b: e3 v5 ~, ~6 Y1 p5 I9 f  t) e
2 g. I- `6 C" H2 q# b! X3 H   VMMCall Test_Debug_Installed
" X2 M4 u* c8 w0 }" ~6 _$ v" y' o9 k   je      not_installed
! w2 X. g4 y8 {& p
/ t  a, b- q$ t" _' I4 JThis service just checks a flag.
! e/ U; W/ h+ J, @" |</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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