About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>% T; L, n" F- Z+ k: P  c
<TBODY>
4 X2 e% n) [2 w) A4 d<TR>5 Q$ w2 Y4 N( f* Y
<TD><PRE>Method 01
/ r$ N" p( e! }8 \1 h* l=========
, L* T  K- B8 W- C4 Q& j$ S, h4 @% G% d# p& V
This method of detection of SoftICE (as well as the following one) is1 m1 N! n7 ^( n0 r* U8 I
used by the majority of packers/encryptors found on Internet.
% O1 P- ]' p; Q: ~2 t1 q6 PIt seeks the signature of BoundsChecker in SoftICE& z, J0 ]3 X( c( m1 l
( C4 Y- A9 F8 t3 A8 K$ ^1 \9 l
    mov     ebp, 04243484Bh        ; 'BCHK'5 e5 N: R% u+ h0 K
    mov     ax, 04h$ O0 E8 O  ?% c4 v, b$ l: o. v
    int     3      
2 q2 ]$ v( R- O* C, R3 N# Q    cmp     al,4
  r9 m9 w7 Y. q6 T( D# Y    jnz     SoftICE_Detected
, R% V% G6 e6 [2 }9 N9 Y# d- o% Q: s/ N. ~" `, z2 s- R. z: }
___________________________________________________________________________
: X* S: k: F/ `. x) J+ V% L8 L! Q4 p' }( h0 c: q( p% v
Method 02
6 Y# d: i; H3 d5 L3 Y* H: w3 P=========0 S4 _% q( I0 I. V
4 ^: ^, V/ |: d- `: e* J
Still a method very much used (perhaps the most frequent one).  It is used  _- }$ U4 _; _0 _/ A
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,
% \4 p6 R; Y' G  _0 h. |or execute SoftICE commands...! k" R, U5 r1 b# y8 v) ~. E4 i# U! Y
It is also used to crash SoftICE and to force it to execute any commands
+ @5 |! x/ S1 }, B9 c(HBOOT...) :-((  
4 W% Q8 J; z$ V3 U& o
8 a/ o& A- D1 b/ z' HHere is a quick description:0 v. a4 D1 k% u9 C# }5 V
-AX = 0910h   (Display string in SIce windows)
  D0 E* _( H9 Z& ^-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
2 j- ?% \  X7 ~# x" z-AX = 0912h   (Get breakpoint infos)9 \' U" }% s' n5 U
-AX = 0913h   (Set Sice breakpoints)1 X4 I* _. N. z2 D/ C5 n
-AX = 0914h   (Remove SIce breakoints)
3 @2 ^; W4 S1 y" w9 p8 r- H4 ]8 Q% r7 ?. Y  _6 N7 }
Each time you'll meet this trick, you'll see:4 S: y& F: v, m. s& b" e
-SI = 4647h
6 ?% ?) s" d" n0 t, F; }-DI = 4A4Dh6 ]* ^1 l7 m2 b) Y5 ~: X. \! R3 M
Which are the 'magic values' used by SoftIce.
9 g' J+ r: M! t5 @For more informations, see "Ralf Brown Interrupt list" chapter int 03h.# s0 i7 X  X# m3 p2 J9 ~/ y/ n
! `3 O  I- r) l7 c6 @' q9 T
Here is one example from the file "Haspinst.exe" which is the dongle HASP
7 a6 D. M: r4 C+ ~/ C0 x' mEnvelope utility use to protect DOS applications:! p! g3 j( a- V9 r: V) S6 L% v1 ?5 y- h
  y0 x2 Q3 K7 F5 @: W' E" Y9 i

: A5 ~8 ~& ]8 J7 W  v4C19:0095   MOV    AX,0911  ; execute command.
0 H0 K* c( n- U# [' p4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).) i4 y7 F4 \: ~2 y
4C19:009A   MOV    SI,4647  ; 1st magic value." c+ E" f0 Q; G7 {) {
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
6 c. S2 [7 X" Y) f% F, ~4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
6 z7 K% S- ^2 Y$ J* T/ J4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute  V. @% U% }$ ^6 Q, F/ @  N$ v
4C19:00A4   INC    CX, J# q; h9 d5 @+ z8 j$ Q3 V
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute, y. M9 k, @  s2 f; x% y
4C19:00A8   JB     0095     ; 6 different commands.
: I+ j) Q" ]4 W6 l4 J4C19:00AA   JMP    0002     ; Bad_Guy jmp back.. [+ A( d/ C4 m& ]8 T
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)7 ?" X  {+ X5 o8 v0 ^, J. L

! _, a( v, ]1 j! ?# y+ QThe program will execute 6 different SIce commands located at ds:dx, which
2 d- i& f3 N3 p& o" vare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.9 v8 D8 R8 T  x; g8 T" w3 E0 Q! a* l9 I

# _" t+ {+ g% Q4 D5 c* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.; y! u$ y# K: m: z( h
___________________________________________________________________________
1 Y2 S! D" E; l4 A6 d. D6 d  `: O6 l7 K) @) p0 N
9 F* M, M; Q/ @9 j$ T" o* J  g2 r- G
Method 03: I' _. w$ P6 P$ z3 h9 q9 u
=========/ i  V/ \6 |/ Z7 ^& H2 C
/ Z* K; u6 V  S( v5 g0 N
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
, U9 V2 b$ T7 u(API Get entry point)
- `" g3 O1 e# z        
. U: O0 N' K( Q7 @2 V0 B; E2 r9 o( b8 L. P, V! |; y# O, }/ M7 l
    xor     di,di4 U. ?' D% \, z. i# h% v- c
    mov     es,di7 s' K! O* W3 G+ S$ g: i
    mov     ax, 1684h      
, G3 H; d! ^6 w0 ~    mov     bx, 0202h       ; VxD ID of winice5 D) H+ J) ?7 M9 |; s0 X
    int     2Fh; r! J( z" F& r# T+ x! l
    mov     ax, es          ; ES:DI -&gt; VxD API entry point& e) W1 B% L4 _. k& S
    add     ax, di
/ D4 K! l- u3 K    test    ax,ax  v) g7 j* T5 u
    jnz     SoftICE_Detected9 g* `3 q# N4 L1 J* J
6 F: q1 R- R( Q* q& S
___________________________________________________________________________1 \: `  |$ t6 {
  `4 p3 I4 X( q, L0 m  C8 X, ~% e
Method 048 I, B/ z' T' |: M, w
=========
. t/ X) b: N- |3 ]9 i7 e1 K8 a6 c, H, q6 b( ~; P
Method identical to the preceding one except that it seeks the ID of SoftICE% w  ~$ W# T1 j- e- \
GFX VxD.
* g' E! Y; }' ^# z% e3 ^. P1 x: e8 A7 @. I) P
    xor     di,di
9 x4 H" J1 U1 v3 P    mov     es,di1 ?& C7 }' B9 R; b3 `6 `1 ]% _
    mov     ax, 1684h      
! K" N9 g/ B0 q, z7 _* m    mov     bx, 7a5Fh       ; VxD ID of SIWVID4 Z2 r9 P: Y2 Q) A1 o! Z
    int     2fh7 M. u, M! o, h, I+ o$ c' i$ |
    mov     ax, es          ; ES:DI -&gt; VxD API entry point) v5 C. K4 o1 C
    add     ax, di
8 o+ k3 M  P0 {9 k8 e: V* u    test    ax,ax$ q  g# g  N& \0 v! _! Y. W, q
    jnz     SoftICE_Detected. p  `2 ^$ N% c0 @% B
6 {2 v& Y8 f( H0 {+ R& M
__________________________________________________________________________. l- H% f' Q% U9 B( _8 [/ }

8 I: M  G! ?% F( `4 r
: ^1 {8 P1 _3 ~( m) [4 _. xMethod 05
1 P, g5 V% I. A- r- q=========# V' E3 ~' }2 Y. `# Q" e& d4 z6 b
9 U, ]+ n; i; E% @- U7 I
Method seeking the 'magic number' 0F386h returned (in ax) by all system8 B0 n. h) E) G4 K
debugger. It calls the int 41h, function 4Fh.
3 R' \' G2 K+ N: d! {There are several alternatives.  
) W6 w: o1 l' |" J* S9 [; w9 a( b5 {" O2 a- v! E; H2 e) }) Y! u& r1 G
The following one is the simplest:
$ H7 d: H, p/ c$ r
4 S- t) c* ~9 r) L    mov     ax,4fh
; m" H, j; G) v# t: j    int     41h
( j% p1 L' P- a# m# X( y$ Z    cmp     ax, 0F386
- f- v) @8 K6 Z; D  g" }    jz      SoftICE_detected% X4 S( O, H" R$ C7 J9 E

# Z, m  i& M, `/ l8 S
; N, D( e* Q' n: R; tNext method as well as the following one are 2 examples from Stone's
( ~+ E: G0 B. L3 c) f& D0 d"stn-wid.zip" (www.cracking.net):
! i2 N1 M( ~& V7 J8 I  I( @! R2 l; E; x( r9 y' {
    mov     bx, cs0 x% m) p3 w/ Z& y4 a- }
    lea     dx, int41handler2
: y8 a7 W  P; ^9 \. D: G  b    xchg    dx, es:[41h*4]
4 Q9 M( A) O, C% ?6 O' O( ?    xchg    bx, es:[41h*4+2]; x7 ]" b& [$ ^. a+ h3 A# H
    mov     ax,4fh2 u1 |  O7 C  W( n4 {
    int     41h2 ^% B$ ^! |0 w$ c# e
    xchg    dx, es:[41h*4]: z- p- D; O' F3 u7 O& i
    xchg    bx, es:[41h*4+2]( b5 p* h8 L, x; ]; Y
    cmp     ax, 0f386h
2 Z. C& l* y; P1 A6 \    jz      SoftICE_detected
8 R) |  j4 \; ~4 R0 X" u/ V# h
8 x/ c2 Q' y) V8 tint41handler2 PROC0 P+ ~$ x7 n$ Q" X7 Q
    iret! }6 U0 o0 S& E* s( j, J  d; W- p
int41handler2 ENDP; v/ u6 ?: a  m/ r  }& w) W% l; ]

  i9 e- Z% h1 o( H3 p4 |4 d
) Y4 C3 j2 N7 Y; X_________________________________________________________________________4 @* m8 q( r) y5 D% A- ^
+ T. N* n" a" J: @5 j" C

* n8 ~; s" M4 uMethod 06& Y) ?2 q9 W2 t3 w
=========
. Q6 v6 y; s4 l
7 k/ e6 E- V( Z+ n. a# |6 l
) `/ ?3 N4 Q4 H5 _6 d2nd method similar to the preceding one but more difficult to detect:1 N" j* e1 ^& @5 O

0 ~5 z; o9 P* k" T
$ F  n* C; m; v+ Jint41handler PROC
* O; r0 i% Q6 \/ o/ I* L/ Q0 @    mov     cl,al
5 m! ^# k9 d7 s7 Z1 E1 ]    iret! K! O# w! u  F, g$ L7 J
int41handler ENDP9 F2 c2 u( D) {' d: W: T7 F; C8 Z# x" M

1 R& }9 G6 X; x: L# D3 C% H+ d# a# L, w4 ]. k! F" k. r( ]
    xor     ax,ax
$ N) n; D" ^7 w1 ]6 V    mov     es,ax, b8 g# W3 d! H& b0 b
    mov     bx, cs
1 D5 j0 j+ z/ |' z: y8 Z    lea     dx, int41handler1 K8 M! \/ b; D" |/ B
    xchg    dx, es:[41h*4]
0 Q5 `- m1 I; U* Q% K) ?( f    xchg    bx, es:[41h*4+2]
2 L6 g0 `9 ]2 v' @: M* {! ]9 X    in      al, 40h0 i- M: V# @8 Q/ R: U) {
    xor     cx,cx5 @# `( G# J+ Q# M
    int     41h
: y5 H* B  k* Y3 {5 P; h    xchg    dx, es:[41h*4]$ B% z1 Y# s, H; \
    xchg    bx, es:[41h*4+2]
& ~- S2 }) j) l4 E& e    cmp     cl,al
) @; R; }( R; z    jnz     SoftICE_detected0 H- `6 L8 _( j  M" l* H
; B9 V: O4 ~1 u+ D  U
_________________________________________________________________________
0 f5 @- U0 C- C2 a6 w+ W- x
  N6 a8 c3 J& OMethod 07& U( R, v0 n  w3 L' ^% Q* D
=========" k' V8 X; R5 v2 z9 U1 |

' K+ e* e1 a! a+ s1 G" U' SMethod of detection of the WinICE handler in the int68h (V86)
0 ?  Q5 T! c3 f8 O& O: G1 Y2 y' T: f
    mov     ah,43h; V* E* {& B  D
    int     68h
" b( D2 _9 F. C9 N& ~; Z  ^& s    cmp     ax,0F386h
# [3 B4 s& W! j: n; O- G, E    jz      SoftICE_Detected6 a) g/ w5 L: P6 l$ N, |% y
5 o# k1 n5 {: i; t5 g- s" x9 P: B

6 {$ a2 ~8 B8 X6 ^=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
: n: ]7 M" Y- X' s4 l6 |( G   app like this:
  r" l; o$ @% b. L4 d* H* Q/ R5 v. l5 ]6 W
   BPX exec_int if ax==686 |; r2 J# _, v; F5 F
   (function called is located at byte ptr [ebp+1Dh] and client eip is
0 z( @# e2 P8 b; w" v% {   located at [ebp+48h] for 32Bit apps)) w* A2 w6 |2 O
__________________________________________________________________________/ J2 y4 k- D0 j( D* c" y& a
1 P& x3 }! i+ {; K

4 a$ [  \4 G1 K5 f, E9 ^Method 08
. l* c! c# a5 N* J. J1 u=========
. k& O1 P1 ~) x( o' y+ C# Y! @$ ~
1 n, d* W0 c: X3 Z" u, A& DIt is not a method of detection of SoftICE but a possibility to crash the
; K+ B3 U8 c2 B! g/ Wsystem by intercepting int 01h and int 03h and redirecting them to another" y; Q$ Y" [. a4 Y* E
routine., t8 b: {: h  ?  M  `+ e+ I
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points9 |: H- R' s# d1 [6 d( [$ a. X
to the new routine to execute (hangs computer...)
* `8 f; Y1 s/ o0 m# ?; W
( ?& A  ]7 f2 C5 J& l7 Z    mov     ah, 25h
. a/ S9 h2 l/ D( x    mov     al, Int_Number (01h or 03h)
: _# P. e/ B# ?# I5 C4 P1 O    mov     dx, offset New_Int_Routine/ d1 v4 U7 z% B* r
    int     21h; ]" Z7 k; n4 v
& H, p6 G$ J4 h& n* E% J2 E. o# `1 j
__________________________________________________________________________
9 z* y! `; Q% \0 n7 f2 Q5 b9 ]; u% `6 z
Method 09- f7 y/ z3 J# Z8 u, g0 t
=========
9 ]0 C  D3 s7 [! Y$ T! c$ Y& X0 G, t5 e4 s
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only. Q+ f# `3 z- p/ d+ a, @
performed in ring0 (VxD or a ring3 app using the VxdCall).
" u3 X* ^4 Y- i, _, rThe Get_DDB service is used to determine whether or not a VxD is installed1 G; k5 x2 \9 J5 x3 [! U
for the specified device and returns a Device Description Block (in ecx) for
0 N" `' x" _- i3 g5 B1 T; _that device if it is installed.
4 w0 t' T7 p# w. u3 q# p( z. E0 q) v' N  j4 x" r
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID2 K/ h6 b7 r( M
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
, U3 h% \1 n8 H   VMMCall Get_DDB! i3 V9 C: t+ S
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
! v7 R* e1 k) }3 C# q* \; n
) R0 U& F+ T$ E/ l$ yNote as well that you can easily detect this method with SoftICE:* ~" Q' ^5 A& ?! I
   bpx Get_DDB if ax==0202 || ax==7a5fh
) O" i( |0 M: G8 D* ]5 U8 v, s- N7 f' z% _6 W
__________________________________________________________________________
2 y1 v( ?" }3 G$ ~+ T/ n. v. M* w( C7 I& D8 u& Q; x
Method 10
" g$ R3 O% ^- I=========2 \( @! j+ @( t: X2 T6 X
- ^; o5 |3 @, n1 b9 V# w
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
7 n; j* X4 A: D( ^# O& h. q  SoftICE while the option is enable!!1 t6 ~$ ^/ x- L6 Y

8 r. V5 s  O" E* r' iThis trick is very efficient:
  S; j$ O8 e- |6 lby checking the Debug Registers, you can detect if SoftICE is loaded
0 Q1 a- g! k9 r0 X5 T(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if) t* o, E4 L3 E
there are some memory breakpoints set (dr0 to dr3) simply by reading their1 O4 i2 g/ y  I) y
value (in ring0 only). Values can be manipulated and or changed as well. m% x' {# C9 e' u2 \
(clearing BPMs for instance)4 [7 M6 W% |& ?- G( |4 e: R. y$ G; _  i

/ S7 L6 E: r' ^+ g__________________________________________________________________________, @3 p! l# n+ q7 P9 F/ B
* D2 ~0 L4 m+ Y4 l. Q( }% z6 N; j
Method 111 U: H* N& S$ C4 i, ?( Z# T  J
=========
+ P# c/ ]. C3 ]+ t/ G/ b
  h* r# M2 `& W) oThis method is most known as 'MeltICE' because it has been freely distributed. T9 C- j2 b" f2 g5 N/ V) J" [1 Y) R/ ~
via www.winfiles.com. However it was first used by NuMega people to allow
: v3 A* [0 P8 H7 o2 X) }( MSymbol Loader to check if SoftICE was active or not (the code is located
, Y( i8 j/ h0 Y* ^5 {: b, Sinside nmtrans.dll).$ k4 Y2 M5 r  K7 a- k( M

: Z' k, A- A% Z/ G* O+ o! q+ [The way it works is very simple:4 {, }2 o/ m) |% _8 ]8 h
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for) J3 a4 w2 i6 `: y: R
WinNT) with the CreateFileA API.2 C3 [. p$ H  V! ~
1 `% C+ h! \5 A. J3 q  y' e
Here is a sample (checking for 'SICE'):3 C7 s" x& o7 k- o# \, {
7 I! m# Y& c) O+ e! K" g% e
BOOL IsSoftIce95Loaded()4 O! j. U# Z* e* Z5 P
{
! t: H, [) K7 K0 p6 j   HANDLE hFile;  
. Y: ^' ~. O" W1 h+ t   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,$ r$ O) ?: `; Q: i
                      FILE_SHARE_READ | FILE_SHARE_WRITE,! Y5 R. c( k4 t( s2 m0 c
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);1 ~6 W& k. f# y) |; ~2 U' ~$ }9 X  d
   if( hFile != INVALID_HANDLE_VALUE )
5 A: x8 R' j% ^: s3 T   {
5 g; ^9 t, B" \2 o$ ?, l# W" n. _( ~      CloseHandle(hFile);
. J, m8 N4 u" C$ \2 v2 m* i      return TRUE;8 g/ {4 K' ]* L7 k- H) ~
   }
+ A, I% j% \9 v0 b   return FALSE;) X" K, \* F& k' a# w7 i( f
}
! t( G+ _9 j) i" _- Y! `& L. W
3 x$ R' k8 ~1 N' V* f4 }8 g) @Although this trick calls the CreateFileA function, don't even expect to be5 \1 [5 R# ]- p! X- K
able to intercept it by installing a IFS hook: it will not work, no way!
5 k9 q" Q, [" y( CIn fact, after the call to CreateFileA it will get through VWIN32 0x001F$ b- D( k+ \7 c9 F4 f3 P
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
/ L9 P. _2 |5 z, M' k: Eand then browse the DDB list until it find the VxD and its DDB_Control_Proc+ G1 b# ]% e- i* @  H* z
field.: f, f3 p1 O) q6 ~5 K
In fact, its purpose is not to load/unload VxDs but only to send a * _4 y/ q" c$ g+ x$ i
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
  j4 }$ l& r) j8 }7 w) Rto the VxD Control_Dispatch proc (how the hell a shareware soft could try* Q/ \8 s& R: s/ G6 p
to load/unload a non-dynamically loadable driver such as SoftICE ;-).) m& X( [2 v3 K% w: g+ P8 H
If the VxD is loaded, it will always clear eax and the Carry flag to allow
7 I5 L% k9 w- C. r0 Fits handle to be opened and then, will be detected.
6 Y3 ]1 R8 d2 W" ~; RYou can check that simply by hooking Winice.exe control proc entry point/ Q1 |! V+ V3 F1 f5 J% a
while running MeltICE.
  {2 k& b2 U8 g1 `2 }3 m
, @& C5 [- v" g) Y2 Q; c9 X) W
0 m0 U+ a) Y+ A  00401067:  push      00402025    ; \\.\SICE
2 M5 G& ^% s* d& Z9 k  0040106C:  call      CreateFileA. N/ g! Z3 q5 I$ {1 R
  00401071:  cmp       eax,-001
4 @3 I$ x( J) N+ v" V% y  N3 M  00401074:  je        004010910 y8 J2 N' D& E& J" r2 G

- f" a: g) z1 {  L! P0 A
( A! d" e2 l2 N- mThere could be hundreds of BPX you could use to detect this trick.: p" V/ n) ?* J' ?# n" K
-The most classical one is:
5 P. v, z. N9 R+ J& F& w% h  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||$ k0 o& K: ]! W7 Q2 O' p% C6 W
    *(esp-&gt;4+4)=='NTIC'5 H. x' j; \4 }$ L; ?1 _* e
" O3 \8 X+ I! ~5 j3 Y7 B: @
-The most exotic ones (could be very slooooow :-(
3 q( ^, o( x' ]1 U   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
* [, j" `  k5 }" R2 i7 u     ;will break 3 times :-(9 o# q/ R3 j, @& Y

5 o8 m& Y% i* Z: v- a7 j-or (a bit) faster: " r8 ~0 l& V* ^" V" E$ j
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')" \: }" r1 L- A6 {* V! |# L" m

' L$ F1 G# t# e   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
1 j0 l& p) }4 N$ s6 ]     ;will break 3 times :-(; `; G5 d# t( }( H

: l* B! @+ a/ T- r6 A-Much faster:
0 S- I. N; j0 j- f! G   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'7 Y; x5 }* F  P
) K: [, R6 _- [0 \8 L+ x
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen
. o) ]5 t+ _0 ~, @function to do the same job:+ w5 E. z4 Y+ k: z% U7 F$ E
: t5 W2 Z9 ?- R( R
   push    00                        ; OF_READ
, X* ~9 ^5 @) c2 N0 b3 Y4 p   mov     eax,[00656634]            ; '\\.\SICE',0
/ w7 o% L% S0 W# K6 l. w$ W   push    eax
9 p: F4 ~5 f* d# J1 c" L- k( r0 p- p   call    KERNEL32!_lopen
- o( o! d5 I8 z* z& R; T" ?   inc     eax" D) i" k9 N+ a. O0 E/ u' S
   jnz     00650589                  ; detected
' N3 v$ D3 r+ ^' e8 ]   push    00                        ; OF_READ' ]# A7 [) f9 s( N5 u3 j
   mov     eax,[00656638]            ; '\\.\SICE'
( {- q" c8 H; v! G1 Z2 L" r   push    eax
, p1 V6 D8 |& A1 U   call    KERNEL32!_lopen
( |6 U+ m& G( L, `9 U   inc     eax
4 f4 T. `4 ?4 I   jz      006505ae                  ; not detected5 `; s$ G4 {7 C8 \0 P

% a* H( H8 j  u8 n3 j! Q9 z; L
& p" L* T8 V) q: g$ g; S" d+ v5 e__________________________________________________________________________9 G+ V0 k" g6 q5 J0 w# L2 h
: K. t2 z; O( e. O1 J2 ~! p
Method 12" F) q; {5 F% Y! z, V+ T9 o' j
=========7 b  ]0 X. a& C% x. |  }$ f

2 {% j' B1 I/ Q( H$ ]This trick is similar to int41h/4fh Debugger installation check (code 05
+ w' f9 h: P$ z6 f&amp; 06) but very limited because it's only available for Win95/98 (not NT)5 X, o( n9 W; Q# v7 X' I- g9 R
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.
7 _! i# [7 X9 A3 S6 e" j8 P; w* _) U  _4 L' j1 s9 u' r
   push  0000004fh         ; function 4fh- L# e8 k4 U4 n  f/ `% u1 d5 w
   push  002a002ah         ; high word specifies which VxD (VWIN32)/ @9 R( u: [7 V& V& E- N
                           ; low word specifies which service* x: L5 k+ Q3 c" ?; x* J* H
                             (VWIN32_Int41Dispatch)
* C2 _6 n: c% _   call  Kernel32!ORD_001  ; VxdCall0 I( H  Q* f3 a% e, ~; f! C/ B; x
   cmp   ax, 0f386h        ; magic number returned by system debuggers
1 u, g* e: W# C7 x: j0 v: z' ]   jz    SoftICE_detected
; a8 }! z( X' i( y1 D1 x! L; {
9 a3 W! J+ d( y3 |/ |Here again, several ways to detect it:$ B0 ~$ R) |1 X, C8 w1 }1 r. S4 Z
" F+ E7 Z  Q: u( J9 D
    BPINT 41 if ax==4f
: y' G, U, ~% F$ o8 s: y$ Z* x5 S$ k" m3 v  Q  q
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one/ @- b6 U) d' j1 X" K2 b
; Q* f6 |9 T0 W1 w, }& e# S
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
5 L' f& H3 Z" K0 z6 @
! l7 x" G( }9 V( ^% a% t    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!/ ?5 O' A, v& q

; c7 n8 _- n5 [. V8 l  f6 q6 X__________________________________________________________________________
- n) o  R% ~0 u" E0 [
7 T- m, k* b' ^3 y9 ]Method 13
7 [( Q4 _5 t: W0 T=========
! ]5 a7 Z( Q) Q0 l& |8 k$ n: D* i' h( c
Not a real method of detection, but a good way to know if SoftICE is
# }9 G) G) [* [  L0 w' Uinstalled on a computer and to locate its installation directory.9 l3 M& V: }5 E( c. g3 Z0 i
It is used by few softs which access the following registry keys (usually #2) :
" j8 j2 v- y5 v% N$ @: H, y' Y: X8 U& b$ L3 n
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
- i7 |% n; P6 w7 q& Y  W0 k\Uninstall\SoftICE
/ H! }/ k$ c+ q* }" e-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
* S9 W& Z9 o8 _# [; a. O-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion9 a* Y* f5 v4 X/ i" V& Q$ W
\App Paths\Loader32.Exe
. z8 y4 ?, o9 p! K( [* R. }- B) @2 b

0 g( q: `, q* cNote that some nasty apps could then erase all files from SoftICE directory( y4 B- V& a2 f) T
(I faced that once :-(1 t  m1 ~0 M( s; c+ Q9 _: F9 |* I

. h: G9 d0 \! g3 n4 P& J) s6 \2 ?Useful breakpoint to detect it:
7 a2 c. U6 U; \2 T% m
. j* t: ?2 }, F2 C8 M: M# t& J     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'  Q: l5 A8 i2 o9 v+ @3 m9 b
- y2 {! F7 ~, }4 a0 V, p7 u
__________________________________________________________________________
  z7 j6 V7 E: u2 d+ A4 u9 a2 K: L2 h) D$ a' N! E; d8 }
6 p+ l8 F8 }  }. {$ X) W- z
Method 14
5 U/ [2 n* y' N: B+ r2 o( h=========
5 Z  M! ?" Q! ~# r5 w1 u% N
7 t9 w" t! K) B  {A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose0 c) h, P) M$ i( {5 q
is to determines whether a debugger is running on your system (ring0 only).: z' C- D/ Z0 t% [5 J
" x" G2 F! a; U+ l; ~
   VMMCall Test_Debug_Installed* D& y( L" R6 b* ^. K7 h
   je      not_installed' `- M, H" V$ \
% E& h- Y/ y0 W& s5 o& e4 ^
This service just checks a flag.% d7 N# ]  x. r7 E9 J0 j: G7 Q0 i) q
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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