About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
; Q" Y0 E' k: O5 \( L+ ]  a<TBODY>
9 {, w/ k, e8 X) T/ o) O3 R<TR>
+ p& j, s+ P" ^7 l4 W<TD><PRE>Method 01 : m4 O' Y5 M) R8 K+ B* q9 V
=========  c3 G- |- O$ ?9 A0 S
8 i: \" _/ k# Y+ f
This method of detection of SoftICE (as well as the following one) is$ \# U: _; b7 }: f# B3 j& Y7 P
used by the majority of packers/encryptors found on Internet.4 f7 d5 d1 ?6 \* ~. B% V3 G. u
It seeks the signature of BoundsChecker in SoftICE
8 Q5 A' T- t) |4 w! o& X8 {  H7 z7 j7 P3 i
    mov     ebp, 04243484Bh        ; 'BCHK'; t9 o2 [6 U" @1 Z% ]) Y/ c9 A
    mov     ax, 04h
9 H  F! A3 e" ]8 z4 v/ ~5 N/ G    int     3      
, s1 K9 q+ N$ b9 a7 g. T3 b    cmp     al,4! T) i5 E( F: G( t
    jnz     SoftICE_Detected2 ]7 i! v% v1 \+ I3 ^+ i

. ]) }9 F2 h$ t0 [: a# r! w5 @___________________________________________________________________________& K1 W) z/ _# C+ J, W) ]

; G2 Y* P6 L  h5 QMethod 02( L1 v& `1 z0 A5 b
=========
9 m( a1 J% v7 g% G4 q4 L- R% `0 Q" t8 X' M/ N+ O
Still a method very much used (perhaps the most frequent one).  It is used5 B1 B; p2 Z, W- ?  F% J
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,
9 p* M) o4 T# E' {  tor execute SoftICE commands...
9 u4 c! u" }) D# vIt is also used to crash SoftICE and to force it to execute any commands% K; d& R& E- a' j3 M5 \
(HBOOT...) :-((  - g' z& I; V3 `8 g; o- g6 Y! C7 Y
. z+ |: q0 z. v4 l
Here is a quick description:
' {7 I+ l3 ], N+ c0 w7 \. o1 r-AX = 0910h   (Display string in SIce windows)" Z! }+ w2 m) o% f2 D/ i$ O2 o
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
* F# G' Q6 T$ \+ O+ e0 B2 A) k-AX = 0912h   (Get breakpoint infos)& \& q7 ~, N4 z7 S) b% L5 W7 b6 V
-AX = 0913h   (Set Sice breakpoints)+ @$ D) j* h0 e+ f  p
-AX = 0914h   (Remove SIce breakoints)7 {4 g; o. q0 _' s" w9 F
  u2 ~$ s3 T9 O- Z# }
Each time you'll meet this trick, you'll see:
5 @  ]  s2 e% Q5 Z  W/ M-SI = 4647h
0 [: P& J* E9 x: B& l: o-DI = 4A4Dh
" |/ o" }6 k+ L8 F) i8 n# [Which are the 'magic values' used by SoftIce.
5 F8 b0 V, {0 G$ r0 e3 lFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.
/ P  X7 U& j4 v, V" d! n" [* q0 c) F& B! Y; h
Here is one example from the file "Haspinst.exe" which is the dongle HASP
3 m3 w# U6 B  }$ mEnvelope utility use to protect DOS applications:0 o0 T* `) Y6 ]

8 H& ^: |5 k/ [- Z. r* s* t; A
8 G+ W  S# `. U* B+ W% N# Y4C19:0095   MOV    AX,0911  ; execute command.
2 ~! _* T8 `) x( m6 ?3 s1 q4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
# ?4 C* ?. ~; d; p2 U+ e" I4C19:009A   MOV    SI,4647  ; 1st magic value.
, c! R, g% c. j, z& U4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
0 B* n! v, X5 p: q4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)1 P% v; n- G) G" i
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute' R9 t& V9 o; H5 ?5 f7 d# K
4C19:00A4   INC    CX
+ P- `9 x/ C- J& a4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute2 d" P) \# f3 z  F; i+ H
4C19:00A8   JB     0095     ; 6 different commands.
" H0 G. a2 X9 g; c3 n# E" |, h) d4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
, e* g6 J; x6 r- X! X8 N6 n4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
; G9 h) `  ]1 K2 r6 T- |! F3 {9 @4 B# n+ t7 l* W3 y5 ?- X) L& |0 D
The program will execute 6 different SIce commands located at ds:dx, which
5 P3 F9 C9 u) V& W* Y6 _2 L7 vare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
6 J, n$ X, `' j2 h6 l3 l5 \4 ^5 l: E; h2 I2 t
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.  k, j, W+ s4 v/ D9 U1 R) V) L6 b% O- y4 k
___________________________________________________________________________
& c+ Z1 R9 P# J& C) W+ D, u9 c
1 H4 {- M0 z2 M$ X% ~2 }$ p" P$ {  R9 H4 a
Method 03% }, {/ K3 R8 n6 z  z+ E- o! J
=========
7 _# @7 N) \+ [0 _7 U7 y- q, W, s2 V* u0 v
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h$ y1 N$ {- r2 x. ?' ~9 V; D
(API Get entry point)
* B- C, u: `% Y! _) v        % I7 P3 z0 Q6 r

& O2 Y  V, W8 G7 v) [0 ]% z( B    xor     di,di3 g, |# r: N9 Q9 {9 ]4 t8 x
    mov     es,di
+ c" Q/ A/ M! {3 Q    mov     ax, 1684h      
7 o, x2 U; G" [' t! `! B7 T/ f    mov     bx, 0202h       ; VxD ID of winice5 n( H+ P+ q$ s5 [9 r
    int     2Fh
& ]% |* V" {0 D! O8 l1 `    mov     ax, es          ; ES:DI -&gt; VxD API entry point
- [" y5 R$ d' S  T: i: r    add     ax, di/ M' U( m6 [% u7 `; J
    test    ax,ax9 @: I% Z/ b+ {! _" m. ]: x
    jnz     SoftICE_Detected
0 j7 T- F7 Y$ o: H% m2 G: O* \+ B* e- U- _
___________________________________________________________________________
" S$ B% m; V$ ~' P/ ^
' J3 d  ?8 r/ b& H. c2 QMethod 046 s- H4 a8 q5 [7 x) b2 n- J& p" f
=========7 o9 S; `6 m- C5 @
6 j1 q3 t5 O3 C+ V* l+ N3 A
Method identical to the preceding one except that it seeks the ID of SoftICE) O# ]# }/ {, e2 V( Y" S& z; ~
GFX VxD.. {4 N9 ~9 O: ~# R4 m6 R

7 X1 E& a: e+ `    xor     di,di: y! Z9 s3 T- u( t; l  z
    mov     es,di
" c- m1 Z' n1 y' H    mov     ax, 1684h      
2 `8 |4 x6 `4 _& q# I4 K% `    mov     bx, 7a5Fh       ; VxD ID of SIWVID! B: {5 C# `( [- ^
    int     2fh
- K* l; p: T- \- |& m    mov     ax, es          ; ES:DI -&gt; VxD API entry point; `) M. P7 K0 E8 Q$ U1 k/ {
    add     ax, di
* s' T5 m! Z; d$ a    test    ax,ax$ a5 `9 x4 z. k# a
    jnz     SoftICE_Detected( d0 j* Q$ {+ M& }3 `; V8 i

$ \1 G/ f1 W* B: g0 u  d__________________________________________________________________________* Q! o. P+ q) ~0 D; T' f

% n0 {. {4 Q, D8 S
3 `5 r& s, \5 ~0 ~: ~( d' cMethod 05
0 N7 G$ n1 W1 D: o* O* K( M=========! j3 n0 m' ^4 O' w
/ W; {: F7 a( m! [+ C$ o/ [& [  d
Method seeking the 'magic number' 0F386h returned (in ax) by all system
+ K5 }+ c- n/ V" g0 u, f' udebugger. It calls the int 41h, function 4Fh.
) n( j# f2 K9 _! h4 ~( I- u% d: H+ r: ]6 eThere are several alternatives.  
) d/ M# y  r/ H/ F, z9 k- `) {
3 o& Z6 L" M5 Q1 {$ v# QThe following one is the simplest:) R2 z+ E; ?  C5 S$ R& G$ ?3 g2 N

3 l2 N9 w, h7 R    mov     ax,4fh
3 C* q2 i" }# H7 ^4 ?. c- A    int     41h  X8 d( X% U; D0 a0 |) e/ ^
    cmp     ax, 0F386
1 w# ^! b: S( T, Y0 U    jz      SoftICE_detected7 ~, l- n& N, o- V8 r
' Z# i3 p, G# \: b* v+ Q$ ], S- H
7 ~: Y* _$ \+ ]% T# }3 D3 X/ \- y
Next method as well as the following one are 2 examples from Stone's / j) j6 @) z& ^2 k6 w
"stn-wid.zip" (www.cracking.net):
: T: h3 d! G' A7 B, b# p( t$ C; G, I) k! Z' u% k% C6 H" M
    mov     bx, cs% Y( O2 P7 ?4 Q' n  W$ Q; F
    lea     dx, int41handler2% [: X* ^+ `! O  r
    xchg    dx, es:[41h*4]
. @% h( J) G$ _+ X8 M( `9 Y    xchg    bx, es:[41h*4+2]
0 y1 s, v4 [( f: m+ {2 R' j3 ]6 m    mov     ax,4fh' L9 k4 M! i8 |4 c. g- S
    int     41h
: R6 Q% _4 E/ q+ m; F    xchg    dx, es:[41h*4]4 Y- ]; Y" M0 v$ B5 m3 Q+ l3 x
    xchg    bx, es:[41h*4+2]
( Y& \; U' R, s! ~    cmp     ax, 0f386h3 [- y; R, w4 G
    jz      SoftICE_detected
" k6 h& [' a5 X- u* r1 n, p0 d* d# r% K& M6 A5 v
int41handler2 PROC" x- _+ a( k4 z. H6 O. {7 n) D0 {
    iret
6 V" v. }" n3 F  n* ?& c6 z( nint41handler2 ENDP+ ~, |" y( C" l% M' l9 r
( q/ P( s* ]' D0 |6 f
) i7 w1 o( V8 ]& x
_________________________________________________________________________- A7 x2 I, w. q3 I
) L9 F0 b* w8 x- J/ @" y2 \

4 R5 _+ D  [9 E' _8 t4 _2 _9 u9 jMethod 06
; [! t% N' i6 c/ R- Z9 a6 j( s; P=========
4 d  G; C% c* Y1 R
% x4 X6 ~0 B$ I1 \
- f2 o1 k4 L& `2 I3 t- z3 N2nd method similar to the preceding one but more difficult to detect:- |. p1 O. b$ G0 p6 l& E! z
' e& L" O3 @9 K- r& [

; Z# i2 f1 k0 o3 R$ Z2 N" A7 kint41handler PROC
6 \& L. c1 n$ z  G6 \! Z    mov     cl,al! f; ?( s/ I0 \7 B! p' @5 z$ k
    iret
9 y# r! ?, ?" H  v* f5 f, d1 dint41handler ENDP+ X% e" A9 S# r. y: V, |

, l! S1 A, _( c/ k" {+ B8 n1 Z& X0 S4 h0 u
    xor     ax,ax) T1 |; y7 L7 s+ J5 }1 d. J8 U& y
    mov     es,ax
" V' T# M: v$ L% E    mov     bx, cs
* l1 e( b* e, s5 P5 [    lea     dx, int41handler9 e. i6 }, c: g% t: M
    xchg    dx, es:[41h*4]8 D1 A$ i: |* {, X- i2 {! O
    xchg    bx, es:[41h*4+2]& h& r( T! `% q7 X& a
    in      al, 40h
: P2 a4 c6 R8 f9 \! ^& l    xor     cx,cx& w8 M! g9 b2 y& j
    int     41h/ R6 c4 e0 n0 J+ J1 n! _; c
    xchg    dx, es:[41h*4]
  l. J% w7 k  ], ?  \    xchg    bx, es:[41h*4+2]6 G( `' ]3 Q7 i% ^, M
    cmp     cl,al2 M* s, ^$ f) ]4 y# r2 R0 q) ?
    jnz     SoftICE_detected+ D* B( _$ K4 S6 \/ }: }- [$ l
9 @: o. {: C* a* n
_________________________________________________________________________6 |( x5 g( ~) L! p

9 S2 F& E& E, y) A* C4 ?) dMethod 076 i% c  O0 [3 n) h
=========7 V/ G6 Z1 ]+ a7 x

% t6 Q* x! b$ g7 eMethod of detection of the WinICE handler in the int68h (V86)
0 C6 d) }  ?: u' M# A4 m9 ]8 w$ e( {
$ n% U6 b& L( j; N) d* P    mov     ah,43h, l0 \& r1 \8 L/ o9 Y5 Q) A0 M
    int     68h
1 ?9 h/ U0 U7 F6 W' [& |. Z    cmp     ax,0F386h# W# v  r; v8 K1 S  g/ d
    jz      SoftICE_Detected
7 H1 W% `# j) A. E+ Q
1 ~6 H! D, i2 m
, D- `. o6 w8 t! }=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
- y- ~7 W8 N2 Q   app like this:
1 z, @% F# ?* W7 h( Z
# ~0 R5 a2 d0 o! F   BPX exec_int if ax==68
9 n& D! X" ]2 Z% g. ]; l2 o  B' j   (function called is located at byte ptr [ebp+1Dh] and client eip is( v, S3 l3 u2 j
   located at [ebp+48h] for 32Bit apps)  P. m1 u) O( k  ~9 Y
__________________________________________________________________________* k9 C$ X: U& Z
& J" ^5 Y+ P, Z/ @8 h
" q- r+ K) B0 g& J4 `9 u" u4 p7 r" a
Method 08( Z4 q& D- v8 Q2 O
=========
3 O% ?6 S- h% J( X0 [" Y3 {0 s  Q6 F+ M, f6 E
It is not a method of detection of SoftICE but a possibility to crash the- c) o2 J/ c3 f( t# n  I2 T! F
system by intercepting int 01h and int 03h and redirecting them to another
1 r$ X- f3 V+ Y2 p# a+ K  c- G  ~routine.
7 @% V2 \' M3 m3 E, DIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
( L+ J; Z# _2 N6 F7 Zto the new routine to execute (hangs computer...)
8 }- B8 |# C" g
) J, o+ @" ~7 ~1 F0 a# t    mov     ah, 25h1 y  t! `% ]( _3 K- O
    mov     al, Int_Number (01h or 03h)
( s2 }# q4 s3 X4 V8 ?2 k    mov     dx, offset New_Int_Routine+ x& d+ j7 m6 u1 C
    int     21h
0 X2 M  O7 i) q" e+ N0 `  s
& c' I$ [. a# j2 }__________________________________________________________________________
, ~# |" n; d! S( I( D8 d$ R
: l" m1 ~5 P+ l# A. cMethod 09
8 x6 N* h- }7 P8 E+ g# A+ F# p=========- G& j+ h, _- m: k, Q

$ n) c. ^  X: j: Y. bThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
" }% G' p# h1 }8 ]: |3 }9 L: Vperformed in ring0 (VxD or a ring3 app using the VxdCall)., v6 l) ?. j) [
The Get_DDB service is used to determine whether or not a VxD is installed/ w! {/ J! f  R- b
for the specified device and returns a Device Description Block (in ecx) for
3 R2 y) S, t: Bthat device if it is installed.
0 Y: ?6 Z4 e/ p
: G6 t' G3 u: w- D; D' F/ @/ P   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
. v! Y% q2 p6 r' I8 b   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
% A! R2 @! o  U$ F, h   VMMCall Get_DDB% G8 |' o, R" F+ X) V& c& B
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed- U. t; e3 O7 Q3 n$ |
) \& E/ U/ j9 J6 j, g3 a
Note as well that you can easily detect this method with SoftICE:" R; g4 O3 V. X$ S* T
   bpx Get_DDB if ax==0202 || ax==7a5fh
# C, j. m1 }( D# v# y$ S
  _! i$ ^% U! G) u8 ]__________________________________________________________________________" T  V; @& t! p, M0 F6 z- Y

; w$ u0 U) |0 m# f  {$ _Method 10
$ S8 R8 x9 d; W; F=========
8 Q3 ?# j" k1 K# t7 q
( p0 R7 H$ x' o) J6 y3 [=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
. {1 J  g2 i" _! F" e  Q8 V1 W  SoftICE while the option is enable!!0 ]/ L5 `& ]2 a* }) k9 Y

  D. C, f2 U  P$ C. P( RThis trick is very efficient:
! m! u' i- }& Lby checking the Debug Registers, you can detect if SoftICE is loaded
0 j5 P) m0 _* T9 ~' y! A2 h7 m+ v(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
, V( [" G- h0 ~5 g  u& gthere are some memory breakpoints set (dr0 to dr3) simply by reading their& {$ {9 k8 y$ H
value (in ring0 only). Values can be manipulated and or changed as well  R; w8 e2 @2 G" F, F( p0 p% E
(clearing BPMs for instance)
$ W& _8 L' Q4 r0 K: ]- ^" _0 r3 v& Y" D9 q( d" Z
__________________________________________________________________________
0 q. d: |& ^. e' Y! K: w
/ O* G# Z0 B5 [$ W  TMethod 111 S- Y" ~6 e% q# v; l7 p$ Q3 l" u
=========
: q. l8 J* w3 |4 \
1 Q6 V7 I& o/ X( }$ k" s! ]This method is most known as 'MeltICE' because it has been freely distributed
( V7 S3 q" b9 _via www.winfiles.com. However it was first used by NuMega people to allow
6 X' D5 }. _" RSymbol Loader to check if SoftICE was active or not (the code is located# u. o! B% o. f- ]: S( ?( t' q$ M
inside nmtrans.dll).( A( L6 c/ [" u. [- `: P% J- @2 m- J
  V5 @9 t' N! U( r4 z$ P
The way it works is very simple:
9 x2 h" B$ T0 M0 q; O' S; P% tIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
& a* ?* t, X' k! _WinNT) with the CreateFileA API.
1 l, q4 S: ^- [; D- X- ?% V
* h* Q' N; V% O$ ~$ X* nHere is a sample (checking for 'SICE'):. Q! m% _& v3 p4 i/ [
, f1 k. O/ J& c: D
BOOL IsSoftIce95Loaded()2 I# f& m# L  f2 X' c. R3 u7 ^' C
{( Y* j' o9 v" _2 ?2 C, w- ~; l
   HANDLE hFile;  + Z; b4 g+ Q. l# U2 A5 R4 T% A# S
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,1 E6 A. c$ |# c9 {
                      FILE_SHARE_READ | FILE_SHARE_WRITE,
( u' ]) r  W. |  T                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
7 U+ f2 @% M, Z' j  K! k1 ?   if( hFile != INVALID_HANDLE_VALUE )
1 R" O8 n8 `$ d8 i+ m1 y) H   {- ?6 I7 v; D, U9 L1 B! e' V
      CloseHandle(hFile);% \& F) n$ g( w# b3 l( ^- [: B
      return TRUE;7 E9 {; z# J/ f6 G4 C
   }
! c/ P4 M/ X: L+ G4 D. g+ `   return FALSE;8 e) U( d* h( I1 S1 L( x1 Q
}
; g, A, Y# u' O9 K  Y7 b  Q5 P: u0 X& k; b3 d
Although this trick calls the CreateFileA function, don't even expect to be
$ w# n6 B: {! ?0 f# l5 R' |able to intercept it by installing a IFS hook: it will not work, no way!* }6 q* y! K& T/ ?* i
In fact, after the call to CreateFileA it will get through VWIN32 0x001F
2 t; i$ N! H& C; V3 z/ N& V" Pservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)/ D" Y7 s5 s2 T* t9 n! j. z% D
and then browse the DDB list until it find the VxD and its DDB_Control_Proc# {9 \7 B& s7 }6 i( {* x4 A0 j
field.
) n2 X9 `9 i" ~" h; nIn fact, its purpose is not to load/unload VxDs but only to send a
, o1 U5 H/ c" iW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)! K* f% M$ }  y- j( V) |5 i. k# Q
to the VxD Control_Dispatch proc (how the hell a shareware soft could try
- `, p: W8 I- L$ H  T/ c/ Mto load/unload a non-dynamically loadable driver such as SoftICE ;-).; _6 g/ }9 ], j( {' Y
If the VxD is loaded, it will always clear eax and the Carry flag to allow
* `4 J) k$ f9 C5 @5 J+ V5 H: u! Jits handle to be opened and then, will be detected.
9 ]- [# L" ?7 K. s5 H; u3 m5 pYou can check that simply by hooking Winice.exe control proc entry point
! _6 N9 e  ?" |while running MeltICE.
7 y& u6 U% C6 X2 U7 |4 l( o- {! z
( k; ^# c* {' r" [6 |: [
9 O$ m! e: S* Q0 x. P& Z  00401067:  push      00402025    ; \\.\SICE& M9 d1 J0 w& L
  0040106C:  call      CreateFileA
% U2 |" h8 t3 D. o% z, D  d  00401071:  cmp       eax,-001
8 j% O' `: k) s. z8 |" ?6 c  00401074:  je        00401091- ^4 w; {; B$ M5 ?+ z) c1 U9 P
5 C; V+ f. I# o

8 H1 ]1 [  ]9 Y+ z  H3 E$ `There could be hundreds of BPX you could use to detect this trick./ O2 v4 D6 H% n
-The most classical one is:- ^) ~* X/ Q. l
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||5 q5 p8 }$ _  K1 B( b
    *(esp-&gt;4+4)=='NTIC'
6 P" u6 n9 w" J" J: n
9 J0 ~' J1 L+ f  \3 O$ y: u-The most exotic ones (could be very slooooow :-(/ ?' V6 P  h5 M7 _
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  8 a$ O% `! f- w
     ;will break 3 times :-(
7 v- S% m; u! B# Q3 {# e
- e+ a/ w$ s6 X) J8 _5 z-or (a bit) faster: 3 {- G* O* x& y% O& |( a
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')+ M2 Z' Z2 ?1 Q
- `# A/ L$ ~  D9 O& R
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
/ i0 E( z" F8 R+ e0 Q5 H+ {: C9 j     ;will break 3 times :-(8 X# h. M$ g" I* g- J
5 x* v% ~  W" \& O& n% ?( ~. F
-Much faster:
) R, D/ S. z" i: [& P4 ^   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
+ g; |6 G6 F' g3 z2 Y9 V5 J0 V( {# ~
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen% L' }5 _% v0 |- S- d& a
function to do the same job:
3 A4 |! Z- y' b7 g5 x6 S4 ?& c2 m( x/ D
   push    00                        ; OF_READ
4 o' e9 G& W5 v  I5 ?9 c# G   mov     eax,[00656634]            ; '\\.\SICE',0
2 X; O( x3 Z4 |0 u   push    eax
$ ]5 f0 _, m: T3 J( U+ b+ E" [   call    KERNEL32!_lopen) M# T( Z, h6 y6 _( m6 D
   inc     eax7 c9 E8 }4 ^! L4 V  ]& y
   jnz     00650589                  ; detected
, L4 }, h* S' {8 c4 A   push    00                        ; OF_READ
# [7 N' z: a7 c   mov     eax,[00656638]            ; '\\.\SICE') e6 @2 K! P* g# W0 T& `
   push    eax
) D# ^; ^7 K) n2 F   call    KERNEL32!_lopen
0 e& _. o8 T' W0 {, r6 J5 e7 b   inc     eax9 t' X- R, R; G% ~
   jz      006505ae                  ; not detected
# J$ j( R& ]: [" w6 q& n# z0 S% g( O4 s" N
& R5 p: U. ^0 s7 S% y* a$ x8 o
__________________________________________________________________________
( t' g% H2 n1 f4 T1 B, o' E' [/ C5 c+ |1 u3 A. a% M
Method 125 d! O2 l, j% u# {/ i
=========' q- }: ^2 R* @0 P1 J0 x
& y/ L  I0 P# q9 i+ i
This trick is similar to int41h/4fh Debugger installation check (code 05
0 F9 w5 v* \5 l9 p, ]&amp; 06) but very limited because it's only available for Win95/98 (not NT)' D- J# l0 {4 m3 X" m6 A+ V) N) c
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.
$ H2 O6 U2 }5 t, T
4 e, L5 U& o' b* h7 z7 }6 m4 t   push  0000004fh         ; function 4fh6 \# _6 g; T- o* r  p$ z; k
   push  002a002ah         ; high word specifies which VxD (VWIN32): `6 d' c- j. n  e6 J
                           ; low word specifies which service- U" |) M1 _# Y4 s9 A/ k- Y- `0 e$ V
                             (VWIN32_Int41Dispatch)
  o  [% J) `( O+ ]) L9 ]1 h   call  Kernel32!ORD_001  ; VxdCall
0 j* q+ ]8 F$ @( d   cmp   ax, 0f386h        ; magic number returned by system debuggers
6 m& W4 I  l+ M   jz    SoftICE_detected1 ^* p+ Y+ Q) @/ D/ v
; ^/ V3 W$ e4 i; w. w# @  G+ p
Here again, several ways to detect it:  _2 R9 q5 _( [) Y$ k* [" Z8 W/ X
* I9 \  j$ R" u$ z- n
    BPINT 41 if ax==4f
4 Q5 c5 ]! s1 x* L' [3 p2 q3 ]
- |7 w2 d" @0 t* V    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
- u% s, f6 c' v/ n: H1 @. S& \
3 H6 i) n% h8 t( }' o- n    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
0 @  c) a- J5 A: v  c8 X- B8 n
- z! w0 s' e+ l7 @/ A6 \5 q; m    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
" D; ]; ~# u. _# {- w: X: Y3 i1 h+ j$ j5 p3 T$ H6 ^- X2 H
__________________________________________________________________________
6 N( }- q2 l  ]+ B3 D4 r! M8 E& y2 a% O' u6 s
Method 13$ c8 H$ d" k7 |& u- D
=========
+ v# M) o0 t# T4 ?. b8 \2 }* i/ e0 o5 I( g
Not a real method of detection, but a good way to know if SoftICE is
5 ~5 }! M* F3 e5 Y' E5 w5 Oinstalled on a computer and to locate its installation directory.7 L  u  E" t! G
It is used by few softs which access the following registry keys (usually #2) :
; G- z) d( ^9 T- C
, |! C: A" a1 h2 {3 y-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion4 t4 ~9 M8 K: L, j. X1 F
\Uninstall\SoftICE
5 |# [7 y8 N& f-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
$ U+ |, f6 A2 C2 F  N) I) D% d% _-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
0 t, Q0 }+ u7 V+ y\App Paths\Loader32.Exe
% d  c; S! `: H3 a7 W! `
  U7 k5 f' C) A* @$ S7 R, W" d+ A; K$ Z. W, j" Q1 L% D+ G( [  V
Note that some nasty apps could then erase all files from SoftICE directory
, ], X. D! m' [3 s  \(I faced that once :-(" u( b! b7 y  }2 n1 o8 L: o, E6 p

1 w0 U7 n$ I0 p2 m3 K! zUseful breakpoint to detect it:4 M7 H% ?6 I5 ^' D! _' N2 K. n

2 O+ K2 G# Z* o  G, Z& i     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'- X! m* p! [1 ~/ v, \$ W; \/ X& x8 J( h
1 r0 X+ o( Z; D: T) M  A9 b
__________________________________________________________________________% v) W3 F" g( x* d1 ?
* k6 O* T. I7 G' u$ G1 \3 p' m
4 @- q+ w) _# I+ a
Method 14
5 Y, |0 B2 Y+ k0 ]) I2 ]=========
) O( Y2 B: c/ m
' t6 G; p) l* S' GA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose6 n, f; G- L. A  P
is to determines whether a debugger is running on your system (ring0 only).
9 N1 S9 d' x5 M( `2 T3 P  R6 w+ R" m
   VMMCall Test_Debug_Installed7 O- }. `4 H0 n6 t- Q3 H
   je      not_installed
# Q  Z) U- _5 Y4 \2 v2 l. v# u$ l: T& s" ^. B& S& k
This service just checks a flag.5 Z0 o% n$ b1 c0 Z. Y0 \% x
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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