About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>9 U* G( Y$ T$ H' a/ a
<TBODY>, R& S& B3 ?" o0 s- b- y
<TR>
' d3 g/ F  M; [5 n5 S; w: M0 B<TD><PRE>Method 01 * y$ U+ y3 O8 \7 m
=========
% O$ c+ W- K! V% A/ e( k, @; _& X- y/ V9 O# @
This method of detection of SoftICE (as well as the following one) is) F' [$ D; r* c1 ]3 f& `
used by the majority of packers/encryptors found on Internet.
+ T: @* ?- x4 ?  yIt seeks the signature of BoundsChecker in SoftICE6 j& @7 t3 y6 j
& K& \6 I+ [. |" Q9 i, X
    mov     ebp, 04243484Bh        ; 'BCHK'3 Q+ s$ e' [& C; Y  d
    mov     ax, 04h
/ v" `2 e5 T  G    int     3      
9 T6 z3 Z+ X, r* [    cmp     al,4
' D+ g$ P  Z7 {4 F. ]    jnz     SoftICE_Detected. l) R, m% W5 ^- T5 @* d; {0 u

. N. `8 W2 y0 u___________________________________________________________________________8 o. O" Y7 |+ e
3 @' e6 H$ f2 Y- _
Method 02
/ \6 I3 w* j, F3 H=========! L! D1 T5 C* Q9 ^& W1 H$ a1 f
7 e  |; B; p" E# {, ]' O
Still a method very much used (perhaps the most frequent one).  It is used
, K5 v1 g4 D" i3 ~/ X6 `2 b/ M( lto get SoftICE 'Back Door commands' which gives infos on Breakpoints,
2 t1 l1 P" P6 for execute SoftICE commands...# b! `7 X4 [  g0 ]" ~8 r
It is also used to crash SoftICE and to force it to execute any commands$ z$ d5 Z& |# V% S1 _: l# P, E
(HBOOT...) :-((  ) j% Y- m6 C' X. D
: y6 Z  f# v1 l7 g- x& d- ]
Here is a quick description:
8 [* Z7 h* V7 N; q7 M-AX = 0910h   (Display string in SIce windows)
  k) s0 j& [4 H; M5 T# L% ], Q5 q2 Q-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
) Y% U3 b' g. S, Y1 G- X% F7 B-AX = 0912h   (Get breakpoint infos)1 M" l- U8 }: z5 p
-AX = 0913h   (Set Sice breakpoints)
& t# b% }" g: ~, ?0 Q-AX = 0914h   (Remove SIce breakoints)
" v7 M- Q3 v5 ^% o3 J# n' w" L3 z# N' _
Each time you'll meet this trick, you'll see:
0 {1 f! ^, K- ~3 T, u. V- G, Z8 E  w-SI = 4647h( W6 _) m0 T- L) O
-DI = 4A4Dh* c$ a" N" r7 Q$ b! O. q9 o
Which are the 'magic values' used by SoftIce.
/ [* R  ?' m4 @For more informations, see "Ralf Brown Interrupt list" chapter int 03h.
0 @; g- Z  B* n& T; e# p8 w  ]9 J0 ]7 ~% [+ j1 h
Here is one example from the file "Haspinst.exe" which is the dongle HASP
: Z$ J' n' w! x/ J/ s. ~Envelope utility use to protect DOS applications:5 M, w3 ^1 P0 |( ^/ T" v( n

  v& v( O9 ~6 y5 K, g
9 ]- Y4 o4 a' j  e# s4C19:0095   MOV    AX,0911  ; execute command.( L/ M& G6 f/ X- _* X- R
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
2 D+ w  ~3 m# e( ?! R. s# ?4C19:009A   MOV    SI,4647  ; 1st magic value.
* r' w$ z! b  M6 _5 H5 a4C19:009D   MOV    DI,4A4D  ; 2nd magic value.9 \) Y; K( E) {
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*): E' a8 x  k  @/ Q( a' q
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
* E% n; f1 [1 ~+ Z& p4C19:00A4   INC    CX( h- A7 n( J, |* D& M6 O5 O% m
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute$ e; K: w5 _' h5 |/ C! R9 E( \; a/ W
4C19:00A8   JB     0095     ; 6 different commands.9 w1 P8 |4 Z7 ?. p
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.; R' Q9 \/ K7 N& }
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)5 k1 _8 @" @0 V/ z. e1 F- M

2 P* A0 }; C! R0 n) WThe program will execute 6 different SIce commands located at ds:dx, which
. T$ x% e3 w/ L" D4 V( Bare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
0 ?6 q& ?( z' v4 T0 f, H% K/ p: ]+ ~2 a0 Z
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
+ d& H) X' u! j! @- s___________________________________________________________________________
/ D: t, N! N. B: }# X
2 O0 ~' i8 U/ ]
+ y& ?2 Q& F: P! \; y* H2 kMethod 03
6 }2 m0 B/ f! {& _- _1 a" T=========
  W5 O% U, h' U! I
) i' [1 v  d& A0 n. bLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
1 F' D$ h3 Y4 s; W* m4 P/ T! N(API Get entry point)6 Y" V* f; b4 O. `
        & @6 o' I7 h; ^0 K( M

7 S& B( |0 d; R  ~" k4 ^    xor     di,di
" a9 _. G8 N, o$ [, ], J/ ?3 E0 ]    mov     es,di
, `* A( E1 g8 n    mov     ax, 1684h      
7 o: r6 K2 R8 H- @    mov     bx, 0202h       ; VxD ID of winice7 e* [& I' w7 @( _( @
    int     2Fh
- N3 G4 K8 W7 u; {; p9 {, b. B    mov     ax, es          ; ES:DI -&gt; VxD API entry point
* \1 C+ w% |5 g" Q; _' ^* X" M% R1 |    add     ax, di
$ f% l- H* m8 @4 ~3 p* [9 m: }    test    ax,ax! ~* M: |/ o' @" r
    jnz     SoftICE_Detected
0 P* B. Y6 d: |
1 h3 z& a) u( }0 A$ X8 }9 }___________________________________________________________________________
* r5 W. C- g; D- Y( H* V- D0 A
5 O$ l* l# G, i% S7 i+ XMethod 04
2 I' }6 j, s# }& A4 g( k1 ~! r5 w=========
" ^- v2 K2 E6 T* y5 L1 L! r8 j
2 p  t. Z% b( V" r6 sMethod identical to the preceding one except that it seeks the ID of SoftICE
0 T! z& \+ y7 x5 ?GFX VxD.! F9 W7 f, y8 G' S: r

  E  v3 s7 p4 T% a8 c    xor     di,di$ f! V# k1 k, x! `# ~5 J6 C
    mov     es,di$ j2 s+ h( W# f1 |$ E; M- `: h3 h
    mov     ax, 1684h      
7 f9 C* Z/ `0 @4 H    mov     bx, 7a5Fh       ; VxD ID of SIWVID
% C7 T$ y. _. s' _4 U1 Y! @  M  C) n    int     2fh" t+ Z6 P" q- A! W8 T5 a' x; a5 H
    mov     ax, es          ; ES:DI -&gt; VxD API entry point+ l. B: _' y1 F: t4 g. Q
    add     ax, di9 c# m1 X/ O' C
    test    ax,ax
! R% ?8 `. @9 L' {    jnz     SoftICE_Detected
! a* l, X) z# P6 c3 L5 R$ C; L+ S1 k1 W/ T
__________________________________________________________________________) U5 G# j- U. Z/ @

) c  O) J+ G* W( K7 Z( S* V' q3 S4 u! H) p- K
Method 05* e& v$ J' @2 M6 O6 z; X; X1 P+ {
=========
1 s; Q/ B% Z. Y* Q. z' I: f6 M- G. c" k; h
Method seeking the 'magic number' 0F386h returned (in ax) by all system
" J" a7 I: J* H- W+ cdebugger. It calls the int 41h, function 4Fh.5 c0 i. t; \8 B
There are several alternatives.  9 ^* a' ~) i  d! e3 m

4 h( w: l- @# z+ n' GThe following one is the simplest:  I5 F, D3 b* `! u' g) q* X2 k5 ^
$ r' f- q# h7 `( g
    mov     ax,4fh
( j* l! ^7 }0 Z$ J- H+ y8 `    int     41h
1 a: r" T, O7 }' f0 q' Y2 g    cmp     ax, 0F386
+ g/ e8 }0 z3 }# K5 C    jz      SoftICE_detected
2 ?+ U1 Z$ R, I- s. O; @0 E9 |/ T8 y) I5 P

; k) j, ?9 n2 G9 |Next method as well as the following one are 2 examples from Stone's ) ^' _% o9 C7 R9 |! |$ R6 g
"stn-wid.zip" (www.cracking.net):
3 C- Q, }0 }5 X- l' I' S  V( \  r- A7 [* g+ I5 \: y
    mov     bx, cs1 P; P4 b8 Y) o) u2 [7 f
    lea     dx, int41handler2
+ `9 G: M% V: w0 V& V3 R$ a    xchg    dx, es:[41h*4]
$ F2 t0 p* s1 h    xchg    bx, es:[41h*4+2]1 B8 s9 g# k, x! T( L* B% ]! ~
    mov     ax,4fh% V" ~- L. y/ ]
    int     41h& U9 K/ T* S; l- C9 T) G
    xchg    dx, es:[41h*4]$ B2 ^8 O4 h4 c+ ?; f( [& G
    xchg    bx, es:[41h*4+2]
+ ]6 N- d5 w7 }2 s    cmp     ax, 0f386h
- x# w9 f5 o/ f3 {6 I    jz      SoftICE_detected
0 x/ j' z' H" q9 f% k. Y+ G0 P: d9 m6 Z
' s$ b* N" s$ N5 {1 yint41handler2 PROC
, r5 z- @/ A, H3 H7 o    iret# t9 w3 ^- t; n0 g* P1 z
int41handler2 ENDP
( r5 r2 m6 k! O* q7 O6 S% z2 [% }

  e$ O5 a; Y8 a8 K3 ?  o. l* Z_________________________________________________________________________# v0 U' q: e1 J5 o) M
& ]# d7 u6 E5 w0 E( M" x- }

" Q% h; Q9 v& e# c: b" EMethod 06
! c5 O) s7 u" x' R/ I' v5 u=========+ c, V8 e: }: a6 K  ~
) I$ A% q$ O& E' P7 F7 `7 k, j( m& c

3 p( H. \! G: j' t* R0 O2nd method similar to the preceding one but more difficult to detect:
0 F0 i9 O" k% K; y0 v0 X1 [/ H- {- u8 M# T! @  }# {7 B+ R

% \3 O) a" x( t$ R4 l9 wint41handler PROC- J/ c1 M7 ?4 P# u: y  _% w6 C
    mov     cl,al
: U/ ]* I" s) B; T* m    iret
/ ^$ B3 G( e4 t1 m+ Qint41handler ENDP
% _5 Y+ u# A: N. i9 ]' F+ ]" G  {) _, I( ~# N% \$ z6 R' C
9 z9 \/ I4 A" D" t. T8 A
    xor     ax,ax# e9 X, _3 x2 p9 h2 L; E. Q% s
    mov     es,ax. H% y" [0 G5 q3 w- V# T
    mov     bx, cs6 j4 |) f+ [0 {/ m& T) H
    lea     dx, int41handler4 ^8 r" ^2 u( I( n0 I, E) s
    xchg    dx, es:[41h*4]
3 d7 H6 g, X8 S% m" W    xchg    bx, es:[41h*4+2]+ B: `9 p3 `6 {
    in      al, 40h
$ M, k0 H: G3 O5 `" k    xor     cx,cx
: O* M. J! `; C7 h. g    int     41h( Z8 S6 |: x- n$ ]  d
    xchg    dx, es:[41h*4]0 I( {, T7 t5 O1 t  L3 _1 M7 _
    xchg    bx, es:[41h*4+2]! x1 X4 s* Z& v9 k7 S8 s0 c9 f8 U
    cmp     cl,al0 K: b  i4 [9 E
    jnz     SoftICE_detected* l3 X" f8 ~5 l3 r6 V

- k" V% n0 e, @6 m" i! l_________________________________________________________________________
9 G  \! J, B0 w: i8 u8 E% l7 u! D% s, o' n
Method 077 L* d* u, ?0 C# N- W5 k) D
=========, M: t7 \: D3 s" H/ E" M
0 A7 ^0 ?) R1 o8 W
Method of detection of the WinICE handler in the int68h (V86)
- n+ y9 r6 \/ j2 C) p0 I* V) u
0 n  s, t  N, n0 I/ `# g    mov     ah,43h  O# ^& U0 w6 R, P3 w
    int     68h
0 s# K3 n& b9 V7 H    cmp     ax,0F386h
1 U; m! W. r5 Z  W: J    jz      SoftICE_Detected% h# Q* [* R5 X- ~# M
* `; o: n  C7 U  {& ?6 {
8 m  C% G4 z" o* W- F$ Q* ]" k
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit! W3 B4 ?0 L) n  K' ~4 Q5 s
   app like this:
8 |! I+ Q1 ~  G' m6 ^
( U# G- T9 [* H, \) r. _   BPX exec_int if ax==68
) g' L6 T! s" q% K/ \, a   (function called is located at byte ptr [ebp+1Dh] and client eip is
) O. N9 Y, s: q  s- i& R0 P+ d   located at [ebp+48h] for 32Bit apps)) v) ~: n7 p8 z. I! O' z* G
__________________________________________________________________________% `8 x1 n. Q8 u: o6 J: z

% H$ J1 j+ O- C) U, A6 c- b0 B7 y: V0 Z
Method 08+ N+ q" x6 a8 p1 \; E5 h7 {+ s
=========
: q6 b4 Y* E. j* J3 c
: I* R' k" Q$ zIt is not a method of detection of SoftICE but a possibility to crash the
' j  o  r$ Y& k" f" e* s9 wsystem by intercepting int 01h and int 03h and redirecting them to another: c+ J$ s6 h6 V9 ^8 t. d. p8 s; D
routine.3 e7 a9 K, a% F- ^! K" b# U8 Y
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
# f0 \* _1 H/ c. w$ Y! c" T+ Xto the new routine to execute (hangs computer...)4 B$ y& K$ {/ v6 d7 Q/ b

0 h: [4 ~( H3 T' n# m5 S    mov     ah, 25h3 e+ y  K+ m  l; ^& ~
    mov     al, Int_Number (01h or 03h)& T' r$ e0 c- v2 Q
    mov     dx, offset New_Int_Routine7 i' [7 r, W3 X+ Q. `
    int     21h
, _4 B* F. {+ V: w
7 T# o  B3 X& Z# [' U__________________________________________________________________________
4 O0 p0 p+ I( J* `
' W& s$ z; O) L4 J' U& ^( \  AMethod 096 W, _  d. p( ]+ `& D& _& V3 g; i
=========7 T2 Z0 Q! l- j& |
! c4 A5 q4 y; S+ i) q! D
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only* Y5 X0 J( k( H( D+ ^; k6 u
performed in ring0 (VxD or a ring3 app using the VxdCall).
  U: k7 a; r3 j' Q4 `$ ~The Get_DDB service is used to determine whether or not a VxD is installed  Z( {- b. g  H2 p  Z  m
for the specified device and returns a Device Description Block (in ecx) for' q  e- k! J* r/ K
that device if it is installed.
$ s% D$ |: G* w( K8 s% K  `7 V; |/ c& |% w8 ?6 l/ T
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID9 {" `/ H9 I1 G! |5 A9 I) l
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)" ^7 X5 {' Z* I+ j
   VMMCall Get_DDB, @' D' \6 `2 |& V+ ^! F% o
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
- z8 c; T7 J+ s- z, {$ V; v
1 {0 n( w6 {1 {4 ?0 ?( r) @( J* o2 E: rNote as well that you can easily detect this method with SoftICE:
9 h; ?1 c4 Q5 W7 a' t- s   bpx Get_DDB if ax==0202 || ax==7a5fh
, Y( Q% i2 C8 k0 a1 O( P  D& U0 f6 L2 `# ^4 o3 Z8 P9 g
__________________________________________________________________________' L! Y( ~+ l% r0 ~2 Z$ d
8 i3 e6 f8 g$ L9 Q' i, _4 X: J% R
Method 10( S# J2 R8 q$ _0 u
=========
: C: X) g; {) m: K+ ]- w- G+ P5 `/ H. }; q6 z0 x0 `
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
2 o& \5 w: Q+ a  SoftICE while the option is enable!!; m/ H7 K# j1 ^  m$ r( R
6 D+ d7 M! |( Z7 h) N, P3 D3 H' Q
This trick is very efficient:
$ K5 B6 ^, v; Iby checking the Debug Registers, you can detect if SoftICE is loaded* Z5 @- [, n8 B$ `5 ~; C
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
5 n( u' B+ H2 V0 t" a' t3 C- qthere are some memory breakpoints set (dr0 to dr3) simply by reading their
& ?9 O* y' V7 t* C  r# Xvalue (in ring0 only). Values can be manipulated and or changed as well! `$ P/ s" ^" M: w5 u, D; O
(clearing BPMs for instance)1 u) T% Y; e3 G7 G3 j/ G2 \
$ Y' \: X, T2 g0 K7 n) p7 d
__________________________________________________________________________
) A& v' ?7 G& j8 E+ T, J; h" Q# g9 A. S3 ?- b
Method 11
! H, W/ c/ k/ t=========
" q# [) j( Z" o4 B0 T
5 B% n* k+ K' y% |# OThis method is most known as 'MeltICE' because it has been freely distributed
' G# @! S8 B# y4 g( P3 _& avia www.winfiles.com. However it was first used by NuMega people to allow+ h; K: ]2 ~' y* ]; f
Symbol Loader to check if SoftICE was active or not (the code is located
6 U  r/ _  \0 Winside nmtrans.dll).
6 i" C( a" ~5 n7 A2 o
( ~2 N2 s$ M2 hThe way it works is very simple:* _9 A* h" U6 L  @0 n! U7 M& ~' A" V
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for- F6 M- a( `* V  M
WinNT) with the CreateFileA API.
( O* Y1 a/ G5 B  [0 W; E# P  F) y" H: R4 k8 }$ q( r9 N
Here is a sample (checking for 'SICE'):! ^: v, c, @' m

' ]" H' g, ^/ H, BBOOL IsSoftIce95Loaded()4 L/ j% h) u) V- @; ^8 Y; w
{0 s! ~5 C, V+ P
   HANDLE hFile;  
! o& N2 z1 V1 t  w( a: I   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,7 n  `/ S  }1 L& D, s
                      FILE_SHARE_READ | FILE_SHARE_WRITE,
1 i& C3 r+ V, v0 o4 O  q                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);- N6 o9 V- l5 s$ s& P% K
   if( hFile != INVALID_HANDLE_VALUE )+ \: N3 i; O1 A: I: T% a; ?8 [
   {
0 d& c9 H/ h/ l" j      CloseHandle(hFile);
+ e6 _" |( U3 L8 |; D1 ?      return TRUE;
8 p$ t1 \. T1 x9 ]# U   }2 @# \$ d' Y- {6 O# S$ R
   return FALSE;
6 c& q3 n, L* \& b* O5 f" Y}- x0 U3 r2 o. W" |

4 J8 l$ u: r9 \6 QAlthough this trick calls the CreateFileA function, don't even expect to be
9 h) U, e! T/ i+ `able to intercept it by installing a IFS hook: it will not work, no way!# e" ^3 U( v2 I0 ~3 h* q
In fact, after the call to CreateFileA it will get through VWIN32 0x001F
1 M/ U; I! R: e2 w' x  vservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)4 S9 t: G+ i( Q3 Y7 p3 H/ p
and then browse the DDB list until it find the VxD and its DDB_Control_Proc
7 b) i" Q; [' Z+ j; n: Qfield.
* W, v' H0 O! G, N- zIn fact, its purpose is not to load/unload VxDs but only to send a
$ w3 i# I/ V& Y1 n8 r9 G0 m5 DW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)% x5 Q* k3 q" W8 R4 f' _
to the VxD Control_Dispatch proc (how the hell a shareware soft could try8 i5 `, J+ L* `+ G7 X2 |8 O6 g
to load/unload a non-dynamically loadable driver such as SoftICE ;-).
9 k" A3 ?" C9 ]5 O+ L# UIf the VxD is loaded, it will always clear eax and the Carry flag to allow
6 y/ b$ V$ c* _8 Hits handle to be opened and then, will be detected.
% x* Y& K9 Q4 F5 @! Y, `% T& SYou can check that simply by hooking Winice.exe control proc entry point
& H- i4 C5 b9 V+ wwhile running MeltICE.
# M7 }+ ?: l+ |2 c" h6 L" v- g  @' O% _3 K' o; U

) D7 B7 f5 K6 g9 v8 y. c3 T  00401067:  push      00402025    ; \\.\SICE
# h- W8 i2 r, {4 g# O4 ^0 `  0040106C:  call      CreateFileA
% H" F1 R3 C' s( j9 g  00401071:  cmp       eax,-001+ S6 \, X$ [- ]# U
  00401074:  je        00401091
* {# C& L9 L. w# b. a
& ?4 y: F, Q5 x* K8 a& K+ K8 `* ]
There could be hundreds of BPX you could use to detect this trick.' ~  n) O- |! R6 `8 R2 G" k
-The most classical one is:& e& i4 Y& Y; _' n% T/ d9 x
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||, x) Y4 L9 U1 t
    *(esp-&gt;4+4)=='NTIC'
3 V' I" L1 L, R+ v- t# C
+ x6 |4 D$ s/ N  y" S% H& D% i-The most exotic ones (could be very slooooow :-(
9 F8 \+ A. y4 U1 m   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  : Z2 O3 \8 s% J" m* s  o
     ;will break 3 times :-(
1 R  f  u, u1 Q/ D. k( o1 D8 i9 y1 e3 I7 A# j" Q
-or (a bit) faster: 8 n. t; O( Y4 P; }' [- h- F, {% i
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
. I  {& ^, I4 @6 ~: p; Z1 p# y& G  n4 Z6 @- S
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
# j) k' N" G1 M. `# ?     ;will break 3 times :-(
: r5 z3 O/ {; j/ W" X  u! w: p, g9 @) r2 G% e! i. T
-Much faster:. M; L. n0 ^( Q( g
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'1 F3 [6 i  o% b( @6 ~) F( T7 @  y

, s1 i' K' ~, L1 w4 p, [2 ~Note also that some programs (like AZPR3.00) use de old 16-bit _lopen5 m+ O3 l6 R$ V( Y4 `# |
function to do the same job:
9 i' Z" Y) {6 ~( H$ C
  b9 D1 f' U6 t4 A% n! z0 K1 |   push    00                        ; OF_READ& F4 [9 N3 T$ {
   mov     eax,[00656634]            ; '\\.\SICE',0
# `( Z6 F( u9 A' t   push    eax
. e' {/ n( u. D   call    KERNEL32!_lopen1 i' m% z5 z. h# ~' F% O3 B0 c3 y: R
   inc     eax
$ p7 A9 l6 S! |0 [$ ~6 X  m   jnz     00650589                  ; detected5 x- j8 S- @; m
   push    00                        ; OF_READ
8 {0 j: q7 A) N   mov     eax,[00656638]            ; '\\.\SICE'
+ g8 M0 Q9 u, Y+ K2 y   push    eax# X6 a9 m1 C* b6 x6 E! o' R! h3 Q
   call    KERNEL32!_lopen3 O. X6 ~4 R0 F7 W7 }9 {
   inc     eax. p: k0 O6 v* n7 v7 ~2 j
   jz      006505ae                  ; not detected. a# [+ g! B# S, r9 O
6 W7 T1 o& U1 E, E( P. n8 i

5 \2 o0 a6 H3 }5 m+ ^8 b__________________________________________________________________________4 L6 Q) a; s7 h0 e2 n8 T' q* s$ a
" H- i2 f) Y5 T0 ?% J
Method 12
: s# Q2 U4 N& d  a, z7 ^=========# x: ~, C) }0 s
# G( x1 N7 X+ }0 E
This trick is similar to int41h/4fh Debugger installation check (code 05& g# ~6 a9 f2 m7 M9 ~# b' K+ Y
&amp; 06) but very limited because it's only available for Win95/98 (not NT)2 I( i# [% n$ E0 G
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.
8 ]2 W9 r$ K( u7 `( z
4 x) j1 k& K( w" U& V0 M   push  0000004fh         ; function 4fh
& {, `4 l0 X5 s2 R& ]& n' w, W' I0 O   push  002a002ah         ; high word specifies which VxD (VWIN32)2 i/ g: ]( Z. N3 j6 w/ g. C' x
                           ; low word specifies which service
  i% }4 s5 I0 A/ }' j! v; B( c                             (VWIN32_Int41Dispatch)
. I2 X& `' e2 {7 {. K   call  Kernel32!ORD_001  ; VxdCall
/ a, Z& x! U  e   cmp   ax, 0f386h        ; magic number returned by system debuggers
- Q' m5 \3 t; J5 H/ l6 X: J   jz    SoftICE_detected/ S* z# t" _/ ?5 ^
2 N9 `, a# H: o7 M, Z
Here again, several ways to detect it:
( n: [# \3 T3 U& e! Q6 M' i/ j: }* |+ k0 s* \7 g! r
    BPINT 41 if ax==4f: |- \. }2 C6 b# S  j& B" t' A

- F7 Z- q9 i! m2 E' c    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
; V3 N, P3 j9 P( ]$ b$ m
+ b; C2 ?- i& ~; B) @% \# V    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A4 P& p* e' q3 Q' H# q

- w3 {$ m1 i% k- Z" I& F    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
* h. ^' `: U9 [9 b8 G' h' U6 @) }& q- ^( y( R. E/ A7 h
__________________________________________________________________________( z) u& H9 T  a* d  _
0 A# Q8 O/ I8 C& `) E% y
Method 136 ]8 V( C4 _9 X) i* c$ g1 m9 k
=========" M, m% s8 t9 E# b4 g6 E/ e
4 Y: N; R; k9 i& B6 n% {( g
Not a real method of detection, but a good way to know if SoftICE is9 E/ s1 @. a) h1 U3 o
installed on a computer and to locate its installation directory.
. q& f$ h# e' ]0 p6 z' pIt is used by few softs which access the following registry keys (usually #2) :
5 o* ?; O8 H7 ~1 k, C1 K3 r# ~6 j9 O  h& T  k3 E
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion) [- k0 r2 B( N8 d/ E$ ]9 Q
\Uninstall\SoftICE
8 O/ W1 y) [* W; |$ l-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE- }, R0 N  u% C/ A4 x
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
( n2 Y- u4 J; J7 ]: M4 k, v4 M% t- U/ u\App Paths\Loader32.Exe
7 k* S: L' r5 i2 E2 d- m
/ m+ z/ z0 [' z0 x- E0 `, Y4 J
3 V3 n2 c+ A' HNote that some nasty apps could then erase all files from SoftICE directory" ~" i. W0 N" s2 b
(I faced that once :-(- X: l( \+ ?0 c4 q4 @, |9 M, ]

) t& [' }1 F, L- mUseful breakpoint to detect it:
$ {9 @; {  B' s0 ]
2 Y! U5 a$ i' Q1 j( V     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'! }$ K+ I! x3 R6 `/ u4 I

6 U. z" |+ V+ r# L__________________________________________________________________________' T+ r2 L, V( @* n" i
% _5 i7 M! ^  Y7 z  O  l9 P2 x
/ E" M3 n2 o% c# h" F# ~) f
Method 14 # s  Z- L  E6 e1 I; u
=========. k/ G- U3 A( d4 e

! r9 ~0 e- f% t& V9 s) zA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
$ h* v; O/ ?! t, a) \is to determines whether a debugger is running on your system (ring0 only).8 }1 X' \6 j. x+ _. Z3 S" H
! \5 g( b. s6 ^4 f; v' {' c
   VMMCall Test_Debug_Installed
/ l% k7 {6 K/ ]' R+ K- j, N   je      not_installed9 T2 P$ G' a$ K3 V! L

* Y$ ?- s" G6 S# @- ^This service just checks a flag.# n9 C' Y2 ?  M& F8 Z& i' U, o" e
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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