About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>4 Z' K8 O% T$ v& _+ _6 R+ d3 i
<TBODY>
6 ?* d; G9 F4 J/ N' r* v<TR>
. t5 \. O5 s3 g" D* x5 b<TD><PRE>Method 01 2 ^* o: f9 o1 i5 d3 |
=========
# K, g9 L: X% P
' A* p2 X9 G6 X# Q% pThis method of detection of SoftICE (as well as the following one) is
! ]4 C: A3 L2 O8 k$ y, t4 gused by the majority of packers/encryptors found on Internet.% y7 S/ Y; g, O$ ]: G
It seeks the signature of BoundsChecker in SoftICE! P; w. G  P4 H. U/ d; X
6 n3 W- P' a: Y5 `
    mov     ebp, 04243484Bh        ; 'BCHK'! M+ U% }# ?% l  d  o' T8 K+ X
    mov     ax, 04h' F8 _0 L  a0 y# l
    int     3       " |! n. U0 s$ R
    cmp     al,47 F2 m, {6 y/ |
    jnz     SoftICE_Detected
7 P/ @0 `, g7 h8 i$ @' q
# z# f5 S' F0 c' `8 d___________________________________________________________________________0 ?- M" U4 k/ k) G
) |) m% v" _0 X8 _7 O& \) ^6 ~
Method 02* q& x5 q0 m/ H' I
=========+ {6 j3 v9 N6 H- o! Q- _
9 M& S9 }0 i1 J& }9 S; Q3 m8 S
Still a method very much used (perhaps the most frequent one).  It is used
% }- l6 n' y& m; D* ^+ Yto get SoftICE 'Back Door commands' which gives infos on Breakpoints,
& I) _. }9 H- c& U, Zor execute SoftICE commands...$ T! }- p8 ^: l& B2 y
It is also used to crash SoftICE and to force it to execute any commands
; \6 [1 S1 C7 U6 e  b. W3 y(HBOOT...) :-((  
9 l# {$ p( _* Y! K% r: m5 b+ R2 K' N/ y' N
Here is a quick description:0 w+ T5 y! d7 [: {% ?  c$ \
-AX = 0910h   (Display string in SIce windows)
; o+ F) G0 ~/ o$ w-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
+ {+ z6 ^" h' F+ x8 r( n-AX = 0912h   (Get breakpoint infos)3 @6 G0 x( \  P' o; x) g0 I
-AX = 0913h   (Set Sice breakpoints)
* P$ M  ^/ }1 |3 i% I-AX = 0914h   (Remove SIce breakoints)
: V+ x( C& W9 h2 |$ ~
' ?% G6 a$ Y; }, P2 h. X3 fEach time you'll meet this trick, you'll see:
: t, i/ L) f( f) G) m; }' y5 z( s5 ]-SI = 4647h
' Y+ V$ z% c2 ]+ v/ l# a/ _-DI = 4A4Dh# s5 Z; G! k/ j9 P
Which are the 'magic values' used by SoftIce.5 v% `$ V5 Q1 A4 F/ \' H/ H+ \4 F
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.
9 D- N) o# A, ]
+ @: |, U, z5 N; wHere is one example from the file "Haspinst.exe" which is the dongle HASP
  s$ K* z3 M2 S" D- iEnvelope utility use to protect DOS applications:
* F' v( ^0 ]4 J% ^0 H* Q: Y5 u/ W) S
+ u- G/ }* j1 [* f9 P4 [7 P7 u' j
4C19:0095   MOV    AX,0911  ; execute command.
, s' R' ~! f! k& {4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
4 \  g, D8 |) @9 I4C19:009A   MOV    SI,4647  ; 1st magic value.3 k) T0 n: u/ E  q2 S
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.: A5 ?. e! m& W0 g0 C4 @% \
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
9 D: A! a. o/ a* M; w8 z4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
7 f  D5 F6 O' T( L( }$ a; a4C19:00A4   INC    CX
. U7 X# J9 M; J% G4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
7 _% A; I4 L) K% c4C19:00A8   JB     0095     ; 6 different commands.2 n6 D- M7 {) y$ `  k4 h3 s
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.2 R6 p- o0 W8 f3 D4 j
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
- o2 A/ N) Q* z- s4 t6 f
: V$ B' R3 z, RThe program will execute 6 different SIce commands located at ds:dx, which
0 E" W" |% z' xare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
# G- @0 f$ t( V# E( `7 E$ \  b( h1 @8 O
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
3 r3 c- B$ d, Y. A- e___________________________________________________________________________, u* r* ]. ^7 Q8 h
: R% {8 F! [: H
8 F6 z/ G2 @, t& w$ j5 C0 ]
Method 03
, ~3 y! a6 \  z6 L! V8 W; j$ H=========
- z4 g( q7 t3 u8 {5 b, [) u' I& W+ S1 J4 h; D0 @0 a2 Z- Q3 {
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
1 g+ A' ]* m. w" y" `6 n# ?; N(API Get entry point)7 I1 D# g+ w/ i) M/ s9 l
        
5 V. t. A' B; n! \; n" t! L
4 o& Y2 }+ W6 F/ Q3 X" ?0 o/ Y0 e    xor     di,di" W! s9 f1 ], W
    mov     es,di" [0 V1 V8 t4 T5 l: K2 R
    mov     ax, 1684h      
# Z- H3 \7 b# ~* c    mov     bx, 0202h       ; VxD ID of winice
% ~) o% k# ]! K    int     2Fh
9 e1 n4 s' }2 v0 I0 ?( }) l    mov     ax, es          ; ES:DI -&gt; VxD API entry point+ y( F# B- u" S9 k& @  ~
    add     ax, di* \  ]) K- s0 \9 z: z
    test    ax,ax
4 ^2 j* O' n" e& X8 R, T3 \    jnz     SoftICE_Detected3 j: M, G, ~0 {! m* y# z

+ R" D) W; v' E! e" l. Z6 D___________________________________________________________________________
8 c& U* G8 Y9 i& d
( i% d3 t$ s+ IMethod 048 P2 k6 i9 a8 _( @9 E# d# O4 P7 l* W4 U
=========
, e6 i! \/ C2 o; B
4 c* F; \$ V7 O4 p0 @6 {5 gMethod identical to the preceding one except that it seeks the ID of SoftICE
( @3 I: [% Q7 N. oGFX VxD.# B& N2 l6 C) P! ^

) w2 T+ }, Y: ]. V* ~4 [  Q    xor     di,di
% |4 A- E0 _* O& p( b+ p- _    mov     es,di" k+ u. F! Z3 J. }" v9 L  e
    mov     ax, 1684h       , z$ J) _: E# `5 p6 S
    mov     bx, 7a5Fh       ; VxD ID of SIWVID
4 {  x& A% [8 I3 |0 f# `1 h! ]    int     2fh% v! `3 V/ X7 |% a* f
    mov     ax, es          ; ES:DI -&gt; VxD API entry point$ H8 \' O1 t8 R3 u
    add     ax, di2 \- L- v* ^  F' u
    test    ax,ax, M8 v; w6 G8 I9 h0 h8 _# v
    jnz     SoftICE_Detected
8 C% Y; L( [$ k  R/ x
+ W( ]) S- l7 ]( J1 `__________________________________________________________________________
$ U+ j* Q7 b% N$ \8 Z  N1 j
- a. x( q. V! w* [# _- x
! ]# C7 M& \- `' H% A- T- d1 qMethod 05
8 v1 X0 [2 o5 v3 q/ k# R=========
3 y! t/ Q. N! l: g$ _8 H
1 L& f2 p$ d% F2 X3 WMethod seeking the 'magic number' 0F386h returned (in ax) by all system
8 g) z5 |1 Z0 ydebugger. It calls the int 41h, function 4Fh.5 T/ c* c* ]. u3 H# S6 q/ N! I
There are several alternatives.  
2 D) O8 q$ d# Q( b5 j$ @7 Y3 \5 p* l, u( }4 u: d$ _
The following one is the simplest:3 j* q1 h! ?. K  q- o) G! L

& m# i4 U/ c/ E* b! I! s4 ]2 e    mov     ax,4fh
; K" `; N  t. W# r: @    int     41h
" L7 J! }. X0 R5 ]# J* m    cmp     ax, 0F386/ a8 j9 N0 G! g4 \
    jz      SoftICE_detected
0 j! y& i2 f# n& E$ O2 k2 [; u/ o8 ?$ Z& U0 }0 t7 L

2 ^& g$ \/ @/ jNext method as well as the following one are 2 examples from Stone's
8 f' s6 E: @5 ?"stn-wid.zip" (www.cracking.net):
! p$ E) Z' V4 O& v
- x: x; A2 I+ C) [! `    mov     bx, cs/ f4 p- P  K) w; K# p
    lea     dx, int41handler20 }; |" c0 E+ Y) f# ~
    xchg    dx, es:[41h*4]
- a  J+ a. s4 _8 s: Z    xchg    bx, es:[41h*4+2]
6 a, e% N4 `: [+ o; `4 _: v- @) R* m    mov     ax,4fh3 g' @' @  Z% b4 D. l# r" S
    int     41h
6 H& i5 K3 a" L1 t4 U    xchg    dx, es:[41h*4]7 B$ T& c6 \8 P8 K7 w' c& T
    xchg    bx, es:[41h*4+2]- Z% ~3 }  y( p& ?2 i7 x
    cmp     ax, 0f386h- g, n: j) m$ P" k6 Z2 I
    jz      SoftICE_detected
; q; n2 v+ K3 n  s6 t6 F7 M2 l* I7 }) K6 M: ]+ ~
int41handler2 PROC% \8 Y- I, ^) D+ e. h7 _
    iret6 L8 p! S  J9 c; n3 h: v3 [
int41handler2 ENDP# K( T2 h, t4 x% @9 c( R

$ U! W" p" ~4 [& e. H% |, f2 u9 H- O
_________________________________________________________________________& b' O7 o$ T- u2 O- [% g8 \; k
# E; \' B5 ~1 F# N8 S2 k
& S. |1 o  u: B% Q. g/ O# N5 `7 m
Method 06
; [; s8 q# O7 p* K/ d$ f=========6 X0 |2 U: ~0 M/ x( m+ Z( z5 h

# ~3 M2 Y6 ~: p. G9 P
5 o" @0 c: v- O& s2 C( p" l4 ^: Z2nd method similar to the preceding one but more difficult to detect:
  c+ H& Q+ }; I9 W- B# f: z% w( K' l. |: Y$ z8 {9 K
) m9 ]) R" {! J# P  z. d# {
int41handler PROC6 d3 }4 ]6 J% A
    mov     cl,al
' m" k6 s& M% A! |    iret
3 G6 @: Z3 Y  X- C1 P9 M. Z6 K& \) [int41handler ENDP) W+ k/ [0 D; b5 e- \, O4 ?, {/ m
$ i' g$ s& U* {) q+ I

2 n2 O, D' k( h0 B% l3 o    xor     ax,ax
' J9 P$ l6 U; Y/ A& }* w$ A% i    mov     es,ax3 b" A7 n+ W) `& g# d
    mov     bx, cs8 v$ k/ |# |+ S+ `3 f8 s
    lea     dx, int41handler
+ d5 r8 h7 p- k: q    xchg    dx, es:[41h*4]
4 ~, w2 T4 e' m  ^3 T    xchg    bx, es:[41h*4+2]
  x0 A" B2 B. P    in      al, 40h
& s  I9 S" {4 N* r, N1 w7 e7 o    xor     cx,cx6 @# u8 p6 ^9 e
    int     41h
. D  q! M6 u" v    xchg    dx, es:[41h*4]3 w/ F. H. ?7 ]: \5 O
    xchg    bx, es:[41h*4+2]* X' @5 V* \8 o2 r
    cmp     cl,al8 l( e5 l' c/ H* C+ U
    jnz     SoftICE_detected  G3 [7 A2 g2 L
+ g" U# Z* ]! q# R5 n) j7 q/ U+ q
_________________________________________________________________________
7 T! ^7 `& S5 O! v) S. J9 P9 y4 M. t. T  Q2 |! l7 e( ?
Method 07
3 Z7 Z8 ~2 }3 m=========2 c$ e5 @% N! H* D1 b( a
" H) W! h+ m8 L' Z: v; k" h
Method of detection of the WinICE handler in the int68h (V86). E$ F6 u, T2 [" r6 V' B" ]
3 \7 S9 ?7 c; n% t4 n3 V; [3 F$ m
    mov     ah,43h
7 g7 X5 b& Q/ ~2 ~+ y* ~- v6 R    int     68h, b$ P; u4 T- I
    cmp     ax,0F386h: w# E* M0 N' P1 E; o
    jz      SoftICE_Detected. c* J9 Y( F& j! C: z! M7 T
" O; u) V9 n4 G# W" m, g) y" J

. Y/ I. `! j. J- z=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
* D/ V' _  V& u. `   app like this:
" A  M* V2 b( [* r2 \9 T+ y1 G  [4 t; S" x7 W2 L
   BPX exec_int if ax==68
' c) T& V/ C% _) }% ]   (function called is located at byte ptr [ebp+1Dh] and client eip is
: F2 [2 c! z, p3 E# y   located at [ebp+48h] for 32Bit apps)
; U% k9 j- L" y# M__________________________________________________________________________8 r' k9 [& V4 n  L& |
, G/ a( |1 V. S5 }
4 `9 y$ \, f9 v% ], F! U4 ~
Method 08
0 b& f7 j3 a2 y# X=========  ]3 M; P( V$ |& R' `/ s5 O3 ?1 P* i
, _5 [6 ]" u3 a& |+ H0 w
It is not a method of detection of SoftICE but a possibility to crash the
/ Q5 `5 p% o  g+ i- o3 ysystem by intercepting int 01h and int 03h and redirecting them to another4 m1 [  B6 v. x8 C3 Z
routine.
# {' P3 H0 l0 h- Z6 WIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points# f; i" `' F$ f6 b; u! U6 z! N/ f
to the new routine to execute (hangs computer...)3 ]; D* i* x/ V. u/ u
( s+ Y- N1 y6 Y2 p
    mov     ah, 25h
7 c' }" C; C2 `    mov     al, Int_Number (01h or 03h). V6 ~7 n! M0 A' ~( y
    mov     dx, offset New_Int_Routine  U$ |: y% R/ }8 Y; d
    int     21h
$ T9 X+ T: d1 V& x5 J2 G% G3 ]1 H1 u& m5 u
__________________________________________________________________________9 [5 y* x7 g3 e  m
) j: n2 _! H5 b& p# _0 J2 y5 C" y1 {
Method 09& A' g" L7 u" z2 B
=========
! v* v, i, Z  d9 g( J6 Y3 V- H. }9 q  L: D
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
$ Q& q1 J$ W6 w' W/ S* i3 u# jperformed in ring0 (VxD or a ring3 app using the VxdCall).
+ |2 X( A* Y# S9 [+ {0 ?! q" M) G" lThe Get_DDB service is used to determine whether or not a VxD is installed) K3 P$ P2 v1 j4 F# i
for the specified device and returns a Device Description Block (in ecx) for1 {7 y% _! s( D  n
that device if it is installed.5 M8 R) o3 ?2 e5 ?0 C

1 K, s2 ?+ p* S* H$ U3 v   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID8 \) `: f2 g3 Y6 F' F
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
1 j5 `2 H1 j$ O; z5 s' ^   VMMCall Get_DDB
; x6 t' L- \7 `/ H. ^! _   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
! O# j) @2 u8 O: t+ W8 w' k  ^" S, {
Note as well that you can easily detect this method with SoftICE:
2 j# T* x* i5 _7 l+ v+ V+ ~   bpx Get_DDB if ax==0202 || ax==7a5fh; O* Z0 p8 h/ Y/ C2 a5 P% |

5 ^1 F8 w5 k) @% k& j( s: j__________________________________________________________________________7 O& _7 l$ f, ~( _$ c0 l5 Q& Z
7 o) K3 P6 g3 ^" \( M4 p) X
Method 104 L1 R7 G) \; o3 Q9 v7 v( G% k- [  m6 H
=========5 J+ b' ^8 J1 k, |9 M- E
" i4 W& ?3 I3 U; Y
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with% d- H# ^! E2 A/ b
  SoftICE while the option is enable!!
. `! F4 p9 o) O% ^" g
4 N6 j: o. D1 x9 n: S7 CThis trick is very efficient:! q- H; k1 Z7 A0 _! P1 x9 r; g
by checking the Debug Registers, you can detect if SoftICE is loaded
; g: o3 R. j! X( x; ](dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if7 _$ [1 r6 O, y! ?, S2 j
there are some memory breakpoints set (dr0 to dr3) simply by reading their
3 z2 R( X1 s8 }' N9 svalue (in ring0 only). Values can be manipulated and or changed as well
1 L" d: ?8 e* s2 w* F(clearing BPMs for instance)# Q3 b6 U) S: S7 h9 Y" G3 G

+ `( E' G; \- O4 P# c( F8 Z__________________________________________________________________________; A/ c! o9 ~% v

  ^& o6 `9 N+ g" c4 m# xMethod 11' z6 _# N+ Z$ C6 M% g
=========
4 d& f: C" I& ]0 }$ _) {- k
# q2 b6 i& V8 D, ]7 {This method is most known as 'MeltICE' because it has been freely distributed: u; r& u: n0 F& F
via www.winfiles.com. However it was first used by NuMega people to allow1 u, Q+ z% O. C& P! `- _/ r& }
Symbol Loader to check if SoftICE was active or not (the code is located( {- E% i/ s) H- Q  s# P
inside nmtrans.dll).
+ D9 E) _/ q2 Q. F. L! D* l7 c# A( \, \" L& Z* ?2 R; Z9 H
The way it works is very simple:
3 {8 }7 Y% Q3 g) x- L( j0 iIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
; o0 u+ A  W- a! nWinNT) with the CreateFileA API.! q% r8 f/ R0 {

! R$ M: }! _  X" a; {0 h" sHere is a sample (checking for 'SICE'):8 |8 f' g# l9 Q
0 N4 x' u, \8 w# b. m
BOOL IsSoftIce95Loaded()
6 G0 B0 e+ e, v5 D+ _{
& ^' S' A( X& z0 ]( p9 g& v   HANDLE hFile;  0 Q+ R5 W, M8 R3 m: ?3 c: i+ `
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
' `& Y1 }7 _/ y* w                      FILE_SHARE_READ | FILE_SHARE_WRITE,  Q* N8 @8 O" n  E/ }" m" h1 g
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);, o. J- B2 e2 _0 Q+ l3 |. C9 F* R  @. o
   if( hFile != INVALID_HANDLE_VALUE )+ h+ M- u# O1 w& p
   {
: F, T3 a  L& t) T0 p5 R      CloseHandle(hFile);
# A+ N# I6 G. [      return TRUE;
# D2 N+ t" E$ ]1 P6 y: B+ q0 h   }2 {$ r( \9 g# E0 Z/ P
   return FALSE;
( v* [/ F0 t9 w}1 q0 E  J; w1 G9 q

% f4 N. b  d' M3 [Although this trick calls the CreateFileA function, don't even expect to be
5 ?& n* V& @: o8 A% T$ P' Cable to intercept it by installing a IFS hook: it will not work, no way!/ a' q; V9 Q4 K' w/ R8 t
In fact, after the call to CreateFileA it will get through VWIN32 0x001F
9 x( X4 F8 j' i+ [* Y- {; @service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
+ H) H/ l% T( s# Xand then browse the DDB list until it find the VxD and its DDB_Control_Proc5 \( O) w( a. c) R3 c
field.* H( M/ F) {8 s' N7 h/ I
In fact, its purpose is not to load/unload VxDs but only to send a
; e5 q, \7 {4 i, j5 Y. E' I0 e7 eW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
! G, `2 e1 r$ w1 \0 pto the VxD Control_Dispatch proc (how the hell a shareware soft could try
. ~) ?3 V$ h* D0 \( B- m: l0 |' ?to load/unload a non-dynamically loadable driver such as SoftICE ;-).$ D% H/ M* h8 k/ X- j' U
If the VxD is loaded, it will always clear eax and the Carry flag to allow2 P5 t/ y% ]! ?0 T# B
its handle to be opened and then, will be detected.% ^  Y; F& I7 x8 T, Q  P2 v
You can check that simply by hooking Winice.exe control proc entry point
9 {0 a% \( [% Qwhile running MeltICE.
+ C% z. y8 I2 O1 |3 [! {
! `2 ^+ U0 M9 |3 u5 p& Z" f3 O4 W5 f4 y  t/ R2 |
  00401067:  push      00402025    ; \\.\SICE
5 F# v. p: n! w$ b8 u( B  0040106C:  call      CreateFileA7 c) j2 ~( y; c9 d
  00401071:  cmp       eax,-001& y  |( B" P5 ~: m! x* x8 u' x
  00401074:  je        004010919 n8 w- a/ A$ l0 }( w

3 Y- w. a3 ]! A. P: q* m0 v: v' e4 g9 x: h" \9 U2 Z4 j
There could be hundreds of BPX you could use to detect this trick.7 v3 F% s" m; w3 F# k
-The most classical one is:& o7 B* b6 }: ]5 @( e  C' u. X
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
+ P" k: z3 y& L6 f9 x  P0 n" m! }    *(esp-&gt;4+4)=='NTIC'
4 c. A2 g( W( h8 e! z& y+ w# H# H$ ?) f2 A) A9 {$ a
-The most exotic ones (could be very slooooow :-(
6 F$ q% }& {% \" S$ X   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')    y$ H; F# O  c3 i5 L
     ;will break 3 times :-(
- ?! z, k- H9 o! J. b' F& Z
' O4 F6 R# W" [+ Z. g+ |7 N' F  Y-or (a bit) faster:
& {4 F+ U( X# M   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
& |5 u2 N* f& t& k' t/ @/ h4 c- Q
' s8 j$ G( D5 H: k1 M# W   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  4 x; \5 U" l# O* E
     ;will break 3 times :-(
6 v" u- {) Z6 j
8 z( z8 {, h  s% b' T! T+ B-Much faster:! i2 C' k3 j5 q% |
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
% x% L! Y, E8 U: R8 g
# X/ q4 Q7 G. n; y* h, ?6 NNote also that some programs (like AZPR3.00) use de old 16-bit _lopen
- V3 A2 i7 s1 T4 H8 Tfunction to do the same job:; d( f$ a8 ~# I; M8 [: s

) f6 o; B3 k4 `$ T* S   push    00                        ; OF_READ
+ _5 A( d/ k! P3 E$ {2 G   mov     eax,[00656634]            ; '\\.\SICE',0. x" d% l" p0 t, d) U3 E
   push    eax
8 I, e" o( m3 D7 s  Y& m# f   call    KERNEL32!_lopen8 _3 d4 z' V- e0 i
   inc     eax+ ?2 {; e3 n3 v6 }+ l; ~* M' i
   jnz     00650589                  ; detected0 w7 Z6 v. {  P5 @' t6 P1 l
   push    00                        ; OF_READ! X, ?$ h* i2 i
   mov     eax,[00656638]            ; '\\.\SICE'
' z9 u3 K2 b( e: `6 V" J   push    eax
+ y) G, ]1 x6 G# o) `   call    KERNEL32!_lopen
$ A  J3 Z3 s) m. \* }   inc     eax6 h$ `5 F( z! L, e) u1 c2 b2 t
   jz      006505ae                  ; not detected# g9 Q# t) T; z$ C; D
2 H1 s7 }* D4 m& s" \

: k0 d1 j9 j! k3 e6 Y1 n8 N& S' {__________________________________________________________________________
9 G# g& t0 I  \, K" K+ l! F% N$ Y$ X3 a6 l- @; H
Method 12
4 e; S4 X6 {; B! P, T=========
8 }# u5 D/ y2 g- Y% [& \' B6 o% s6 Z# b' n( S* H8 d
This trick is similar to int41h/4fh Debugger installation check (code 05
3 W! ^, P5 d: c2 {$ l7 n3 t&amp; 06) but very limited because it's only available for Win95/98 (not NT)
- X/ Y6 e1 B/ l1 k2 uas it uses the VxDCall backdoor. This detection was found in Bleem Demo.
" }0 `) ^" B$ R9 ^% o
: Z2 @% p! B; y   push  0000004fh         ; function 4fh
7 K: p4 h# X' F! u# ^# p7 l5 B   push  002a002ah         ; high word specifies which VxD (VWIN32)
) ]( \$ T0 ~/ P2 K' p. M1 q                           ; low word specifies which service
8 Z6 x0 c5 n* T' h6 {$ k                             (VWIN32_Int41Dispatch)* }/ j# m0 H4 K+ w4 {
   call  Kernel32!ORD_001  ; VxdCall7 P0 B! C0 O: y1 M/ s8 V
   cmp   ax, 0f386h        ; magic number returned by system debuggers
% x/ t8 F1 G9 S* N4 _! J   jz    SoftICE_detected- i7 \' m! H1 [( C- q

8 j% D  J2 ^& H- X2 Q6 K; \5 QHere again, several ways to detect it:
- [, ]% W0 ?2 u/ N' t+ |9 f0 ?) W0 u3 R" @) S9 D& g
    BPINT 41 if ax==4f* M! v8 r7 K$ ?- }6 E

% u# k+ r9 z. e- l    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one) X+ f8 E6 m$ ?. }6 F) A

  F( g, i& A1 t) H% h) C3 t    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
+ y! P+ t( W. m6 w
. e, _# _, \3 Y- j# F/ M    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!* v9 o* R9 M/ J' Y/ R- f
) N. D8 `5 |$ e* A
__________________________________________________________________________2 D8 D& r3 ?/ P7 S
! o! F. z6 U0 r/ h" K% S; u" o
Method 13
! A! b' B# y) \9 i2 E=========4 a7 u+ i% D% E, \

$ |- F6 ^+ f. N$ }" HNot a real method of detection, but a good way to know if SoftICE is% B+ p6 n7 K0 M  |
installed on a computer and to locate its installation directory.- B* o; C- q: F( T% o
It is used by few softs which access the following registry keys (usually #2) :
+ Z# [' h/ D% @' l! d) a( ?) K+ E$ a* X& z. v/ b
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
- b# G8 e2 J: k% w4 H& Q\Uninstall\SoftICE
7 N1 \; t  u6 \1 O. H$ Z( A3 K-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
8 P' \9 y1 j. ^  [-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
. _% A" Z2 q/ U\App Paths\Loader32.Exe
% ~* }6 S" z) `% J7 I; k
" d* ^! j; B" g7 [( D* ?' r; t2 s' C7 X% i9 r9 r- o" ?# M
Note that some nasty apps could then erase all files from SoftICE directory
0 }$ Y7 d9 j) X( V3 c: G* D1 U(I faced that once :-(
: }; A) T9 \6 {  m) A  O) w0 M2 Z# J6 o( {
Useful breakpoint to detect it:
# b- @" K/ L; p1 f% i: G: C: C' E0 r8 v
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'* j7 I+ M2 z) E# I* r4 b
1 i/ K! w# c% r! s9 P; N
__________________________________________________________________________. r( n) N8 q0 F: D! ^' Z' S3 ?
9 P1 E, @/ `$ |$ t

' C; \# i& q7 VMethod 14 6 i& h  A( {& `5 X
=========4 _; i0 P; l/ Y, L
$ w5 K: L; F9 `" v
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose: ~" y: x. b' G- C( {
is to determines whether a debugger is running on your system (ring0 only).
/ @, [" E8 C  e$ q( {# N, T  @- {' a# D% `/ _3 ^1 A9 y
   VMMCall Test_Debug_Installed) o4 j$ l2 L' i
   je      not_installed
" r+ @. ]0 M# W6 e6 N& ^9 P
5 i: R% S- S# j8 P6 |) ^This service just checks a flag.( U9 |8 ?% O$ ?4 b3 S
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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