找回密码
 注册

QQ登录

只需一步,快速开始

About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>5 T+ \' t) x3 J4 c
<TBODY>7 I( V* ?& _& l6 j. {# f! W( ]& b; m
<TR># \; |' H) M) z0 H
<TD><PRE>Method 01
# O1 N) M. }* U$ W% n; G- C7 G" c$ X1 ~=========
% ?* `6 P9 a9 Z$ U- H3 ?8 c5 m) }/ e9 ]& P: f
This method of detection of SoftICE (as well as the following one) is
4 _% V4 F7 V$ Cused by the majority of packers/encryptors found on Internet.
3 \2 V+ w9 W, DIt seeks the signature of BoundsChecker in SoftICE  L: N# E; e! ]7 H  `
) d, S; J# b  x
    mov     ebp, 04243484Bh        ; 'BCHK'
8 ~7 G- n; e* [- a; X1 W1 b/ Z; {    mov     ax, 04h! v! o2 r+ Q. [& K. o
    int     3      
0 B, \/ |4 L( j4 z; [- Q    cmp     al,4# D0 e1 [: m4 `, e
    jnz     SoftICE_Detected. j: g% P, P2 Q5 S6 y
& s9 [- K# [: F& b  n0 T' s
___________________________________________________________________________5 q( T1 @8 V/ k/ _0 B. o  s+ w' v
( K! j2 p) e2 S" k$ R2 [
Method 02
) u' ~( R5 O7 `! j! ~: ~. P( _=========
, v8 ?/ W; r5 }. M0 K! ^! p
7 c1 \" b3 z+ `& RStill a method very much used (perhaps the most frequent one).  It is used  f: T7 O! c- [( L
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,/ P% d, u5 R. j, J6 y9 ^8 }+ u& z
or execute SoftICE commands...8 Z, Q! R# y' @8 M
It is also used to crash SoftICE and to force it to execute any commands
% N5 q" J0 F! M; o( t* S4 q- H(HBOOT...) :-((  
9 W8 ^" e' X+ X9 L" ~& \. z, n: U
, a5 L- P; o) }# ?1 O$ ZHere is a quick description:9 F* h% D2 @3 S0 h' g. V& D
-AX = 0910h   (Display string in SIce windows)  v# F+ U6 E' B+ w% i
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
& \9 t# U( b* F" J-AX = 0912h   (Get breakpoint infos)
1 D" h( L6 p4 s; `( M-AX = 0913h   (Set Sice breakpoints)# i  V; n9 V2 u- z; b
-AX = 0914h   (Remove SIce breakoints)
  B: g- M# n  q1 T) M% i/ V. ?4 ?
Each time you'll meet this trick, you'll see:
" M6 y! Q( Y5 Y-SI = 4647h9 t! T3 \* u6 N: x! H/ D8 @
-DI = 4A4Dh
( {2 _: X" x, F7 v6 j/ b2 EWhich are the 'magic values' used by SoftIce.' r) f# w8 F6 g/ h5 h
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.. w( l; O% @  w" f
- q: G0 Z2 J; L3 p0 R
Here is one example from the file "Haspinst.exe" which is the dongle HASP
" D" v$ k/ j+ ZEnvelope utility use to protect DOS applications:' z7 A/ y0 F  r- B

7 S3 ~/ r1 F7 I
" j6 P" R2 i7 g. j9 B' E4C19:0095   MOV    AX,0911  ; execute command.
5 }4 C: V% n2 r/ Z/ p5 Q- R, i4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).* s% K1 c/ U. C! c4 N
4C19:009A   MOV    SI,4647  ; 1st magic value.
% B5 ?! n/ ]9 C6 A* O+ C0 L+ a# S. X4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
3 n: D$ A% E, w1 c/ r4 q+ |4 e4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)0 c2 i# Q  p% X
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
  O" s! A( L; g3 B4C19:00A4   INC    CX
9 v* A; j( V. c2 t4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute% y: k% V# @/ l# U- i" O8 x
4C19:00A8   JB     0095     ; 6 different commands.! ]3 o1 O! B3 T& J
4C19:00AA   JMP    0002     ; Bad_Guy jmp back." J2 q3 e4 c0 Y) k) p2 V# i6 C- o
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
) _# C; e" Z- E2 \3 u; E; m6 D' H: l7 S! g/ b- w# L
The program will execute 6 different SIce commands located at ds:dx, which9 E( S! J. c& C/ z- W) {0 {
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
3 R$ q1 }4 d! ]6 l2 j+ {
# V1 B! U0 [5 x* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.' K' v- t0 p' _) Z
___________________________________________________________________________. m. a, |; v; {# |( |8 e0 L
: N. f6 _( P3 t7 W$ \7 }) k
" G) O( X0 n! u+ p9 t
Method 036 q, t% i; v% M: F/ R5 B
=========. O9 M  T. F4 s% W( Z! X1 d+ X

; ^; O4 h$ s  y7 U# X, s. M: x- Z1 GLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
2 ^' f! @. E8 x; q2 N: `! G; o4 \(API Get entry point)
/ k1 Q# @  Y/ L0 d/ q3 s' Q        8 V3 m$ D+ o& Y) F- {5 `

- b' w7 C8 W% t' k    xor     di,di
9 A/ r* J' _  h& Y) _    mov     es,di
% C" Q7 O' D5 T7 j2 S7 e' ?    mov     ax, 1684h       / p- D9 Y$ Y$ L' r3 o9 h$ q
    mov     bx, 0202h       ; VxD ID of winice) I" u7 q2 V% z4 O8 z) u
    int     2Fh5 ^/ ~+ y" `5 }) c! u/ M7 D
    mov     ax, es          ; ES:DI -&gt; VxD API entry point* s$ I8 h" w7 T4 Q! J
    add     ax, di  n, b( ]3 H# k
    test    ax,ax  \4 O& J2 _/ Q; j' ^6 X
    jnz     SoftICE_Detected$ k7 I) s5 P: W" a9 F

9 q" A7 W9 k" J" ]/ r___________________________________________________________________________% E$ u9 }; p" _, u( k9 B2 o8 P
& C* Z$ p& J' k# b6 C$ }4 _3 {0 s
Method 04
& h) a; e2 O1 A3 y% |: ]# Q4 ^=========
+ i" h& T: c" \* z2 S6 k; M: ^, q2 S% q
Method identical to the preceding one except that it seeks the ID of SoftICE
+ v2 K7 t$ ^# L: f6 ^& m+ l  UGFX VxD.
8 G% Y0 |3 R2 G
( k1 h6 [7 [8 \. l, b; Y: F, C: @    xor     di,di
: C: n9 E$ y+ w/ w0 u0 i' J5 O    mov     es,di
* ?/ O4 t* C2 l- a/ Q    mov     ax, 1684h       7 E7 ]$ Q  K  Z$ r# x& X
    mov     bx, 7a5Fh       ; VxD ID of SIWVID
5 x6 W# `3 D& N  J    int     2fh
' {3 H9 M* y3 t9 y$ t; I    mov     ax, es          ; ES:DI -&gt; VxD API entry point
! [1 P( z& N8 B- r$ D' A    add     ax, di
8 G7 F0 h2 a8 W( M    test    ax,ax
2 ^2 X' L6 c4 k# e. [1 h0 [9 \    jnz     SoftICE_Detected2 K6 I& U' T* I5 c$ U2 P
/ m3 E% |. `& Q! \9 K
__________________________________________________________________________
/ x- c2 C3 }8 C
' S! s) w4 q! M; S6 W; b3 _4 ]1 m1 b) s" k# [. ?; q" [, v
Method 05
. y8 ~! s1 A( N& M=========
  j' z; U! S8 f) y2 y1 G0 O* O" n7 F9 {# p8 g9 U/ {
Method seeking the 'magic number' 0F386h returned (in ax) by all system% K- m  H) y8 l
debugger. It calls the int 41h, function 4Fh.$ x* C- l+ U$ E9 m' \
There are several alternatives.  + n( s1 s) b; }* T4 M
, t- Z4 F& j& n! |
The following one is the simplest:
0 s  u) w! q1 y* G5 k. p- g8 [/ B7 o& V$ }, t
    mov     ax,4fh
( g  C" I( X0 R- K. b( t    int     41h% k  w0 w( u8 m  V& G6 m* r
    cmp     ax, 0F3869 R; R0 Y9 I' L8 _$ F/ p+ C0 e
    jz      SoftICE_detected
8 u, M$ R1 G0 n# P8 W. F; n9 ?2 u  r5 |6 S

2 w& |: b) h7 i! CNext method as well as the following one are 2 examples from Stone's 5 }9 D3 c  N2 P/ w& e' R) _
"stn-wid.zip" (www.cracking.net):
/ n2 e% B  E( O6 o, Z0 ]# |8 S* m) s) m6 M
    mov     bx, cs
( P, `, V/ U4 d" n) J7 F    lea     dx, int41handler25 P: e: ~! L; x6 z# c; d
    xchg    dx, es:[41h*4]
  u# Y  c* c; B$ |( D$ y* t    xchg    bx, es:[41h*4+2]+ ]! W, A8 u0 W/ l9 _& \6 S
    mov     ax,4fh& i7 p2 @. U" \( Z- M0 }
    int     41h
2 _) A- A: `  q! a* ~  X% _    xchg    dx, es:[41h*4]
4 G' i  L6 b* T" P; Z0 `    xchg    bx, es:[41h*4+2]
( Q! \$ K9 g6 P. x+ U2 s4 L1 a    cmp     ax, 0f386h5 S  n: B5 r% ]9 l$ J
    jz      SoftICE_detected5 ~. R9 F$ \* D  a- ^' k
8 s) I1 |# x$ d5 S1 `. D; v! E
int41handler2 PROC! g% O$ n  W5 u# d! C$ ]/ X* }
    iret
4 r/ v* e# p" @* Y; Jint41handler2 ENDP
. ^- S7 p. g# g( q& L) ]/ s5 Z1 j/ }5 R
! f* |7 U) G. b; l4 K  n
_________________________________________________________________________  E4 Q% |# ]3 T% r/ p& c
) W1 V% D4 G( s/ C6 a

( Q  K5 ~4 n7 u2 h5 b2 y2 A. sMethod 06
( f% [+ ?5 R3 K+ w=========
9 P# s5 Q8 [' C' ^
+ V: X8 u$ H& h) r2 i1 D, j: g7 V/ s4 X6 x! [7 i2 u
2nd method similar to the preceding one but more difficult to detect:
; L+ g& _7 |5 W7 i6 }% K- t' L9 e- Y3 U/ S: N0 k' V$ P

% Q( v* {" n3 u5 O9 \4 i2 X4 Eint41handler PROC
4 G2 f- I" M- |# j8 K0 S    mov     cl,al
5 h7 j' F$ T0 [* m, D    iret5 L( m$ q, I; u
int41handler ENDP. {9 j' G, w3 j' O0 @! _

0 \; t( b2 p- B
2 r; ?3 e4 B( x+ d    xor     ax,ax0 p2 A9 P, x7 ~: F: a! C5 z
    mov     es,ax4 j& N; P5 N$ z, d: X- w
    mov     bx, cs
: \- L6 |! |9 L    lea     dx, int41handler
+ L  d: `7 F: S4 F, |3 s2 _    xchg    dx, es:[41h*4]% q3 W  Q5 f# x9 z, H( d7 }" E
    xchg    bx, es:[41h*4+2]
* k9 P# o4 J5 B. j; f    in      al, 40h0 j6 A! j( l& e  c( [
    xor     cx,cx( w( o; a0 W. h3 \7 }& G$ l
    int     41h3 M. W& a& j- a! P- {
    xchg    dx, es:[41h*4]( I5 u* n7 d3 g3 }. z. e; w) W# u( F
    xchg    bx, es:[41h*4+2]( ?4 L9 ^/ j2 F+ H7 G( I( a
    cmp     cl,al2 I5 n0 D1 r) u9 |
    jnz     SoftICE_detected
& V2 p+ D& K* Z- X& [# W4 P$ s
' S5 p" }1 X( k" X5 P; N$ B& E_________________________________________________________________________0 `; y" {9 e  E5 Z7 {7 H4 N
: A! N! ?. l$ D6 t
Method 07
+ j1 H1 P" P0 Z# H: M0 u! O% F=========. L, [8 O/ t# ~* S  B# S/ T' D
& f  s& c" Y, C  Z  j  y
Method of detection of the WinICE handler in the int68h (V86)4 Z7 L+ n4 C! V6 D
4 Q0 Y# D" K$ G0 E" s
    mov     ah,43h$ U) _, _* C6 t+ F8 ]& r
    int     68h
! s5 C" s+ V% _! p    cmp     ax,0F386h
3 x' h+ c8 @% b- k2 u    jz      SoftICE_Detected
! q: O  k; e8 l/ T7 E/ t. b
9 p1 T/ \3 q7 h7 r- `6 C2 [# v0 M, |  |1 W2 r# K; q6 X
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit) L/ k& h$ g2 M& p/ [
   app like this:
6 t% k3 S4 W# e7 h5 ~
: e& a9 l- r, v* e. O. M   BPX exec_int if ax==68
' X2 p/ l6 d$ D" G   (function called is located at byte ptr [ebp+1Dh] and client eip is( S$ G, K! I+ y# l$ w+ ?& @; ~( Y" U
   located at [ebp+48h] for 32Bit apps)8 X7 ?2 `5 {& `& J  B
__________________________________________________________________________$ B+ k$ {" v& ?, L+ ^4 H

# t+ b+ }9 Z/ S
9 S1 y) Y: L  ^1 hMethod 08
. ~' J4 g, Z* X1 P6 I3 a=========
* I( a5 Z2 d' \: J: K$ Z
$ E4 P4 ^1 K9 A9 \- N; xIt is not a method of detection of SoftICE but a possibility to crash the- a+ Y0 Z' V# P4 c. Y% e
system by intercepting int 01h and int 03h and redirecting them to another
/ ~& `- g. t) ?; Aroutine.
" F' w  I- d" V! A% e9 @It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
! e6 j, Y+ b7 V6 e2 {) yto the new routine to execute (hangs computer...)
4 p" x# I4 S1 t5 f. H) O- u8 c  `8 ^' h* c- {
    mov     ah, 25h6 D" R! e* y$ S6 z
    mov     al, Int_Number (01h or 03h)1 h4 o5 Y! ^& h4 J  [" L
    mov     dx, offset New_Int_Routine
( U7 T! V6 d( {& ?    int     21h
3 n" U4 J& C) E) z) t6 n. f3 M  |* }0 f. R
__________________________________________________________________________
! D# ?& q0 V3 G7 K; T9 V  ^5 U$ J4 E/ J% ~  b1 z9 Q: ]( o( j
Method 09
! ^! |$ F& l) r9 j  g=========( K3 D! i+ l- O( j5 w- b
  V, F+ D9 _5 p. e: s" x9 b. P
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
9 {, Z0 R1 P6 Rperformed in ring0 (VxD or a ring3 app using the VxdCall).# y+ {, x- q* e8 U: K6 E  O) Q6 @+ M
The Get_DDB service is used to determine whether or not a VxD is installed
& ~1 b! z- I8 n  U' Zfor the specified device and returns a Device Description Block (in ecx) for
! e# R; L2 D1 L4 W2 |0 sthat device if it is installed.5 ~2 C0 t* K: `6 W
9 ]: S6 Q! Z  r) e7 F4 {
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
' q3 q/ ]) M3 b6 D" ^   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
" X- h- Z7 B8 T- n( F9 G   VMMCall Get_DDB
: W" t8 ]6 y& A   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
- _6 f, C  A4 g( e8 ~! r' \' B* }8 ~5 h# G, c) ~0 _
Note as well that you can easily detect this method with SoftICE:
( M, t% X& D2 I/ B; H7 a   bpx Get_DDB if ax==0202 || ax==7a5fh
; B8 b  y$ z1 l1 q+ _1 d6 V) d8 g' [$ ?' a# D; G/ f. R
__________________________________________________________________________' k+ B0 c1 e" l
# ~  ]4 v2 K! {# b6 k) T
Method 10
+ c$ q" |* A% O, |% K/ W=========2 l1 c" j" V% ?
" M' M% c3 v% ]- V3 r4 \
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
' J- u0 S5 C( @+ P+ D8 Q$ ~  SoftICE while the option is enable!!4 t$ `3 P0 p6 X3 P
0 [+ J& x# q" i6 d
This trick is very efficient:
7 v6 y+ V% [7 ]$ S- l; d4 Fby checking the Debug Registers, you can detect if SoftICE is loaded# u* C8 i. f% }6 K
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if( q3 s/ w3 w; u2 C" R# O
there are some memory breakpoints set (dr0 to dr3) simply by reading their2 N* x$ f2 R! v0 ~0 y
value (in ring0 only). Values can be manipulated and or changed as well
' O7 r( w- _# s+ @7 C3 k4 M(clearing BPMs for instance)5 O/ U, `% m- B0 F+ J6 T

- U2 I  s8 J+ w$ O/ j# |5 w$ p( P. E__________________________________________________________________________
/ z% J& ]5 ~; n
7 M& U$ R- R$ H. I2 d) W# m+ uMethod 11! X1 q; E* J( ~# J
=========) B( s9 A8 S. s4 T3 {8 r1 Q" c5 k

! J3 {8 {4 b: C! _5 V' o8 yThis method is most known as 'MeltICE' because it has been freely distributed
; Y3 {* Q; Z( I& i; e$ Svia www.winfiles.com. However it was first used by NuMega people to allow
5 r! k9 |, F5 @. @& l  c2 fSymbol Loader to check if SoftICE was active or not (the code is located+ ?9 v8 n* H: G4 w: ?& l! y
inside nmtrans.dll).
  s- [0 M' F, _3 \# C
: L- q, t% b3 e& _The way it works is very simple:
/ a9 I2 M; a  O1 O. M  VIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for8 \; Y! i9 _$ H
WinNT) with the CreateFileA API.
) X! f  Y2 V6 L* a
3 U$ C8 O" D! PHere is a sample (checking for 'SICE'):( [- D0 P2 X9 u4 @- m/ \' I

4 @" p9 ?& p/ yBOOL IsSoftIce95Loaded()4 d6 p( F% I& a* {5 x8 ~
{/ s/ X* ]/ J2 I# w
   HANDLE hFile;    K3 a: n8 ?: f& A
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,$ P) N! N) Z% V+ W( Y, `/ K
                      FILE_SHARE_READ | FILE_SHARE_WRITE,
6 N) d6 Z( |) G, G' S8 p" y                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);$ F4 t& z+ E4 P* ]5 B; c1 ~
   if( hFile != INVALID_HANDLE_VALUE )7 a9 \5 o& z+ Z
   {
5 P* b9 ^" ?- n# S& ]6 a      CloseHandle(hFile);
. Z8 g! p8 f! `  ^1 U! Q2 l0 W0 k      return TRUE;
8 ?  N# c4 F* [  p  l4 V! B   }5 }7 a9 P' R- ^0 |
   return FALSE;
1 v* Q6 r$ b6 t/ O$ Q, F1 I}
! G! a( Y( t: D# L- J; E5 Y, n& g- e# I5 \* h( o
Although this trick calls the CreateFileA function, don't even expect to be6 o8 i( i& K4 R: F8 k$ D
able to intercept it by installing a IFS hook: it will not work, no way!; `# b+ r: @2 n  B/ C
In fact, after the call to CreateFileA it will get through VWIN32 0x001F0 c$ w$ z( l1 E0 p1 E
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)7 m" }+ X6 f! z
and then browse the DDB list until it find the VxD and its DDB_Control_Proc) @2 g% r0 C! E5 Y$ {
field.
, ^8 Y( x. C1 I8 c2 V! xIn fact, its purpose is not to load/unload VxDs but only to send a 1 b0 f8 X$ E/ M7 u5 ?3 \
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)9 I, r# |. ?4 l9 }; Q; \: c
to the VxD Control_Dispatch proc (how the hell a shareware soft could try' z! D4 a5 ~0 _$ L7 W
to load/unload a non-dynamically loadable driver such as SoftICE ;-).- W' V2 t4 G, b
If the VxD is loaded, it will always clear eax and the Carry flag to allow8 y1 v+ s; K  h
its handle to be opened and then, will be detected.) k* g, ~9 ^( P( _
You can check that simply by hooking Winice.exe control proc entry point
) c9 i. o! s  O4 [: xwhile running MeltICE.
2 z, w' N, ]$ J! b- m; f: N5 q1 d: B: g: ^$ y& R. B6 u

# m* g; d) N! ?# v! ^0 E$ r  00401067:  push      00402025    ; \\.\SICE
2 a/ Q$ B4 K  j  0040106C:  call      CreateFileA3 M1 O# D- U' s, B1 |
  00401071:  cmp       eax,-001, c' ]6 _5 u5 Z- t5 m
  00401074:  je        004010913 n* G/ M- t% O8 i
9 C% Z- G: X; Y) }

7 C6 `; v3 x% [& nThere could be hundreds of BPX you could use to detect this trick.3 F' ^& R7 R1 }/ L& ~6 H
-The most classical one is:% b  a5 g: `5 o! I# I, O  ~" z
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
* l3 O' z; n& t5 ?    *(esp-&gt;4+4)=='NTIC'
: m8 r4 J3 I7 f0 y
1 K8 u& s9 b6 ]3 ?: n. ^* X-The most exotic ones (could be very slooooow :-(
8 m/ h- E/ n& O  f4 o$ O   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
" j7 X7 z$ p/ e+ k5 y2 \$ ]: k     ;will break 3 times :-(
) `; j+ j3 B7 {9 B, G  g4 h
/ h. J( K! g5 B, V-or (a bit) faster:
5 V' m# _/ a" ^6 A   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')2 z( |" ]' b0 Z% I/ h, d6 ~3 p1 K( T
5 v& r: _9 Y4 R$ T
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
: M' G( h4 _  m7 h4 n# C4 D     ;will break 3 times :-(0 ^5 J* I0 p4 Z5 R* }5 U
" Q4 h' l6 W$ @* F
-Much faster:
: b1 u9 D1 H7 N% [* R1 \   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'4 ~& \1 N3 t) K
3 T; A5 c3 A3 S4 Q; b. Z9 U
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen
% V3 p" g, s% i9 u7 N  sfunction to do the same job:
( |# E% [" j5 u) p% w8 j$ p) e' t! k0 @4 P6 q( k! z& L6 ^
   push    00                        ; OF_READ
5 s6 y' O- P+ K   mov     eax,[00656634]            ; '\\.\SICE',05 w8 c3 i2 w% D1 _4 L
   push    eax2 s4 o/ m; }' P. ]: K) `+ V
   call    KERNEL32!_lopen
, _8 g4 d4 g% y9 O   inc     eax
/ A" J! t  q# ]0 u   jnz     00650589                  ; detected0 P: @2 p% j9 U+ ]2 s. C
   push    00                        ; OF_READ4 U2 ?* l1 p3 P& T# Y$ N6 p
   mov     eax,[00656638]            ; '\\.\SICE'0 l" n. V7 r/ b. q  h
   push    eax
; k4 _3 R4 |" H( P. X7 R) S   call    KERNEL32!_lopen; [+ Z1 \8 L1 f- [
   inc     eax0 z  |. e8 u6 F6 `
   jz      006505ae                  ; not detected
( J: j3 o( C+ E" H5 k6 y% z, c9 V, Z) `5 n1 j* r* \8 t

4 `' E! x. {( o__________________________________________________________________________
- m2 K& h: I) s7 O
9 T) ]3 |" E' _) F5 IMethod 12/ Y) Z8 O8 ~" x; B: v
=========8 {$ S/ N" L% n# _( ?

& g& i! _4 @/ oThis trick is similar to int41h/4fh Debugger installation check (code 05
. F9 K" \' P% D8 Y! X&amp; 06) but very limited because it's only available for Win95/98 (not NT)
8 i7 h) G- F* A5 s- u: m2 Las it uses the VxDCall backdoor. This detection was found in Bleem Demo.# O- D3 `( Q4 C/ |8 Q- d

7 a. {" K8 x9 g   push  0000004fh         ; function 4fh# |9 Z- h8 t8 s
   push  002a002ah         ; high word specifies which VxD (VWIN32)
8 G7 a% O1 f+ z" K  g3 U# V                           ; low word specifies which service* h% n$ F/ l0 t* [! `" o# @
                             (VWIN32_Int41Dispatch)! q, J# R1 h6 W
   call  Kernel32!ORD_001  ; VxdCall* V1 H2 F8 L. u) C% Y( S
   cmp   ax, 0f386h        ; magic number returned by system debuggers
' t+ @2 N- @% {   jz    SoftICE_detected* k8 ^/ U5 _5 `4 t3 a: m4 P

1 e( ^, L3 q+ K3 E7 L& {* cHere again, several ways to detect it:8 Q& ]9 I8 ^* W# W+ K: S
4 N2 E5 O* Z. w
    BPINT 41 if ax==4f
9 n; G* l  }, V- J" \/ e# r( G- X* E0 j0 U; ]
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
) o$ p3 @, y4 x# Y4 \0 O" z
4 \9 r6 [4 M; G  s    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
: V3 @; j. S! [) Z8 K) F1 W5 Q4 \  S! ^7 N
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!+ \. n5 u0 `1 H$ P6 P! `( x

& z  H# m4 Q# K1 o0 O+ H__________________________________________________________________________; Q: [0 q5 E- q" Q0 R: H/ b& _% w
5 T7 Y- |: Z  t3 H, `; @; T
Method 13
  v% T6 N; L! Q! [' H# p. r=========
8 C' d7 ^0 t% g  J) w& O1 k1 ?" j& B5 U# F/ e
Not a real method of detection, but a good way to know if SoftICE is8 h; L- g- {$ o, o, b: n4 y7 P1 Q4 C
installed on a computer and to locate its installation directory.- \  q; w: Y) Q
It is used by few softs which access the following registry keys (usually #2) :- A2 w/ R) ?1 i2 E, r8 C) Q0 c" Z
8 n# M7 T3 p* c) F
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
) p: M3 n( p) p$ y: T; l\Uninstall\SoftICE
) |% l/ x' J+ a+ c; m4 r! T-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE: I/ V! z+ r9 {+ S. J" |, A
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion) d" |9 A/ x2 d) `8 {/ w
\App Paths\Loader32.Exe
9 q9 n) }7 _5 c
" F, j9 X0 d$ x/ C6 C
8 M# Z8 e/ q. j7 |2 w" T1 |Note that some nasty apps could then erase all files from SoftICE directory' H7 Q: U$ f1 M# \+ y
(I faced that once :-(
) T5 x2 o$ D9 s7 y/ e9 m
- Y+ r/ z' k, P. T) c5 T6 sUseful breakpoint to detect it:8 ~$ [4 ^4 M3 e

, M- {; A1 s( |& P0 u8 \# Q0 Q     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
) G/ z. A3 i7 {1 d/ t2 L4 c! Q$ q8 @: M
__________________________________________________________________________! ~, A0 ^: B! @  y& b0 b0 d' i
! S/ Z3 B! d7 v6 ^$ \( L
8 O9 _: @5 N1 ]
Method 14
- a" j, @4 |  ^; V4 _+ Q=========
- ]. y5 r1 Q% y# ~7 G& @2 O) E. d6 e
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
2 A! X# F' }$ x, f" n6 ?1 K3 a: [is to determines whether a debugger is running on your system (ring0 only).
( d0 m# s9 n3 m6 u2 A" y9 c: ]0 i! d+ w& e" a
   VMMCall Test_Debug_Installed
+ C" d, J: y6 l' {9 X2 g   je      not_installed  x* ?9 q2 E& ]/ U& X# r# K0 i4 u: M
9 |/ @$ g" a; A: f# i
This service just checks a flag.; ]5 t5 B8 b: W. q$ k( Z7 R* Z
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|本地广告联系: QQ:905790666 TEL:13176190456|Archiver|手机版|小黑屋|汶上信息港 ( 鲁ICP备19052200号-1 )

GMT+8, 2026-8-18 18:34

Powered by Discuz! X5.0

© 2001-2026 Discuz! Team.

快速回复 返回顶部 返回列表