找回密码
 注册

QQ登录

只需一步,快速开始

About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
+ K3 p# f- h1 ~( S<TBODY>
/ D4 Q; {9 z7 u8 y<TR>. w) T5 d. |  \- k
<TD><PRE>Method 01 ( Y* a1 q4 j  P  h. h/ n
=========
# I9 i2 t- D1 I3 p
& `' d  a0 v( u8 `0 vThis method of detection of SoftICE (as well as the following one) is
. |# m8 g- m. n( I4 P4 s+ Aused by the majority of packers/encryptors found on Internet.
( @5 f7 p8 O% R% T* s: W! H* B8 \: GIt seeks the signature of BoundsChecker in SoftICE
7 q# o) {+ ]5 ^. {, x+ `3 g2 R  a
+ v6 o7 m/ O* A/ p7 ]0 v  F% Z    mov     ebp, 04243484Bh        ; 'BCHK'! u( n; H* m; U
    mov     ax, 04h1 r: j! q, H6 T' \  u7 j/ q- p
    int     3       6 x) O  [# V+ V3 V/ d. D
    cmp     al,4; c* R! a3 W! z3 z4 h( w0 {
    jnz     SoftICE_Detected) ?7 F0 l9 }. ?' t% H

8 k! |' u  h' ~___________________________________________________________________________9 q' D! {4 b; R

0 U" b. v; H) AMethod 022 a" ?& U, C  f; o2 y
=========8 x# \2 B2 v/ Q

  w' h$ \6 F6 W& R, gStill a method very much used (perhaps the most frequent one).  It is used" `" @6 G: G4 ^3 d# T
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,3 _4 A2 J/ |. k$ B9 ^. |
or execute SoftICE commands..., P, {6 {9 b! E# M8 s7 E6 g$ e0 O
It is also used to crash SoftICE and to force it to execute any commands
( B  i" F4 P* d$ [0 K(HBOOT...) :-((  
* W" ~, {6 [8 x+ f$ `! w. U4 S8 M# n! y/ M9 _* @( {5 N
Here is a quick description:
, n1 Y$ F3 F  X( N5 {; E-AX = 0910h   (Display string in SIce windows)9 A  i0 R7 J# F# o) D; t
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
% x% R, ~2 g* I& Z' h7 a-AX = 0912h   (Get breakpoint infos)% `2 s8 ~5 ?  R9 m" J
-AX = 0913h   (Set Sice breakpoints)1 I& s+ c' D! Q, ]& w$ Y( L
-AX = 0914h   (Remove SIce breakoints)
+ V1 R+ p7 k! d# j) j$ `% @. L- R3 E) ~
Each time you'll meet this trick, you'll see:3 k! b: r1 K$ x+ M' S
-SI = 4647h" F6 \- Y1 B# |- L
-DI = 4A4Dh8 P  v" u' V! E2 x" z
Which are the 'magic values' used by SoftIce.; z( M+ s* O5 {5 L) s
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.
) s3 j: ~2 z6 _  j  j; ^
# P$ L1 F3 a) z# O9 |Here is one example from the file "Haspinst.exe" which is the dongle HASP+ E+ z- s3 C, n- M. v
Envelope utility use to protect DOS applications:/ U1 D) O( u# p1 ~4 ]& b- U
2 E5 c4 _4 a: B6 A8 |9 c
  H7 z6 S9 m/ }
4C19:0095   MOV    AX,0911  ; execute command.
9 ^! U- k$ c; s4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).) ^. a2 q$ O; x: F3 |
4C19:009A   MOV    SI,4647  ; 1st magic value.8 o, U& _' B  g5 n: O8 f0 c# f7 g
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
  b+ n; @2 Z, I: g0 D% F4 z4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)4 Z6 x3 Z+ \7 o8 J8 {( ?
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
/ u) q/ K' w9 U9 n4C19:00A4   INC    CX5 Z) v8 w& `+ @- I
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute/ S& y& N3 r* y: @& Y! n5 Y6 B& n' D5 W7 q
4C19:00A8   JB     0095     ; 6 different commands.
, o2 b  L0 j3 M9 ]3 z$ o2 I: ^9 ?4 J4C19:00AA   JMP    0002     ; Bad_Guy jmp back.& o5 M1 K* z6 c0 H
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
5 A0 e5 X% z; y. q+ J( w- |0 e4 v( T: e! |
The program will execute 6 different SIce commands located at ds:dx, which
! e/ W( B( {0 uare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.' j3 b9 P2 \! {9 z

4 B" Z+ h% [8 V$ ]$ U4 R3 `2 ]* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded./ ?/ R  K4 @/ t( i
___________________________________________________________________________
) H- }% ~3 i% q: ]1 L! g1 D( \. n* s( L* {4 f: i3 N$ I: n
2 _- m  i; O2 [) R* V
Method 03
: K0 t! `4 M2 @( s* k2 f! V- H  H=========
3 ?' N8 p* e7 f% p# E6 f( V& o1 J+ l6 ^, ]
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h4 F- |' z6 E4 l+ ?& W% @5 w
(API Get entry point)/ r6 M. n% b+ j# f1 r
        
$ R5 ^9 K+ A. e+ [$ F3 f. h
& W6 }2 Y5 D( o; K8 M0 _    xor     di,di
3 j% B, u* ?3 n1 R4 f" P0 i    mov     es,di
! c+ B' A& h. ?2 ]( O: p    mov     ax, 1684h      
! n4 ?+ l4 M7 {0 u8 W    mov     bx, 0202h       ; VxD ID of winice6 z# Z8 {: M& c* F5 R# U
    int     2Fh- x2 o8 V$ ~: z7 w7 D1 D- ?9 P
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
( L, P+ a3 I+ B, h8 ]$ }5 N" q    add     ax, di; f1 [; ]7 k; p# t8 @+ {+ M
    test    ax,ax
" i0 k3 S1 d* q( z" N+ {    jnz     SoftICE_Detected3 ~& Z; A' q  v7 J7 A- U+ r5 D
. z% W; G. i' x2 ]! @1 V: B
___________________________________________________________________________
2 K: y" x" O$ C; [: E3 B
% b' ~' s) I. o: x) [Method 04
  a; a: M7 U% X=========! H2 _" K9 l* @! I# P' k

+ t7 Z/ W9 T! @$ m3 J2 OMethod identical to the preceding one except that it seeks the ID of SoftICE  {& c5 ^# n. R
GFX VxD.- G& }$ H6 C" z- i. N* A

7 O) P2 Z; b) ?7 G    xor     di,di
6 n. B. [) r- @5 o; K9 c    mov     es,di
4 u" `) h- `5 K% C1 |    mov     ax, 1684h      
+ G$ c" z, l& e: n" {+ f# s. O    mov     bx, 7a5Fh       ; VxD ID of SIWVID/ u8 }/ u8 D5 y& @( E# O
    int     2fh: ^% H, U/ w: A- g- z) ?2 j/ p
    mov     ax, es          ; ES:DI -&gt; VxD API entry point; C9 Z! b# ]# s2 k  o0 |
    add     ax, di3 u, w8 e: ?" E* E* C
    test    ax,ax" n2 E, [2 W& I7 p3 d
    jnz     SoftICE_Detected
  q8 K+ g  C- a2 I) F& J5 ^# C9 `8 ?& [3 [3 {2 c
__________________________________________________________________________' R* y9 y* r% l5 m3 e; R
7 k9 U# B. q5 V

  v- Q$ `' j5 a0 pMethod 05
3 N$ G$ B' y* R# i=========1 a% U4 V& C7 i
) f4 z6 D5 B% r- Z7 N5 F' J. N
Method seeking the 'magic number' 0F386h returned (in ax) by all system& s# p; P  o& Y4 S& k* t
debugger. It calls the int 41h, function 4Fh.  \/ \  W+ \+ @0 j. B
There are several alternatives.  
5 T/ [" R( r8 x5 Y1 l5 G# p' ?. h2 z* G! Z& e
The following one is the simplest:
* k- A2 {' r; a, i' G  z  ?# P3 S: B/ |& }' P' c
    mov     ax,4fh8 }. q  X+ F. t9 c
    int     41h1 S7 H0 Z8 x/ m5 o4 E
    cmp     ax, 0F386# p& ^6 s  ]1 L  S7 `
    jz      SoftICE_detected3 f3 @$ W8 a) W
9 |+ ]" I9 W) e- a4 t% }" K
5 }) B3 P  ?8 e2 o% g  A& ^
Next method as well as the following one are 2 examples from Stone's , u: J% [6 t% [8 Y' R! M
"stn-wid.zip" (www.cracking.net):' k& `6 w+ M+ o% d: A3 G

' p5 p! ]6 k; x/ S, L0 E# R    mov     bx, cs
/ @$ _7 P7 d2 W9 t* L+ A    lea     dx, int41handler2
+ h6 S. N5 d) O3 n    xchg    dx, es:[41h*4]* k0 [& R8 F( r* g; K
    xchg    bx, es:[41h*4+2]" r: Z; p5 R9 B" @. _- A
    mov     ax,4fh* i- l2 Q9 ~; s2 i9 I
    int     41h
+ \- ]/ o: L) s+ L/ D) C    xchg    dx, es:[41h*4]
4 B, p  R/ A' [    xchg    bx, es:[41h*4+2]
7 J- K' C/ O1 B3 D) i    cmp     ax, 0f386h. e  O; N' }; t
    jz      SoftICE_detected; W) [& Q2 R% V* u# `$ |

& W/ q: D% s: D* i' uint41handler2 PROC
, G3 g# e8 i" L5 |. K    iret- ~2 R$ I5 {1 W/ J" g- S
int41handler2 ENDP0 v  c) q" M" q) u* B0 ~  l  q; S
" F2 F. G# O' G2 O" ^5 w4 T

# v+ z1 h& d$ D  B8 S  \_________________________________________________________________________
2 l$ Z! n! f  w4 C, }' ^
& |6 s  a! N- {  j' ~2 C  n6 Y+ ?+ D, d. i. l& x& b
Method 06
. c$ ^) o* Q1 _# Q+ U6 |# t=========
2 f  ]. P- R: d; e& F$ e4 i) a( h' y
5 [% b( Y  @$ i1 r3 u! K; @* Y0 w
2nd method similar to the preceding one but more difficult to detect:
7 W. p$ a) [2 G0 e+ w7 H* K
7 q8 O+ X$ V' `0 Q0 u
' Q  J' n. g1 Y0 aint41handler PROC& x3 ]' A' F, d/ B2 m/ j( e
    mov     cl,al
1 s: P& t+ i0 k! L, Q$ I    iret& e, _  i+ h& }1 ?9 t* n
int41handler ENDP( |! \: d1 c( K
# X" a% L; x  k% I  I, k6 U
  o) z3 p# W( U4 s  j+ l8 E
    xor     ax,ax. d, Z9 ?: R/ m- j9 l% Y" \+ Q
    mov     es,ax
/ P3 r5 P; W; \2 |) D+ T5 I* g5 C    mov     bx, cs
, J: Y3 e5 c$ Z: e' D6 d    lea     dx, int41handler' |6 B9 Z8 s, K, k
    xchg    dx, es:[41h*4]
- u7 a( A1 _5 ^0 l" h4 O3 Y+ A    xchg    bx, es:[41h*4+2]6 y3 N# Q2 e3 r  V2 O+ O! `
    in      al, 40h
) d: q3 y2 @* j4 E2 f9 Q7 `+ M    xor     cx,cx; ^) i, g: z0 t9 t: m- S, |$ W
    int     41h! @+ N( a( I+ a; f. z! k
    xchg    dx, es:[41h*4]
* C; |5 Q) r8 |# r& A& j    xchg    bx, es:[41h*4+2]
, }, p* \% \/ ]; g" W. E    cmp     cl,al
. w- z/ K% X5 p" z& {# d& x    jnz     SoftICE_detected/ b" @  ~/ E& @4 q
5 ?. m/ V4 O. k+ r7 p" n) C$ U+ ?6 Q
_________________________________________________________________________2 Y6 o  S- P- Z5 ]: P1 }/ z3 q' E
  |! {( Z7 r7 C  H
Method 07
( r2 N# m% f0 g=========1 Z+ N1 |& l. W, j# {* a
* H6 t3 [; B) ]/ R8 o
Method of detection of the WinICE handler in the int68h (V86)
, a$ c! z, [( O; T; ~4 e( L
7 ]4 z7 F# P( O4 }' I2 H" x    mov     ah,43h' m1 u' v1 G. E! L
    int     68h- j2 A) s9 N+ {. x% J% A, ^" U
    cmp     ax,0F386h
& X' Q* Q5 R. ~! f; ~! T# h0 A) u3 j% c    jz      SoftICE_Detected; I6 }$ m" h5 ^7 p

% m4 C1 ~) B: P
5 l6 d  D/ {2 ]=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
. F  t4 }. ?0 i3 l0 p   app like this:
+ S8 u2 O: I. @& D: C! V1 i8 H1 {- E0 ~. v+ Y" [" s/ ~
   BPX exec_int if ax==68
0 }$ S5 s* p: i# J- s& W5 ^( v   (function called is located at byte ptr [ebp+1Dh] and client eip is( `6 F+ t5 h) j8 C$ \
   located at [ebp+48h] for 32Bit apps)8 c( o, z+ \! ^
__________________________________________________________________________/ z) V) Z; R2 L$ B

" s' o3 G9 L  G; f
+ J) I4 s# k" s6 l& ~2 MMethod 08" ?( J8 h9 {; R- C! |3 V
=========1 K; N! b$ Q6 d5 e$ t4 g0 i: O0 I

( D  ~  S$ {' z3 RIt is not a method of detection of SoftICE but a possibility to crash the
, D( u/ D  f# Ssystem by intercepting int 01h and int 03h and redirecting them to another
: ^$ B" g; e: I' Proutine.
7 T/ L/ t; P, ?7 H3 w6 _9 p5 Z7 h7 iIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points: e( I; r9 h- s) J
to the new routine to execute (hangs computer...)
. f. f5 j3 l: z5 Y( r5 R: d- b, v( u$ M3 }$ m5 J& U
    mov     ah, 25h9 \8 a# g! a9 ]3 X* q
    mov     al, Int_Number (01h or 03h)9 t" \, U8 y! q( U8 Z8 m# C
    mov     dx, offset New_Int_Routine2 x, R  \* L" v3 i! |" @( N' h! Q9 @* w
    int     21h0 ~) ]- D7 I5 S, c+ c9 f
7 T! Y  b- s. U/ Q8 N8 W. V' `
__________________________________________________________________________
* D7 t! j% N( }1 j& P! S% [6 j! i/ \
Method 09
% O% j& h9 X0 f+ T& g, R& a. @=========
: t- }& v, t: T" E) d$ Y1 t, w9 o6 s
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
* q" \& e3 P2 operformed in ring0 (VxD or a ring3 app using the VxdCall).$ t5 P& z8 u$ E8 b: q
The Get_DDB service is used to determine whether or not a VxD is installed
5 E0 j# @' v& Ufor the specified device and returns a Device Description Block (in ecx) for
3 n. @9 }5 A9 _9 W! c+ B- zthat device if it is installed.
# c2 j9 K0 w: w# P& L* ?' q' ~2 Y1 X8 Q" U9 G/ P
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
: B5 H6 w. ^  [5 h1 O6 v* ]   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)# }! M+ B  I& O/ T' ^1 \
   VMMCall Get_DDB9 [: Q) ?, v" x. S( E% Y; w* L$ b( e9 m
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed% W, A/ A  {/ W* ^# z

+ |$ X8 b" O7 u6 JNote as well that you can easily detect this method with SoftICE:
/ [( c- A9 E1 U1 n1 S1 h4 j3 G   bpx Get_DDB if ax==0202 || ax==7a5fh
) A. X9 b  {+ m2 T7 T# @7 @- j2 G/ c$ b; e' c, J
__________________________________________________________________________, A. W) e3 s4 }% x) ?3 L6 [9 ]

0 w5 U: z0 o. w- r- D5 w# f! `Method 10) T( u% r5 K/ Z( ^
=========
% v0 B/ P1 r% G' N% [! L" R- r' @6 e% b3 `
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
- ?& I$ p+ u$ V5 m7 l' v  SoftICE while the option is enable!!
# Q# V" i4 j! ^9 y9 l
) C4 l/ W: k/ @5 T# e$ hThis trick is very efficient:/ i* `5 O( P: K3 O+ [+ y: W
by checking the Debug Registers, you can detect if SoftICE is loaded
7 z! Y2 k: J9 D$ X* d(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if& ]$ |$ e8 g- O  G8 D! L
there are some memory breakpoints set (dr0 to dr3) simply by reading their
" X1 W5 [8 h5 R; N5 ~$ \value (in ring0 only). Values can be manipulated and or changed as well
* p8 ]; t3 P  R  A8 g$ {  v(clearing BPMs for instance)& `4 Z5 a( c$ `: {/ M# a+ I* B
/ O: \' C5 \$ v' h) y) [- \
__________________________________________________________________________% R7 H9 z. ]  v

6 F" T( S$ s6 e# i" |Method 11- O% l% L! q' A5 t4 G/ |
=========
1 h* _' I# m, Y" F
/ L. J( Z- p  DThis method is most known as 'MeltICE' because it has been freely distributed6 m$ V0 Y! C4 h; V  v9 `
via www.winfiles.com. However it was first used by NuMega people to allow3 a5 b& Q* _" d- T- L3 e- w* V; w
Symbol Loader to check if SoftICE was active or not (the code is located
6 S, q! q* r, F3 p. S  pinside nmtrans.dll).
8 _4 J2 l$ ~2 g- }; L! Z- b9 b& L) [
/ T  R8 o, ]* D( z7 VThe way it works is very simple:
: w8 d7 A( U; U5 NIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
6 X" U; Y4 o6 A& T) \* cWinNT) with the CreateFileA API.) _. r3 I3 _7 ^- G) F
: L  V2 Q; }. ~, Y! J
Here is a sample (checking for 'SICE'):
( I+ ^- `: B, l9 B7 n
- L( m( e% U9 t5 |# p9 B7 b3 ZBOOL IsSoftIce95Loaded()
- C* K; f# J) u$ g" x. D# P{0 @7 o* H- b3 J  f
   HANDLE hFile;  
4 c3 e8 k& X7 b; R1 H8 {6 w   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
+ w5 o3 R& L2 q                      FILE_SHARE_READ | FILE_SHARE_WRITE,5 K+ i- b- `' L% L
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);  [( B! v9 ~, ]  W+ t4 }
   if( hFile != INVALID_HANDLE_VALUE )
6 [+ T, Y0 w, w+ ~) O" J1 i   {
, y3 W( W3 a# F: w! x( }5 A: u% g# o1 O      CloseHandle(hFile);% y( _& t% A& @  w( H$ I
      return TRUE;
7 F' W- ^) I$ d1 l" v8 h   }
4 c, X7 A, m8 B* `  ~+ O% k& {   return FALSE;; ~; q! O* f( J; g" F2 l9 q/ i1 \; v
}
5 c+ F7 D- Q) T/ B% k6 R+ g+ @3 @/ \7 v
Although this trick calls the CreateFileA function, don't even expect to be8 d& b, y; h3 }  ~
able to intercept it by installing a IFS hook: it will not work, no way!
0 L8 o/ k; G7 DIn fact, after the call to CreateFileA it will get through VWIN32 0x001F
  {2 [/ _/ p: H9 Q, ^service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
- P7 Y- }; Z# wand then browse the DDB list until it find the VxD and its DDB_Control_Proc
5 p3 p; G5 |. w% U0 m) W/ zfield.( h! a+ \) N0 p
In fact, its purpose is not to load/unload VxDs but only to send a * @0 m+ Y( t; p) ^# X
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
  f' D$ w1 G# Vto the VxD Control_Dispatch proc (how the hell a shareware soft could try
+ h7 g+ k) ~! o: \- c% }to load/unload a non-dynamically loadable driver such as SoftICE ;-).3 t, f& c7 Q; s  k8 a" {
If the VxD is loaded, it will always clear eax and the Carry flag to allow
% A, p# F8 ]5 d" Sits handle to be opened and then, will be detected.
+ a; L9 T/ O! ]* m; YYou can check that simply by hooking Winice.exe control proc entry point
5 [, t& a4 r) R% Lwhile running MeltICE.
3 J8 p! r# d3 {) o+ m* ~* |! T9 t( V! A- v3 e
, G" Y/ s# k8 W$ I* o
  00401067:  push      00402025    ; \\.\SICE5 c/ {( g8 H0 Y; @- I
  0040106C:  call      CreateFileA7 R9 ?. u7 I. ~. W
  00401071:  cmp       eax,-001, w; r! G( ?" J2 Q( z: k
  00401074:  je        00401091
' ^& D, {5 V& [- A6 X0 v& R
* t2 O2 c& |* j% q
+ Z' H: `  F! |6 FThere could be hundreds of BPX you could use to detect this trick., f* S5 d$ Q3 m3 V/ m" ?
-The most classical one is:' }! y6 n- H3 f9 j& q0 ^3 {
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||9 N" Z4 T% }' u  S: y$ h8 j
    *(esp-&gt;4+4)=='NTIC'! G. _9 C" |; T" p

3 _! y5 n1 [5 g: a' |( Q$ }-The most exotic ones (could be very slooooow :-(7 F/ u( Q; {9 n+ o5 [+ {
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
! W: x. q, ^( s9 f  K     ;will break 3 times :-(
" s! r( u: q  a) H
8 k, w4 ]& T0 p$ I" l-or (a bit) faster:
, k& J1 r) k7 `' u# g   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
9 m1 k7 Y) |3 N' m* ?* z& z, J# `  g* ^
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
0 @& w  ^0 S7 T# H5 s6 _% q, }     ;will break 3 times :-(
+ }9 W; d1 A: |, I% x: s# M% \) X  g& P1 H0 n& g; M
-Much faster:; N( a) E/ L4 N
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'  V# r) e) z: V: R+ ~% H& N- h8 R0 T, J

9 k; j6 b. c) HNote also that some programs (like AZPR3.00) use de old 16-bit _lopen
  w% m+ L  z9 Q$ B0 V9 tfunction to do the same job:
" r8 o; C+ L3 j! e8 |# @* z5 |' e6 S+ Z
   push    00                        ; OF_READ$ [& ?, b6 |, P# j" v3 B
   mov     eax,[00656634]            ; '\\.\SICE',0
0 x& B3 ~! O: q6 k" @   push    eax: }: H- V2 C- I; ]5 W! o9 @$ q0 z
   call    KERNEL32!_lopen0 Y& P6 m) H# T7 L5 U* h3 X
   inc     eax
; t% L7 D/ N5 h6 _" W; w; W   jnz     00650589                  ; detected
' c+ N- Q: t- r  W   push    00                        ; OF_READ
0 ?% d- M+ f5 i   mov     eax,[00656638]            ; '\\.\SICE'
2 o: r  P3 Q, G: _+ x$ ~1 I   push    eax, z0 R$ @" o6 i" t
   call    KERNEL32!_lopen
9 P: z. @' j6 d3 P( r& `   inc     eax
( p- M( v  R+ a; m* S5 W   jz      006505ae                  ; not detected
* a' O$ [. `, S" \; W# {, Z1 s0 A0 b

  Y$ T( L0 i- n9 _1 G__________________________________________________________________________
3 _3 b- P- i0 t& u5 n! s
2 L9 f* b" W3 ~/ kMethod 12
) N# S" i3 l9 f=========
4 E- d9 z% A3 a3 I! U  E  a$ N$ W# M" u
This trick is similar to int41h/4fh Debugger installation check (code 052 T- s3 a8 d8 V# B( @
&amp; 06) but very limited because it's only available for Win95/98 (not NT)
5 u7 b2 g4 N  D" h# q  tas it uses the VxDCall backdoor. This detection was found in Bleem Demo.! S" a) V& Y7 w" g

8 _1 X" r7 }+ ?4 M4 t   push  0000004fh         ; function 4fh
* ^+ e4 e8 {/ M! A7 E  X' ^' |   push  002a002ah         ; high word specifies which VxD (VWIN32)
$ Y8 S: `/ P. a4 E. S3 v% x                           ; low word specifies which service
, Q" o, u9 r' d- b# L# p! r                             (VWIN32_Int41Dispatch)' ?+ w6 n3 a  y* D  o" m$ B
   call  Kernel32!ORD_001  ; VxdCall
" [! a1 H' ~, W$ A* M   cmp   ax, 0f386h        ; magic number returned by system debuggers2 x, o$ @9 X  \: [2 @* I" k$ p
   jz    SoftICE_detected2 K4 H, J, _* G2 u

  H$ p$ Y, ^# G) ^) d# lHere again, several ways to detect it:6 h6 s) ^! u' r& M4 h4 i9 d

, n+ [. t+ E" i    BPINT 41 if ax==4f$ v- G9 k) C" e! |. ^5 j& x# M

) @7 d3 A* a7 |5 l" \    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one6 M- B& D& I7 S. r  N

  Y1 \9 H0 a0 l, _4 a' m3 p    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A; k; B/ J+ B7 k: B/ u" |5 b/ G% i6 L

5 a2 }+ N. a! D* x2 U# Q! i1 l5 S* c    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
- m3 }4 ~5 T& Y  ?3 Y) l& r7 D, Q4 `* D: V  u3 O+ `
__________________________________________________________________________* c3 V' G. f& ?0 p/ y' |
. m: ]  I& T; R
Method 130 K4 @# T& _& `! p# m
=========, G( l( ?& V7 a9 M
& d1 V4 s& `/ N* S- u( y' M7 ~8 p
Not a real method of detection, but a good way to know if SoftICE is% A5 w% C3 v. S
installed on a computer and to locate its installation directory.1 y' @, h# Y9 Z, G1 }6 C5 f
It is used by few softs which access the following registry keys (usually #2) :
8 i8 e  b  J+ w2 t" h4 ]. [* m5 h1 i; K% \& P: Q$ J% F4 c
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion3 Q9 a. R2 A) U
\Uninstall\SoftICE# H2 s0 D% i- z# |, w  d
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE1 [. V% y; M$ m4 y
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion& I6 f8 ]/ q" {6 b  w* Y$ l7 l8 C
\App Paths\Loader32.Exe/ ]0 \' o/ N5 g3 M; }8 A% c' }
: B5 U+ V& E) M1 D* Y3 W/ y

: ]  J6 g: k% BNote that some nasty apps could then erase all files from SoftICE directory% k7 Q1 p! a( j0 O' p" b0 K
(I faced that once :-(
$ J2 ?! I% H) A( v2 |# Y
! b. F$ K1 G1 X) A/ MUseful breakpoint to detect it:
  v  W. z$ t: V3 Y9 w  g. Y' o
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'3 ]- r) l6 p' S. i. z

& D3 R2 f" U( N' V__________________________________________________________________________9 s2 A) n) ?- C3 a, D  e

$ `6 i. a/ h7 q" O) c# ^2 M
; y- W% J- n' W1 `, u; JMethod 14
  V2 k/ O+ Y' j! ^' y" s: C=========
/ D' M6 c- l1 C: z% V. s( k
+ D, m# }! Q  B% f  H* U- qA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
5 H" R% Z. ?) X! d& `5 a; ?/ o% sis to determines whether a debugger is running on your system (ring0 only).
7 z& v- ~, d' T' ]; O$ d9 u) d; I# I: @% a. a, n
   VMMCall Test_Debug_Installed( w1 l; p, M2 k
   je      not_installed# i; w# E/ ^& J- ^% ~& E7 [
- n4 @  [" ~. v9 w) n' l
This service just checks a flag.6 Z) \( X; ?' X8 e% o; f/ N
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2026-8-19 08:10

Powered by Discuz! X5.0

© 2001-2026 Discuz! Team.

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