<TABLE width=500>
. m5 \% Y+ Y: k. M7 B<TBODY>; Y- @" p8 N2 S5 r4 N% t
<TR>
6 G g2 q# ^9 ]0 s7 \9 g<TD><PRE>Method 01
* W" \) Q# e1 `- c+ o7 W' x=========
2 [+ }# K. t! \0 x( ?
+ @; G/ G q, f3 A' Q4 qThis method of detection of SoftICE (as well as the following one) is
4 K9 x0 O, K1 E, ^$ _- l6 nused by the majority of packers/encryptors found on Internet.6 [" W: l/ D2 L
It seeks the signature of BoundsChecker in SoftICE5 a) M, e1 O( {+ j4 n1 U( A
. P7 M! f3 W1 _
mov ebp, 04243484Bh ; 'BCHK'$ i& j6 ]" d) _ J% w- I% u. ~4 x
mov ax, 04h
# m4 O& b- Y+ r7 H, F! v int 3
% D" n3 m) b2 U) g+ G$ [2 R* f; ^ cmp al,4# B+ W+ K. S" ^8 Z
jnz SoftICE_Detected2 [0 p0 s5 W1 g& P1 r. ^$ t( O
6 p3 [8 [3 j2 Q2 M& m8 s___________________________________________________________________________
: l: ~2 M( r: `% |% T4 x b: }2 ^' I3 m8 D: t3 m; R) M9 l7 m/ T
Method 02
! s! _# k7 i% [9 |=========
2 B% U: n% N! O! i& w. M
0 Q+ K$ m2 G( q* t; r! c/ P3 HStill a method very much used (perhaps the most frequent one). It is used( ~7 V4 N* A! i- L
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,
5 Y& T' l' \$ W' s9 i6 |or execute SoftICE commands...' |/ G0 K! c* z5 U
It is also used to crash SoftICE and to force it to execute any commands
+ f- J1 N- N& ]( K% w(HBOOT...) :-((
6 m& V, n/ h$ `( C0 H
+ _3 R/ y2 d( ZHere is a quick description:
3 u: K+ E& d" c5 e/ Y" f8 q* Y-AX = 0910h (Display string in SIce windows)2 E0 G2 U* [+ j: o* v' C
-AX = 0911h (Execute SIce commands -command is displayed is ds:dx)% i5 h5 i z# r
-AX = 0912h (Get breakpoint infos)
7 \- p% Q5 S+ Y3 c4 G5 b-AX = 0913h (Set Sice breakpoints)$ ?1 O# I( F3 R* N
-AX = 0914h (Remove SIce breakoints). N( o: j# B/ f3 F. V
! Y4 m" i5 j. A# N* a2 j% o4 zEach time you'll meet this trick, you'll see:% n* w- A$ H6 F! H* l! `! T
-SI = 4647h
2 ^- v4 }& P; s4 O; m+ x# j-DI = 4A4Dh! a- m9 b8 G4 }
Which are the 'magic values' used by SoftIce.
% e0 i4 V/ W7 f1 H; y4 mFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.
- I5 h# u% w# Q( Q8 }: R: W( O( Q( [+ p$ B/ b; {( _
Here is one example from the file "Haspinst.exe" which is the dongle HASP
4 A: T$ l8 e/ c* ^) s! `6 D* UEnvelope utility use to protect DOS applications:
# f" W |6 } c, @7 m
: u* H% J% z# L. f* b; I. O4 e }1 J; n3 o( w
4C19:0095 MOV AX,0911 ; execute command.
' v+ f3 k" F0 q8 |4C19:0098 MOV DX,[BX] ; ds:dx point to the command (see below).& I8 A8 M# X( R, T1 J6 U X' I- @$ W
4C19:009A MOV SI,4647 ; 1st magic value.: J7 \/ q: C! O( H, s
4C19:009D MOV DI,4A4D ; 2nd magic value.
6 a# H3 R8 G, E6 C- r# p' f- q( E4C19:00A0 INT 3 ; Int call.(if SIce is not loaded, jmp to 00AD*)
5 k4 o) A* a3 G1 ?# G Z4C19:00A1 ADD BX,02 ; BX+2 to point to next command to execute
! q! @% x' Y( W6 \ C4C19:00A4 INC CX/ q; t/ o9 h7 v) t2 g; b3 p5 r+ g
4C19:00A5 CMP CX,06 ; Repeat 6 times to execute
! y" J7 j, p* j, z. K) j9 M4C19:00A8 JB 0095 ; 6 different commands. s0 c2 Y u' ^2 J1 e3 f4 T' U. v
4C19:00AA JMP 0002 ; Bad_Guy jmp back.
' e% [: h# b8 O3 N& n4C19:00AD MOV BX,SP ; Good_Guy go ahead :)& K- |3 B. u2 I% ?! H
# s2 j1 M- |; x( h, K$ G# nThe program will execute 6 different SIce commands located at ds:dx, which8 |* I$ S" _" B- B3 L# \
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.; S. e* p x. A9 U1 T. U6 u( k
; c& |9 N! i i# P7 Q* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded." q1 v, r7 G3 P$ N6 ]
___________________________________________________________________________
4 ~/ W$ K4 F( Z5 f$ e; C5 d% O7 c- ^" K' e/ A& n
, r1 X$ \: M! [7 B. E) TMethod 03 R8 \# E- ^5 U
=========
+ j& X( w2 u4 a* p3 ^# O! g5 X3 N& S5 {$ {: P" R8 ~$ w8 S. s9 z) X
Less used method. It seeks the ID of SoftICE VxD via the int 2Fh/1684h
, U. n C/ ~3 w) y- A7 k! X(API Get entry point)5 v2 v& p! a+ I. K4 Q9 @
- Z! K7 k j* L( s; ~- g" ^: b
1 |- G( l; N7 c) S8 P% e) ?$ \ xor di,di
7 G; c4 x5 Q2 n+ D9 }. | mov es,di/ D& d5 q; V5 i5 s
mov ax, 1684h
7 F/ O/ `* `6 w3 `+ {: U2 R4 p* N& @ mov bx, 0202h ; VxD ID of winice
) v1 P7 R/ v1 r& j% R int 2Fh/ m% S J, o; F" J1 z. D
mov ax, es ; ES:DI -> VxD API entry point6 f% D* l* v3 w1 ^9 W: k
add ax, di- N0 e* W: _5 H4 s: O" h
test ax,ax8 j& `& d& O1 H
jnz SoftICE_Detected
) N; E" j) J- ^! U0 ^; f9 ^. I) b) f9 K8 V
___________________________________________________________________________4 M" I. i7 A9 l9 S! }
1 u) \1 `/ m% ]0 uMethod 04. L, K: }: o* I. n5 g. x9 N
=========
0 Q( H5 f5 A+ h# E" ^( w8 ~2 }& R' E3 G+ f$ B' l- B6 v
Method identical to the preceding one except that it seeks the ID of SoftICE4 _5 R0 R% J. t2 |# K) W( \: x
GFX VxD.' A- V" b4 W) ~* F2 Y ?2 t
& Z8 Z+ R6 {. i) r I1 h xor di,di7 R6 D( }: w& }4 L
mov es,di F1 Y. C; I# @8 q" D
mov ax, 1684h , g( p4 x+ j! Q2 P4 p' ]
mov bx, 7a5Fh ; VxD ID of SIWVID3 S5 V- y( W q# [3 Z( U _8 H- s) M
int 2fh! x d9 n+ c5 ]* H6 B/ l5 Q
mov ax, es ; ES:DI -> VxD API entry point
, ~5 j- z b! U0 b add ax, di
2 u; u( c- S4 ^& ?- q* o3 d test ax,ax
4 g" L: h- d+ e [ jnz SoftICE_Detected$ `4 G2 A! G1 @( `
: s# l) l2 j2 k. `/ v) _$ C9 _$ c__________________________________________________________________________
! U7 i. v8 _) R) p" i1 p) I# |: w
) M- K& y8 R0 J5 }Method 054 q/ e6 u: k D$ C/ b( A/ |
=========3 ]+ `$ M& C3 t4 l! s
9 x3 H' j6 f1 }Method seeking the 'magic number' 0F386h returned (in ax) by all system- L5 H, d( d6 \8 D% p
debugger. It calls the int 41h, function 4Fh.
) T4 K; {/ P$ nThere are several alternatives. # y; P" E5 o& Y1 U' ~ x5 V
! C8 w' n& z/ x' K! ]. E
The following one is the simplest:
! K4 U' T- r: d) t' o- k. R7 _4 r) y: y+ a! m" a; z; d8 s
mov ax,4fh
5 J+ ^4 q. o. _" U int 41h
& ~4 q- S4 n9 O+ O: Q8 z cmp ax, 0F386
$ f; Y$ {& L, B0 }& @7 ^ jz SoftICE_detected
% h% _( }5 U6 j% Z: T" T7 a3 b% M2 G
* U/ Y$ c/ C, I( s8 KNext method as well as the following one are 2 examples from Stone's
) s" X$ i }' P8 e1 ~+ ~"stn-wid.zip" (www.cracking.net):/ W# o0 Q5 f3 p! A! e0 {+ A0 y( b
8 S+ v }# }7 k$ R- U mov bx, cs1 i% F& F* u; l# C( ]2 M
lea dx, int41handler2
1 a+ b4 g* v$ h/ S! i+ E( c xchg dx, es:[41h*4]+ C+ Q0 F$ M3 x+ v! R: ~- X" |* D! P
xchg bx, es:[41h*4+2]3 l' _3 L o3 \ i3 s( W: _' z
mov ax,4fh/ [' S2 z( } v$ I$ |/ x# ~- ?6 `2 K
int 41h. d# r% x5 [: o; Q0 P: D$ F: }
xchg dx, es:[41h*4]
" P1 k8 Y# R6 H2 V xchg bx, es:[41h*4+2]
2 V- e1 y+ }; \' z) p% Z3 Y" R& J cmp ax, 0f386h- _2 g. ^! Q* q* _ ~6 }' o
jz SoftICE_detected
4 U. g/ c& D* f$ {: G' _$ N: I
9 l2 R* r6 q) G' }int41handler2 PROC0 V' y. j: y5 v/ ?+ c) b: s4 T
iret1 d/ w! c2 b( I8 j7 q! v7 T) q. o) c
int41handler2 ENDP
y! n* z6 l. [' f- d' Y0 _: ]! j' R% s( D
$ ]% J& y! ^2 \2 T1 T" B- ]
_________________________________________________________________________
. W u0 J5 t& M$ o5 I; M) h6 m; V& q* o, w8 m9 S
7 V; u! t- d' P: pMethod 06- y' z7 L4 x. ?) A, y& W
=========, l0 _4 Q) j9 u: P# h- |' u" s M
$ |2 ]5 X5 q1 o5 i
9 l# A# s9 v4 v% w; v$ I2nd method similar to the preceding one but more difficult to detect:/ J2 p) E9 w [) k! ^2 N
! o& N( {! F+ [3 U! f
. i& o$ `- \( D: O' ^* ^- G( o
int41handler PROC
4 v1 t9 P" _4 u% h/ Z! \0 \ mov cl,al
% Q2 y6 t2 Q% K# v* F iret
1 o9 z: n& U/ V3 N: bint41handler ENDP/ ], c2 M- w" @% }# U
% ~+ q$ a4 ]2 I1 y" j$ y x
4 ~; Y; V5 F& _5 u) Q xor ax,ax
. Z+ _& l( ]. m ^; a mov es,ax
- X g* V$ Y& |; o mov bx, cs% J9 @( }& Y( k. P
lea dx, int41handler, S) S3 p% g7 r/ v: G& z8 ~9 Z
xchg dx, es:[41h*4]" a7 W g. l/ T h
xchg bx, es:[41h*4+2]
/ u5 l5 R" ~# | in al, 40h
3 ]" V! ?" T) a7 k" t xor cx,cx( j8 l1 ]1 \; v; C: B0 q
int 41h. ~9 e$ s0 l$ I3 |' L/ d
xchg dx, es:[41h*4]
' ^0 h; m; \7 I xchg bx, es:[41h*4+2]
j- k% V6 X- n1 }3 j7 H m4 Q$ ?: H cmp cl,al2 J+ n2 P9 _3 m( E. y0 u
jnz SoftICE_detected
# A* ]3 S' y+ {! j( O0 T2 V& c( ^3 R
8 |0 H/ z$ Q9 ]& W- C/ l1 E_________________________________________________________________________' w8 u4 E+ o h4 O
! k- }9 R8 Y$ c
Method 07/ m$ v2 w6 \, O
=========1 A* d- }- X' A1 I2 l) \0 u8 o2 D
+ K: J* i8 S6 E" Y
Method of detection of the WinICE handler in the int68h (V86)2 A1 \- F/ j8 |9 s0 w/ t
! A# m4 @6 c+ }8 h
mov ah,43h
- j* ` U+ Q, b5 V. \0 c3 l) E( W1 Y int 68h
5 [! C6 w( T. w0 F- m cmp ax,0F386h5 c, d) L8 M* H" M
jz SoftICE_Detected* |! F2 T+ ]; ^, T' @" ?; M }5 K5 J
$ w3 P6 ?2 B2 [5 }! B L
% n6 M4 g" q0 ~4 W b=> it is not possible to set a BPINT 68 with softice but you can hook a 32Bit8 G" d/ c6 E- |0 M" `8 |
app like this:
+ k2 m8 u( u- l6 d1 A8 e
I% _) G) s) S% O3 d: i# t BPX exec_int if ax==68" N. D* O) F% E! j+ @+ T, n
(function called is located at byte ptr [ebp+1Dh] and client eip is
+ Z- V _+ u4 ?2 `4 L6 x: u located at [ebp+48h] for 32Bit apps)2 o% n2 F( b$ u2 v
__________________________________________________________________________
9 _' v# Q1 U# ]4 N/ w
: r5 A: L" {; J9 K2 u1 \- k
3 L+ u! b+ R" c9 O$ I; CMethod 08
% _& ^7 X3 o; J0 r# U! e; W=========
* c, A! m* n# t8 q, ]$ `- C" T" r% ^+ Z; p9 R S4 u4 g' W5 g+ m
It is not a method of detection of SoftICE but a possibility to crash the
( b( }) T3 A9 w0 i% f4 V5 gsystem by intercepting int 01h and int 03h and redirecting them to another5 o) N c+ j$ L# W
routine.
1 r1 ^0 z! \* C- y' WIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points' \4 g# P9 L) P9 X, w. `
to the new routine to execute (hangs computer...)9 c" _ B( ?6 v% P3 C
6 W# X' J9 n+ N) l: q' m. M mov ah, 25h3 H5 v, t& y4 u5 R$ b. T/ D6 r- q8 { C
mov al, Int_Number (01h or 03h)
; l8 M6 u; d! U$ u1 S5 f$ s5 I$ s4 R5 j mov dx, offset New_Int_Routine
& V7 k0 \: E( ~; h2 l, o! I int 21h7 h( j0 k" f8 c% e; m
8 B0 l% P, y' ?5 ]# q__________________________________________________________________________1 [0 ]2 |; U2 J% X. J
% H" Z6 l) C9 I( i7 A& jMethod 09
0 {! J& W F6 w0 p( i2 H B=========: t, i I& ?4 T% m: M
, \, ]7 t! v7 g& W* _This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only7 h: G9 }2 j4 m8 R
performed in ring0 (VxD or a ring3 app using the VxdCall).
+ y. ?5 m: L7 n. D6 T+ a; C0 CThe Get_DDB service is used to determine whether or not a VxD is installed
3 m0 e a9 l8 w9 z' X# w$ `+ u5 |& ~for the specified device and returns a Device Description Block (in ecx) for9 K p: h8 h* @5 Z
that device if it is installed.# C4 p! S4 _3 g6 z5 Z) m
6 W, h6 Z, S# q
mov eax, Device_ID ; 202h for SICE or 7a5Fh for SIWVID VxD ID: N3 m Z; k- n0 t$ ]
mov edi, Device_Name ; only used if no VxD ID (useless in our case ;-)5 |/ z8 W* e4 w) i% r; B
VMMCall Get_DDB
2 ^" i1 n. \3 y F mov [DDB], ecx ; ecx=DDB or 0 if the VxD is not installed' A7 j, j# N# v, B1 W
0 w5 C, w& O* x; R, e7 g
Note as well that you can easily detect this method with SoftICE: U3 f( Z: [: A" `- W- k5 ^
bpx Get_DDB if ax==0202 || ax==7a5fh
( g/ W+ v1 u ^. t! F/ ?7 I8 \1 _6 T1 P
__________________________________________________________________________% Z% |" ^! P* N A7 T% z
* O, M% Z1 q6 k6 v) s' uMethod 105 \/ ]& y! }! s( R
=========
/ l( a3 Y; ^/ L; ^6 H8 S% j
* [ \& E, Q+ `=>Disable or clear breakpoints before using this feature. DO NOT trace with
; i& U8 t- b% B8 j5 [ SoftICE while the option is enable!!+ [1 `' K; [- U* z* Y; [& H: T* g
% g1 i0 T1 b" X jThis trick is very efficient:/ P& Z" T, e3 H, L" X8 n. f; R
by checking the Debug Registers, you can detect if SoftICE is loaded
' w5 Z- X# U+ D! I8 v# T1 ?, K' L(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if. r' t' @0 W" {) P# U" L
there are some memory breakpoints set (dr0 to dr3) simply by reading their
3 ^9 t* I, G. R2 wvalue (in ring0 only). Values can be manipulated and or changed as well
H- [& K- D/ C5 O(clearing BPMs for instance) W. c4 T+ C& B b% I
+ p$ o& ]' O9 K' ~2 D5 J" M
__________________________________________________________________________# E' R) \6 A1 a0 Y
0 ~6 T& G+ p6 o; O, Y
Method 11
) R5 q4 ^5 l; ?$ I=========
# g- D0 H6 [ F, ^1 [6 n5 L& |. [: n5 R8 T' g6 G9 D# w' b
This method is most known as 'MeltICE' because it has been freely distributed
$ V+ z' k) S5 ^. N0 U$ e: b: Z% c! kvia www.winfiles.com. However it was first used by NuMega people to allow
3 C9 a7 X( w! O: eSymbol Loader to check if SoftICE was active or not (the code is located+ P6 @$ K3 T! n# w/ ^
inside nmtrans.dll).
4 W/ a0 y- A. Q& ~/ u' n
9 q1 v' U/ W! N# n/ }; }The way it works is very simple:& @: q' t( R7 ]
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for+ H# D. ~- m) B) c
WinNT) with the CreateFileA API.
- |7 s9 h, |0 P# f/ |8 t& p! b5 B8 n4 z; [8 n* B, q6 w) D
Here is a sample (checking for 'SICE'):: G$ E4 o) d1 g4 Q2 n7 `) j3 u4 S" b
6 s7 d' |2 G2 q2 O( R$ X' _" C; ]
BOOL IsSoftIce95Loaded()9 b( S2 B3 R* y
{
7 {4 E8 t2 }! e* E7 e$ k HANDLE hFile; ) ?% L5 n! |8 c& H# u# F5 I
hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
" \. M1 I: L3 x# Y5 @ FILE_SHARE_READ | FILE_SHARE_WRITE,5 }; F4 ?/ T2 P$ p6 b: V
NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);/ }7 l' J5 J. y H3 H" y, b( V; V
if( hFile != INVALID_HANDLE_VALUE )5 d) S6 E' C! r& k6 w
{* v$ t2 J% |% Q( L. V5 e' w- R4 h
CloseHandle(hFile);
' G9 z+ q* c; k3 x return TRUE;" n0 ? m% a/ F0 w+ T
}& P" g1 x( F* _7 V" D7 J
return FALSE;7 r5 `$ u+ h0 t, r5 M
}7 t/ h+ H$ j' |! A
+ O C# A7 q5 v5 FAlthough this trick calls the CreateFileA function, don't even expect to be- ^4 `, d5 c4 q) g
able to intercept it by installing a IFS hook: it will not work, no way!; G( r/ b; [% I
In fact, after the call to CreateFileA it will get through VWIN32 0x001F
|8 F# X) M, |0 G. G& Xservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
! c) {* i8 e1 b8 ?3 m# ?" m$ Oand then browse the DDB list until it find the VxD and its DDB_Control_Proc! }/ E4 m' L, Q
field.. Z1 j/ i+ `# h* U# o
In fact, its purpose is not to load/unload VxDs but only to send a
9 F, Q8 J* m1 [1 ?, ~ ]" }W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)4 T7 U( H( G+ R. D/ |4 R- J5 o
to the VxD Control_Dispatch proc (how the hell a shareware soft could try
- |. }' @2 U" F; h: b8 k2 }to load/unload a non-dynamically loadable driver such as SoftICE ;-).% N4 ]' {0 y f) W" i- t
If the VxD is loaded, it will always clear eax and the Carry flag to allow! H" v: q: a5 A* H, m' k1 ?
its handle to be opened and then, will be detected.
/ \2 ]! L* c+ f/ XYou can check that simply by hooking Winice.exe control proc entry point" a9 b( C1 ]; J7 B% i7 Q. e& Z8 w+ @4 |
while running MeltICE.
7 z1 K1 C1 B+ R: f+ }; _& K# O/ d, T, H7 N) K3 ~5 M8 m9 @
* u% M$ C' N! W' t: p4 Y 00401067: push 00402025 ; \\.\SICE; C; x% X/ Y4 m$ \' N! H% G& Y w
0040106C: call CreateFileA B9 D# z- i l% U* Z
00401071: cmp eax,-001
' `1 s3 Y+ e1 k7 y* G. x1 B7 Z8 J 00401074: je 00401091* l9 t* n2 ?) _' [- M$ m
8 i5 N. E2 A' U6 j4 h
" t1 w/ q6 }# u% I
There could be hundreds of BPX you could use to detect this trick.
9 ~3 h4 f& P; F-The most classical one is:
: J% W* w1 v# |; v BPX CreateFileA if *(esp->4+4)=='SICE' || *(esp->4+4)=='SIWV' ||6 v9 j1 O b" M& O/ P- a
*(esp->4+4)=='NTIC'
! N& \. W* e' W) |9 Q- F2 x2 _4 E$ Z
-The most exotic ones (could be very slooooow :-(' G& _- z3 k! T, w- f ?
BPINT 30 if eax==002A001F && (*edi=='SICE' || *edi=='SIWV')
1 W: ]% t2 K r2 t& h, [ ;will break 3 times :-(" L. Y8 s* K& @$ I; T0 x
$ {% V2 X. u7 [7 J
-or (a bit) faster: , [- E q- f! b% P
BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
4 g6 m2 ^. G" d; _ Y; S& ^4 c; e* N: C U5 d, Z
BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV' ' g$ {7 e6 l7 l' V
;will break 3 times :-(% a& c1 y B! P- x+ J
' w6 Q; G3 w' H; B. e
-Much faster:
5 H. ]% [& L+ L; X. _7 i& _- c6 e! ~ BPX VMM_GetDDBList if eax->3=='SICE' || eax->3=='SIWV'+ A" |" i- W; j5 }. Z1 I- H) H# w
/ @- l" Z' [+ {+ G& zNote also that some programs (like AZPR3.00) use de old 16-bit _lopen0 h$ u4 b+ N/ g O. Y
function to do the same job:3 D5 I* W+ O% c3 n
: b0 I0 |2 C" h. [! d0 @ }9 d push 00 ; OF_READ" I) _ G+ K6 a3 ] _# g
mov eax,[00656634] ; '\\.\SICE',06 g4 M9 Y7 `% K* ?% t! B$ q1 A
push eax" |- N# H1 \" d$ I" U5 E _
call KERNEL32!_lopen
! [8 G/ f, M! W: L% q inc eax( I/ @0 N" X( v& i8 s( [$ a' q
jnz 00650589 ; detected2 i+ k$ e+ O) t2 ]) e$ V
push 00 ; OF_READ
2 K) w1 l: ]* @/ | mov eax,[00656638] ; '\\.\SICE'
+ `7 r- O# C5 F1 D" t- N% I! y" Y push eax
; v- v/ w9 J( E6 v. _ call KERNEL32!_lopen
8 `& A& @) F# V5 m0 H inc eax, ?. t$ E4 f( H8 J' x" J: ^& j
jz 006505ae ; not detected
; @" ~6 A+ g! [5 A5 p
) e* r, h, W! i6 m/ N7 ?% e/ U
, D* d/ `7 e2 d$ D) S' s+ e__________________________________________________________________________
3 B. W8 N2 q( s: G( l
1 D* _* `% g/ x: SMethod 12( k1 k1 S) s) c; J/ v9 d
========= K: N! z9 X2 E
$ T5 Q0 h2 b' U8 I! C9 g
This trick is similar to int41h/4fh Debugger installation check (code 05. w' O( k+ o. L% P! ^( @
& 06) but very limited because it's only available for Win95/98 (not NT). \8 ] i6 R& Q! v
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.
3 {: e% |; Y2 s: q. A# B+ `: a) w; ? w0 e
push 0000004fh ; function 4fh
; l. e, S% R9 d- ?" b push 002a002ah ; high word specifies which VxD (VWIN32)
; W# t% u! U' e: P6 z c ; low word specifies which service/ V# o% ~- j: U; g0 h$ A0 Q! I0 n
(VWIN32_Int41Dispatch). Z2 v. E# l: z9 [' g" O
call Kernel32!ORD_001 ; VxdCall
7 B7 B. S; W, J0 F& Q cmp ax, 0f386h ; magic number returned by system debuggers
% d/ Q! A0 ^% P, m& F3 N! t5 @ jz SoftICE_detected
% U/ ?1 J6 d- u% s5 e% N0 u) D
9 I8 x/ e2 l0 n- o4 K% L& g& mHere again, several ways to detect it:
8 T+ C# B* w5 D+ H$ _: @4 `$ f0 t
BPINT 41 if ax==4f
$ L9 ^; _ Y2 I5 S5 f: ^" o W
5 D6 \9 |# F; D7 @ Y& n3 C BPINT 30 if ax==0xF386 ; SoftICE must be loaded for this one# Z% f/ j# P" ]6 K9 J
6 W5 M8 e+ U/ G BPX Exec_PM_Int if eax==41 && edx->1c==4f && edx->10==002A002A u. y4 n# S: g! k+ C; ?
5 y6 I% X) D, U5 k V' j BPX Kernel32!ord_0001 if esp->4==002A002A && esp->8==4f ; slooooow!7 Z1 p" v# X) T* U3 Z
" E' @4 {( D( F1 Z. u% t6 t% Z$ g__________________________________________________________________________' k9 b9 X, w8 {( I" N+ _; m0 v
/ m. r$ L! S$ M1 k
Method 13+ o ~ S8 O' `0 }& _. G8 W
=========
$ ~; z8 ^$ t+ h% Y8 e n- s, g6 [5 }1 U% e4 A: j
Not a real method of detection, but a good way to know if SoftICE is
& ^; Q& S- U" [% Rinstalled on a computer and to locate its installation directory.
& A" e. S3 U$ c; K: W9 S1 iIt is used by few softs which access the following registry keys (usually #2) :
# _5 t) ?) W* d+ ~9 A6 @2 i3 r+ \/ @
2 P( _ S, O& C9 H& y, t0 r4 U-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
3 g% }; K/ Y7 I7 J\Uninstall\SoftICE
* z; r, I+ D( i4 `& d-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
( w3 }2 {% n3 v0 G! r# P-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion' o3 C/ D2 @+ c* ~4 H2 h1 o9 v
\App Paths\Loader32.Exe5 U, \; D' U- D$ f6 \
3 j% h8 U: J4 b9 @* C$ u3 S+ F7 x1 B2 a9 O0 a7 \/ o4 h
Note that some nasty apps could then erase all files from SoftICE directory$ i# K5 m9 s# E- d* q# G6 N
(I faced that once :-(+ u) v1 q( L0 p& j
7 T( i* E" s& ?" a/ v* [Useful breakpoint to detect it:7 ~( ]* O1 d0 d- A ^ L) l
: b: i( V* a. m6 n1 h1 }4 s/ Z
BPX _regopenkey if *(esp->8+0x13)=='tICE' || *(esp->8+0x37)=='tICE'5 J9 T5 M% \" p0 X0 I+ R
) S- D' t, O- }! {# t/ b5 t1 B
__________________________________________________________________________
3 e8 Q, ?1 W1 t/ i& }, d$ f3 m" ^$ E
0 j1 n/ C _4 `) R) R* O: |: i4 q2 _) I' Y
, m: P: r/ P) q" `- K% [9 k |Method 14 + `1 j5 U- }/ i7 W: D$ E9 x9 c
=========
j8 M# c& k. ~( A3 ?/ y, ^3 ?, T; A( a3 _7 H7 {
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose# L9 i5 G# W \+ y h; ?+ o
is to determines whether a debugger is running on your system (ring0 only).
# j- L* E$ _6 ~) \+ Z7 a+ {: ^+ C- [- o \( n" U) a* w7 @
VMMCall Test_Debug_Installed
9 T7 |+ `9 M) F$ G je not_installed
$ y$ U7 f5 \: j( A6 }! }& l! }; I& ^
This service just checks a flag.8 h, O/ ~) r3 F5 \2 d) ~+ a" Q) o' @
</PRE></TD></TR></TBODY></TABLE> |