About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
' n& {4 Q; C% K- {3 c; X<TBODY>6 \6 v* o0 W1 |4 v. }$ G# h  d" o
<TR>8 a5 k# ^) C6 ^  U. k6 o
<TD><PRE>Method 01 0 @2 c# o7 c+ X- c; s
=========8 h: w6 R  X/ v) k% `1 Z
3 G$ Y9 |7 ^* G% [
This method of detection of SoftICE (as well as the following one) is
% b) V, D/ D, o  O" U  D) Pused by the majority of packers/encryptors found on Internet.
( Q; s' _2 x( M- n) HIt seeks the signature of BoundsChecker in SoftICE3 R4 t# u# f% L; K' ]# H4 k
; R4 j5 w5 L. r$ Z
    mov     ebp, 04243484Bh        ; 'BCHK'
) V) Y$ Q  D( ^: B/ `( G& h    mov     ax, 04h
9 Y5 q2 a4 v* b2 P4 |    int     3       8 \. c! ^& w: Z
    cmp     al,4  x9 O( m% Z9 A& C: [
    jnz     SoftICE_Detected
1 K& D+ C; ]' I, G5 o" w7 L+ p- Q3 K, h, u0 |; v
___________________________________________________________________________
7 m  u" w2 b6 O6 g+ ]( _9 G6 q  d$ ~4 A9 i$ P: O4 l& H
Method 02
8 C) u# l1 @) }% H" j3 {; _=========$ C2 C. O: {2 J

4 ~9 E  f8 m  W% j! P0 TStill a method very much used (perhaps the most frequent one).  It is used
: E8 t) ^! k: Q: A  x2 Jto get SoftICE 'Back Door commands' which gives infos on Breakpoints,
4 b0 i; |. Q8 y3 o1 C) mor execute SoftICE commands...
+ M8 A+ }- e) {* X* HIt is also used to crash SoftICE and to force it to execute any commands
0 V8 N% i: n7 U. H3 `0 ~/ [, c(HBOOT...) :-((  
7 ^' Q* w( W5 b2 K1 I3 @5 N/ e+ u7 Y% i0 ?5 \1 f
Here is a quick description:
% L+ Z2 H! W; N2 F( x+ r- |-AX = 0910h   (Display string in SIce windows)8 |* z& u9 ^. C* t
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
* h8 j. J* f& {) E- C-AX = 0912h   (Get breakpoint infos)) n+ D- m/ ?4 ?" b9 a$ e- L$ R
-AX = 0913h   (Set Sice breakpoints)( i3 Q% M) |: @4 G/ a
-AX = 0914h   (Remove SIce breakoints)
1 w: ^: D! {  L8 \
$ E; E! `7 e, Q$ ~Each time you'll meet this trick, you'll see:
" k1 Z2 j* ]- J+ b-SI = 4647h( B9 Q2 _1 N9 E) Y( [. Q3 m. q. B
-DI = 4A4Dh& y8 s. J8 k( c6 i5 _& |' d; t
Which are the 'magic values' used by SoftIce.
! X& r  V) y# p3 m+ ?) c$ XFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.
3 G$ c+ G5 T( C8 b% J  z, ]# x: V4 `2 C2 P% C; u
Here is one example from the file "Haspinst.exe" which is the dongle HASP
5 r; ?( |% |0 O5 {) e5 DEnvelope utility use to protect DOS applications:
$ d- O, p8 e. |9 {$ C; H  a: ^  a/ {2 A
% Y7 Y2 Q( }) T* V" {
4C19:0095   MOV    AX,0911  ; execute command.
* T4 q, X7 w8 D6 k1 K# T- C4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).8 g$ U% Z: ^. N6 D! H
4C19:009A   MOV    SI,4647  ; 1st magic value.
. a# t* M! O0 ]- N4C19:009D   MOV    DI,4A4D  ; 2nd magic value., L; q1 ?/ A. G- p2 F4 a5 K
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)5 y) _8 ^8 R3 L, D2 Q9 h$ |
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute9 b4 s5 u2 w' z3 U
4C19:00A4   INC    CX/ n1 u, G; f" L( H. t
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
! G+ J3 `2 d% c( @/ y: {; Y4C19:00A8   JB     0095     ; 6 different commands.
) p7 z, v: q: c4C19:00AA   JMP    0002     ; Bad_Guy jmp back.' E8 @) p* c  l
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
. [, n% M% r. j
3 {5 x1 M$ B; R' j$ }The program will execute 6 different SIce commands located at ds:dx, which
! l7 R; b+ F% b- `are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
2 y6 Y) b4 H" K! f  H6 u& z; z! u( t7 j& b- C% }" p- |2 e  U
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
  {, ]1 R4 I) @& I, W___________________________________________________________________________
$ \0 Q' d" _; [" D
  k/ x& z* V. H; K2 H/ s/ h
' X& Q' k) ~1 y* r; m3 w  GMethod 03
  |  ^& J3 }- h  u8 Y# i=========
, ~) c4 K1 B9 G4 U
5 g; e" `9 z3 {Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h1 E4 q: C8 `8 g8 C1 {  z
(API Get entry point)% c2 j* i! k" E  G9 S, d
        
+ i7 t* N+ W( }+ V+ Q+ O
& W5 I" a6 r- S    xor     di,di
. {7 h. D8 R* A! J3 _, W    mov     es,di2 M& g0 P' i4 X: o1 c: y
    mov     ax, 1684h       * [$ @. y6 g2 H) i3 N5 _1 F! i
    mov     bx, 0202h       ; VxD ID of winice, Z2 s4 e1 ?% m; v. x
    int     2Fh- T* V+ U7 z, H) @" B7 [
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
% ~% S+ }6 E4 @    add     ax, di3 D. S, N9 _3 s$ h: D# e$ V/ \& P
    test    ax,ax  F% j1 f. Z& c, B
    jnz     SoftICE_Detected7 k+ T; c& i6 g! {" J

6 I8 a; c2 U0 B% j, j( W2 a7 s  w- b___________________________________________________________________________
* ^- ?+ s% {& B3 `+ U! r1 j
0 Q8 X! ?8 [- h! l7 T: D% Y# A0 SMethod 040 Z: |9 B8 o* G$ X/ j
=========
. s- p% h( I1 w  P! I  B/ V5 e9 ^: b* j- u0 C% ?! i  t' A0 n' K
Method identical to the preceding one except that it seeks the ID of SoftICE" _5 G  ]# }# N1 s6 x# O5 W2 a
GFX VxD.' Y' ^, I4 Y+ x$ B' v! W

* }3 ~$ M( v9 v! P    xor     di,di9 Q$ Y4 S/ P0 o! g# k% s$ {( d
    mov     es,di' i! v1 C, v, I2 _8 A9 P6 R
    mov     ax, 1684h       # f0 ]. K' L& v
    mov     bx, 7a5Fh       ; VxD ID of SIWVID
4 A8 A9 K4 r) S7 `6 v  E    int     2fh# q9 W- o0 ]( a( x& Y
    mov     ax, es          ; ES:DI -&gt; VxD API entry point" V$ I7 g4 l# o6 l8 X
    add     ax, di# M% S# ^  R! ]1 O/ O
    test    ax,ax
& g. H: L2 N( B' F$ e- Q7 M    jnz     SoftICE_Detected
$ [; H5 f+ D. K* I2 I
. l: ~4 v7 h* H+ H__________________________________________________________________________
1 ~& \, y& o, h  J9 {; H
% T1 o0 r3 ~/ k4 \$ X4 H1 \) r
- S! r; z  l( X8 a- k) W" wMethod 050 p) s8 h* s' V8 B4 ~
=========
7 f9 A- k6 p* _- q+ P$ ^+ d4 w, U  N% \; v, w
Method seeking the 'magic number' 0F386h returned (in ax) by all system
; @' W2 H6 ?2 P- _debugger. It calls the int 41h, function 4Fh.
. |3 [0 B2 V( UThere are several alternatives.  
6 q) x3 }" f+ r9 a9 N  @" H, J( ~  ]- c
The following one is the simplest:# W$ a* ]2 o5 u; q

/ u" _3 q. t' L3 a    mov     ax,4fh) _: B3 d; `% ^2 z
    int     41h0 D5 R% l6 ?8 T
    cmp     ax, 0F386; g1 F  c2 I/ _( s9 z6 y
    jz      SoftICE_detected
! t, u7 _1 e* R: H+ V) A  k( X, a& \1 q& `
4 {* v$ F0 r" L. @! d4 R
Next method as well as the following one are 2 examples from Stone's
* Z# m% k" S% _/ _! n8 I"stn-wid.zip" (www.cracking.net):- ]8 @  z7 N' @$ z! v8 F
" e2 B; Q9 G6 z$ [
    mov     bx, cs
$ B9 x0 F& ~8 Z  w$ V: K    lea     dx, int41handler2
+ t% v  g& v; D$ Q9 D3 ?    xchg    dx, es:[41h*4]/ i$ ^2 j, ^! J1 o  r6 b
    xchg    bx, es:[41h*4+2]- e$ s1 W& n' N$ b1 H
    mov     ax,4fh
/ d3 P' U4 O; I- |2 P    int     41h7 I+ A1 w1 s' Z4 }) g! n* W( v
    xchg    dx, es:[41h*4]
2 B! T- m' R6 V# `    xchg    bx, es:[41h*4+2]
! y: Q8 x( ~" }0 ?! `    cmp     ax, 0f386h
9 u/ Y1 u* t$ ^1 g. _, ~- ]    jz      SoftICE_detected" Y! w6 x/ y( g3 u7 w0 G

* R8 N4 h5 r8 s! m. c1 c  yint41handler2 PROC
- O! Z4 ?. }$ U  e' C    iret- v/ d  m, L( I4 u& {. ?( b- U* g; W
int41handler2 ENDP$ s- }$ \) i. c
/ u2 M) i& k4 `1 B' T

4 O3 |4 ^$ q/ y, U5 \_________________________________________________________________________
7 Z( u; P! O* v- d5 B  L% e- |: k* V: n5 y! R: Y4 b& b4 a- t
2 H8 v- \% {3 g
Method 06
; W' j5 U. [2 G& F# s=========
: f, t& O1 z6 z  O5 U
; D2 {- T" R1 H0 l
% E/ m/ _3 `5 f2nd method similar to the preceding one but more difficult to detect:
) A& Z; o1 V. f+ V# p* ?
% a% u! `2 C! Q5 \  O1 j7 Y& K9 L5 K( p7 a. y- b" q: R! l8 H
int41handler PROC
/ C( o4 ?. H6 j6 D+ |4 I, N    mov     cl,al* C' ~% f8 }0 }) e  m* ~% l
    iret
+ n; o" s' E5 `4 R; o* \int41handler ENDP
. d. d$ T2 X( }4 T: \  u9 g6 i
& X) Y9 q- z9 e! k8 t5 m
7 g2 b, u6 e' P    xor     ax,ax
& G3 `. u% _! @! r    mov     es,ax4 l. U: ^. R" a( p
    mov     bx, cs
# ]( C% S7 d' N% A+ K% K    lea     dx, int41handler% ]8 K$ e+ g# }
    xchg    dx, es:[41h*4]
1 L/ T! B  L# n+ Y6 c. O    xchg    bx, es:[41h*4+2]
" a* X6 [, Q+ R' M: ?6 F$ U7 G. l% }! d    in      al, 40h( E* ?) a* d, z+ S4 F" O
    xor     cx,cx
* M/ P$ O6 X! e, D* N- F* o    int     41h6 y( Y9 C5 d4 s: L! v. `1 E% l
    xchg    dx, es:[41h*4]
) o* t! o; ]8 o    xchg    bx, es:[41h*4+2]
/ c" ]1 L  n$ D3 ~0 v) c    cmp     cl,al8 N; z( C+ P5 ?  x# g$ `
    jnz     SoftICE_detected' P$ B1 z' w1 p5 Z1 Y0 n" s  b
$ q2 ^* ^7 D# ]% d" l) v
_________________________________________________________________________3 m# c- Y5 Q( O% F0 t3 U% [& @; T4 m
1 r0 Z4 N5 ?% l: \/ c4 e! `
Method 07
, k* V/ H8 `5 X6 c6 d1 Q5 U/ ]=========7 M9 K* Z  @. y3 m
, R( i$ l/ G. t, B! g7 Q
Method of detection of the WinICE handler in the int68h (V86)
. Q' k9 ]9 ]! }1 e: C4 P6 j; a6 K8 n% G" R  r1 w7 Q9 E" ]. G
    mov     ah,43h# Q$ G7 f1 u7 e: h5 }6 b
    int     68h
2 b& s8 f/ G" N; Q    cmp     ax,0F386h- ]7 Z5 W! B* S! Z
    jz      SoftICE_Detected! {9 D8 |( |0 W; l4 a, x: P! ^

/ ^2 Z* h  k& L0 d5 d. b( s$ ]6 T9 G. n- o  Z
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
' v. E6 w" y3 }3 u' K$ i. {; S   app like this:
/ @, X( C* U. F, T7 ^  {" f, t9 q
   BPX exec_int if ax==680 n+ m! S: d1 t5 c! k  f- t
   (function called is located at byte ptr [ebp+1Dh] and client eip is0 r- ~: X/ V4 y+ k$ a
   located at [ebp+48h] for 32Bit apps)# g" Z$ Q. K7 x+ X# Y
__________________________________________________________________________2 o+ G% V. F( h& M
. x0 B3 K6 d3 K3 ?3 P9 f) n
- w' Y$ g0 u2 v. }& n
Method 08: t$ q# M" ]! w
=========
; F) L7 e3 y% ]4 K1 p# ~
3 A/ Y; |( q1 Z0 ^1 K( k, e  rIt is not a method of detection of SoftICE but a possibility to crash the' t5 H# [5 s2 v- c, R
system by intercepting int 01h and int 03h and redirecting them to another4 h' y, p3 ?+ @1 Z9 x0 v# l  M
routine.
  U9 Y' I  L( |7 MIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
, `) H; c# @6 _. @3 Oto the new routine to execute (hangs computer...)
& Q/ F: q5 n4 U8 d( y- G/ ~/ R+ `% x, @' n7 j' M. k
    mov     ah, 25h! x) l( Y: J$ G' ?) v
    mov     al, Int_Number (01h or 03h)
* X5 v# z4 D8 R6 U2 k+ J) }    mov     dx, offset New_Int_Routine
4 q8 c9 k8 Y! ?; V% b+ l: ^    int     21h
1 G+ N9 \' B3 D: Q  f& s7 D
1 ?; R, f2 s- h/ `4 F1 N& E+ ^__________________________________________________________________________
7 v6 ]2 ]' u8 P+ k3 @7 l( ~( E7 z  \$ O' w3 _# }* ]
Method 09: y& _- j: m/ _8 S" p, x8 w
=========
# F* i5 T2 Z6 I& c
7 I- B' X- N) J& j% h! q$ G8 eThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only0 a' K2 E5 g. V
performed in ring0 (VxD or a ring3 app using the VxdCall).
; N3 A: K+ h- D3 D- L4 v* o7 eThe Get_DDB service is used to determine whether or not a VxD is installed
- G3 t( J+ V1 Z8 Mfor the specified device and returns a Device Description Block (in ecx) for
4 F* ?' M! ?4 Wthat device if it is installed.
1 x5 U& M3 J5 X7 @
) a5 I- T9 Y) ~   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID3 `# j, c! `- B/ ?$ l
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)9 ?; {; B# n. q
   VMMCall Get_DDB
( s1 A1 V: Q" O+ w% U) E   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed& e; E% o  w1 l0 ^- W4 U- k9 F

! k2 C6 b9 j  q; l- N2 s" QNote as well that you can easily detect this method with SoftICE:1 O$ o) z: ^5 A* L
   bpx Get_DDB if ax==0202 || ax==7a5fh) C* j, V; A+ i& A9 _+ l

8 y9 n" M) \4 f) P! E" r# I, D__________________________________________________________________________0 B5 e) m5 `" R! @3 J' c5 H7 S  ]5 k( I

$ m) O  L8 v$ I/ ~* [* v( fMethod 100 |' k) x; T) n5 Y; x/ ^2 P
=========8 `- t, b/ h, [4 f( ~' D
8 C, O& V7 u: d/ w/ h) c
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with9 O% J3 A9 `) a, o0 K9 h
  SoftICE while the option is enable!!
9 E7 \0 M! I1 ~4 e
9 Q" @- C, N- R) c! e/ F8 MThis trick is very efficient:
% b; [; X1 R1 g& C* S5 Iby checking the Debug Registers, you can detect if SoftICE is loaded
2 G3 K0 c$ t( G6 m6 w(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if9 J4 B  u+ v  e# h) p
there are some memory breakpoints set (dr0 to dr3) simply by reading their3 j1 ~6 k' ]6 m' b
value (in ring0 only). Values can be manipulated and or changed as well
; C" w( H1 F- r5 h3 N! K(clearing BPMs for instance)
) z/ L) j% K+ W6 Q& ^1 }* J8 r9 h( t3 o9 \
__________________________________________________________________________
* E/ T( d4 y* C$ S& T, D, o& L$ e" n' h5 o1 g2 T, n
Method 11! H/ R+ b! [5 u# E& l6 n3 B8 g
=========+ D( r3 V* n( }* O7 I

- L5 \. z& `: KThis method is most known as 'MeltICE' because it has been freely distributed6 G* J0 F; `6 w  D( @* y/ }0 Y
via www.winfiles.com. However it was first used by NuMega people to allow
; u5 _5 J5 ?3 v( G1 a: a* U1 G! nSymbol Loader to check if SoftICE was active or not (the code is located: }/ G3 n7 N* m0 V# Y
inside nmtrans.dll).- ]3 i$ Q) p0 f% G# u0 D$ D
, E  b0 `( R5 m, S% J
The way it works is very simple:
5 j" ?: B' e  X9 D' \* L" aIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for( [2 B' T" x) m! n
WinNT) with the CreateFileA API.
$ o; b& I9 [) [: P, r: u2 G
8 x8 F1 @5 D5 i' pHere is a sample (checking for 'SICE'):  n0 h- r5 Q. b3 s( x/ C  s/ i" g$ ^$ ?
4 n7 C) G# M# V+ E3 a
BOOL IsSoftIce95Loaded()
  y; u1 X; K. f, o7 |{# D/ h- `% d. Y+ E
   HANDLE hFile;  
1 t, P' M1 x7 O, M5 q   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,1 k6 S; a% z) J! \2 y
                      FILE_SHARE_READ | FILE_SHARE_WRITE,
. O& R1 m! ?* Y5 I                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
6 U! _8 V- [/ r8 N3 Z3 I8 A  e   if( hFile != INVALID_HANDLE_VALUE )
$ A: k  n7 R8 Q$ s   {
0 d* E+ }( {5 r% W: ?1 l9 @- H/ w      CloseHandle(hFile);
$ C6 Y3 L# e: g8 F9 G      return TRUE;
, ?) R/ F6 _+ c$ Z   }% U" g) }. @- ?8 n  t) d. d6 Y3 R! J& f
   return FALSE;1 D, w! t: W% R( f
}
7 }- a: c1 i0 |4 a
  a; l! ~  j  n1 `+ |0 z5 VAlthough this trick calls the CreateFileA function, don't even expect to be8 I  d9 j- ^& Q8 r. x" O# H8 H
able to intercept it by installing a IFS hook: it will not work, no way!5 V5 O( R9 U$ F" r6 c  h! s
In fact, after the call to CreateFileA it will get through VWIN32 0x001F. t  {8 o5 y$ K; g9 }. \
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
6 C# ?9 _9 }+ C3 R  G; [* dand then browse the DDB list until it find the VxD and its DDB_Control_Proc* B3 p1 ]9 n8 D
field.
# z# ]+ E  i  Q- ^- @3 N1 xIn fact, its purpose is not to load/unload VxDs but only to send a 6 w; O" l  t0 m0 Y
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
% n! |4 Q* B) c6 I* vto the VxD Control_Dispatch proc (how the hell a shareware soft could try
# e3 i! L: c4 V  ?2 Ato load/unload a non-dynamically loadable driver such as SoftICE ;-).0 ], ?3 c& |7 R' |
If the VxD is loaded, it will always clear eax and the Carry flag to allow
5 |) }, U" ~; T+ O% `: }its handle to be opened and then, will be detected./ f$ H/ e' F( I" @
You can check that simply by hooking Winice.exe control proc entry point, F4 b6 p* G4 `: ^& t- B
while running MeltICE.
7 v$ }) d' z/ |, @6 ^& k( M* S7 I8 l, z' F* _: B& l) e
- [8 R3 a5 H9 R$ s; u( W8 T. M! F
  00401067:  push      00402025    ; \\.\SICE
; x3 r! }6 p: f+ S. e! H0 K9 q  0040106C:  call      CreateFileA$ `& V! m( B. X! Y, ~2 |9 v0 M
  00401071:  cmp       eax,-001
7 C* S1 A7 g1 f* B9 m  00401074:  je        00401091, d' ^& y0 d5 w2 N

* O4 [& ?" H& R! k4 v' C/ t1 S- J3 u; p( j
There could be hundreds of BPX you could use to detect this trick.& {" T# [2 N6 B! M6 {
-The most classical one is:
: k" y0 [3 C. M. K3 O0 g2 V  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||$ B) R* b; F  T9 A8 @
    *(esp-&gt;4+4)=='NTIC'
$ T) V6 \! w1 |" P5 z
5 s+ z6 h2 P) `4 C' m' a6 z-The most exotic ones (could be very slooooow :-(: J) N/ v' u* S( Y' b6 J
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
; [5 d0 w3 @# J. O0 ?& e     ;will break 3 times :-(4 }2 E5 [9 c, z- I4 g
) m% R" E1 l# N
-or (a bit) faster:
8 Z! Y) K4 G4 z4 V$ s. m9 m   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
2 Z; ~6 n7 K  d0 l
9 D/ P8 a9 D: {. S% U# M  Y   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
+ L8 i' D- t5 Z( t* c     ;will break 3 times :-(. z( u  t6 }9 h. q. B; O+ M# \
9 \3 x& M8 ^+ r# J  e" J
-Much faster:
, _0 Q& e7 ~3 _  Q: e) e% Z   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'  B5 Q) b: I. I- C& [; E! X
, S/ m: u9 M, l( q0 K8 h
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen
' V" F6 R) v& P4 t" Efunction to do the same job:/ U, Q8 t3 R9 \5 e
" V4 o. k. @, F
   push    00                        ; OF_READ
8 [% L# B. `# Q   mov     eax,[00656634]            ; '\\.\SICE',0
, j7 p( G# g: N; @   push    eax" @! t0 a* V3 g3 }9 y
   call    KERNEL32!_lopen
. }: z7 k, Z; ~+ V1 C5 ]   inc     eax
/ n( a6 s* l, H   jnz     00650589                  ; detected
7 m. c; }) K+ q0 p9 ]* D   push    00                        ; OF_READ
0 x/ Q' J7 e; A1 E) H) t- x$ g   mov     eax,[00656638]            ; '\\.\SICE'
, A# G& H6 X: k* o9 Q   push    eax
6 X9 K- o( V* ], i" B: G* e' k   call    KERNEL32!_lopen
. T; r/ Y; H9 G& b+ {   inc     eax
3 t3 k+ M/ c# `- e5 B  Z+ [   jz      006505ae                  ; not detected) P  ~" s) m: j, i; q0 ~) V$ r
) i3 P3 b' B, l1 ]* _& N2 m

' X7 w+ `0 _% a__________________________________________________________________________
( [6 Q: n. {& F! S) y4 v
9 ?( J0 K7 p5 [5 lMethod 12  r, t, W( {6 g" F( L, a- h
=========9 j* _% O% p6 ]6 {, r2 E) Y6 }

' S6 E+ k- E, x& S/ aThis trick is similar to int41h/4fh Debugger installation check (code 053 L1 q1 F" r5 H& i
&amp; 06) but very limited because it's only available for Win95/98 (not NT)- Z7 G" R9 h3 a# j
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.
9 ^5 x) s$ `- U" O9 a$ i: u
! W; r) L) E. s" m% v; G4 Q   push  0000004fh         ; function 4fh
! ], [7 G, {. n- I) W: \, E   push  002a002ah         ; high word specifies which VxD (VWIN32), U5 E8 }, f6 }# X4 X
                           ; low word specifies which service
. S  g* z) M6 K+ d3 I6 q                             (VWIN32_Int41Dispatch)/ ]6 f1 ~$ g( n7 R, D+ ^. ^$ n
   call  Kernel32!ORD_001  ; VxdCall' {, G8 Y+ Z, L0 @% K% N; g3 _
   cmp   ax, 0f386h        ; magic number returned by system debuggers$ H: m+ M. O- k& G
   jz    SoftICE_detected- {8 A( [/ y. S8 \

  F* h  y2 m" hHere again, several ways to detect it:
) Z) Q$ `6 P, t. X1 h# Z: i
7 ~2 W4 c& _8 J- h& b    BPINT 41 if ax==4f
7 G* G% i1 H, |& E# }3 e% {0 K8 _. K  o1 }/ k. C
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one  D" [/ l( e9 _$ O! G3 T, a% _/ f

' ?6 U: R- I) o" g. ^# h/ }    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
$ M4 _: H, ?" t. z, p2 g
" S  U9 w/ l6 J' i    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!9 B6 m" s7 F3 U3 M/ |- S, ?" L4 V
$ e7 R& K+ @0 M- S* I: g& w
__________________________________________________________________________1 @1 Z% l& k! Z2 D4 w9 R; f$ x

( v; }) b1 R# dMethod 13
5 |6 w5 v9 {" z' G3 Q" }0 b=========
! g+ p  ~# {1 R7 P! g
- w" d( q. c1 J7 m1 pNot a real method of detection, but a good way to know if SoftICE is
+ ]! D9 h/ D) Tinstalled on a computer and to locate its installation directory.
, w9 I% g! [& ]% a  s* ~( YIt is used by few softs which access the following registry keys (usually #2) :9 J3 M& v, N+ z3 @3 J" N7 d
8 M* h0 P, N1 Z
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion- c" u3 ~0 B: t- }
\Uninstall\SoftICE2 d+ W3 K  l2 F8 h
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
/ K  x: C; p% [2 f7 z( P2 }-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion. [4 ?' K6 b( @+ f- \& D# Z
\App Paths\Loader32.Exe. ~" c5 n4 n. s) |6 t9 Z

$ l4 u4 q( T3 Y
1 ]: \4 \. C$ `# F" `3 cNote that some nasty apps could then erase all files from SoftICE directory7 }, c0 i" a; s; }
(I faced that once :-(9 T6 W% B* x4 f1 t: {" m( a8 Q
% s! D6 w% o8 H+ Y3 T
Useful breakpoint to detect it:% T" j* q# S. E1 u% M
$ P3 b4 N  z4 p4 N3 N  ^2 [! Y
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
3 t5 S. L! I5 W, o" i/ \
  t3 e$ g! \8 J1 l__________________________________________________________________________8 w* C. s. R4 X- t3 H" B2 Q
9 |% v; k  Q, j, _6 S
8 k3 T. D7 c1 N. m; C' O
Method 14 8 p, Z3 A! O) ]" b+ G
=========
$ D" T- ?9 w0 y# Z( p3 U1 s7 E6 F9 J7 u6 N* A0 p6 W
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
) ^# _5 [( H, v9 }% G4 Gis to determines whether a debugger is running on your system (ring0 only).% q) @& I; g4 n- H1 i
! D' L* B# T8 ?
   VMMCall Test_Debug_Installed
% ^) i" S4 C+ ]1 O+ i- A. n   je      not_installed
) |- k# ?# `# W: \. @) K' U& ~9 D
This service just checks a flag.9 \4 u) S- V- M6 B# ^; N# r
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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