<TABLE width=500>1 B3 ]$ E d% o! S& ?; f% E3 M
<TBODY>* i3 X0 [1 R1 N" e( C( v) g
<TR>
: @6 W* h9 _% v n2 Z; i<TD><PRE>Method 01
8 j0 r, Y8 |' I$ r6 ^* j ?$ E=========! e' Z0 C+ m7 A
0 A* K: p4 e& A
This method of detection of SoftICE (as well as the following one) is
) B& ?2 \; J. p+ g- eused by the majority of packers/encryptors found on Internet.. ]) L0 X) ]1 p( [
It seeks the signature of BoundsChecker in SoftICE
0 s" [" P2 d$ X" l- ~: A5 I. h3 h# D
mov ebp, 04243484Bh ; 'BCHK'
; N! t2 S' Q; c- b. s mov ax, 04h
8 \6 u( ?6 F* G6 P$ C% ^: { int 3
' _- s' j4 S/ F- G) \7 Y cmp al,4# f7 X) g$ q% l& q
jnz SoftICE_Detected
: K) P( J- Q6 C! h. L$ q4 D$ t' f* R0 W$ k) W. V
___________________________________________________________________________, A) W. z6 S3 N- H! c
?# Q& w$ D) N( i0 _; pMethod 02
6 c4 M' B4 i* w; l( t+ s=========
( l8 | x0 y# G8 q: H3 L/ P3 f* h/ f- j9 I! T6 i3 {1 o
Still a method very much used (perhaps the most frequent one). It is used
& P( d5 G! G7 _: \* n$ M% E# ]to get SoftICE 'Back Door commands' which gives infos on Breakpoints,
2 J# k7 F& t* n% q X# W: `* uor execute SoftICE commands...
$ {* l: P z) jIt is also used to crash SoftICE and to force it to execute any commands
0 C3 M! G3 j8 K$ f(HBOOT...) :-((
% p: i' Q# Y* y/ P7 \$ K1 k! r( g7 [. m9 }' {
Here is a quick description:$ i3 E6 O1 m1 p" @# x, B7 {/ o: k
-AX = 0910h (Display string in SIce windows)
4 Y6 ?% C0 [& T-AX = 0911h (Execute SIce commands -command is displayed is ds:dx)5 X# U$ R' ]! |: [2 m
-AX = 0912h (Get breakpoint infos)
3 a* S+ P7 d* y0 P2 K8 p) z-AX = 0913h (Set Sice breakpoints)5 u" x, ~) E2 O# [/ W3 W% p& `
-AX = 0914h (Remove SIce breakoints)# l4 v, {- E e" i4 P, _
0 Z& x( L1 v% g: s2 U
Each time you'll meet this trick, you'll see:
$ h3 s( a0 G0 r2 }% t7 ~! j-SI = 4647h
- R. Q& Z& l% a' t( e# C" u-DI = 4A4Dh% ~0 [- b4 |4 m; c' X; L
Which are the 'magic values' used by SoftIce.
9 Y8 |# A- ?9 b I8 a2 j/ fFor more informations, see "Ralf Brown Interrupt list" chapter int 03h." z. L" _0 {& Z
, X6 i# D1 y& J c# F
Here is one example from the file "Haspinst.exe" which is the dongle HASP% F6 w+ g: n$ [; D" P" S
Envelope utility use to protect DOS applications:
@: N# d0 o$ r E$ o, P: V% O# ]: L! F6 @4 r+ Y, _0 U5 A
5 k' E. c( z- L. n6 ?" s8 N4C19:0095 MOV AX,0911 ; execute command.
2 ^! ]0 J, P2 K' Q% V, g4C19:0098 MOV DX,[BX] ; ds:dx point to the command (see below).+ l( g+ p- {- N0 G, Q7 ~
4C19:009A MOV SI,4647 ; 1st magic value.. K% x' z! W( E1 }( i
4C19:009D MOV DI,4A4D ; 2nd magic value.
c' Y8 X' H6 T, D7 E+ G4C19:00A0 INT 3 ; Int call.(if SIce is not loaded, jmp to 00AD*)6 O$ H4 i) m0 n# ]
4C19:00A1 ADD BX,02 ; BX+2 to point to next command to execute7 _/ e/ s5 O# W) j1 `5 `
4C19:00A4 INC CX( s0 S6 r1 c5 s" k8 v; f
4C19:00A5 CMP CX,06 ; Repeat 6 times to execute6 @9 X/ A5 N! |4 X
4C19:00A8 JB 0095 ; 6 different commands.
" {0 p* B% [' i/ C& y) a* ?% A4C19:00AA JMP 0002 ; Bad_Guy jmp back.
N. c0 p0 u- [6 O. k4C19:00AD MOV BX,SP ; Good_Guy go ahead :)- K. m. Z' d* o
; X. ~% {. C' \0 K2 O1 W6 pThe program will execute 6 different SIce commands located at ds:dx, which
/ O/ P* A: j" F8 S" Bare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
) w" }4 { ~0 n$ [) s8 U1 Z( L! y6 _" [& \
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.) l% Z2 t! U( e6 Q! ?
___________________________________________________________________________: p) b/ N- n" A8 T
% z. P# _! `2 _/ |
3 b% p2 r. z7 u. t/ x- e* e" b6 GMethod 033 x& A! k, u F( X5 n' i
=========
( \. u A0 y' |; e1 r* `; h K& U2 l% c. V: E5 U0 s, M
Less used method. It seeks the ID of SoftICE VxD via the int 2Fh/1684h. U+ K P# C4 L- J$ i
(API Get entry point)- O- L+ A: ^" K
3 r8 j$ U" Y" Q# p; i% x" H
1 o- V( f- P! k% Y5 S6 t& x) e xor di,di. V8 v8 I" q' @, i
mov es,di6 |. s8 m% z$ Y, u( g8 I
mov ax, 1684h
2 b% m" v9 F8 J mov bx, 0202h ; VxD ID of winice
( v7 e. {' y% D7 [9 d# ^8 o" V int 2Fh
, l( Q. m9 t; N+ k- d mov ax, es ; ES:DI -> VxD API entry point
9 z8 x- l7 x5 P. | add ax, di
2 O' A1 c K# H* a( ~3 A$ [ test ax,ax) f' z) L; }+ C- V4 M! f
jnz SoftICE_Detected
3 ^3 t: J" P. b2 q' u" h- C& s7 n, ^6 a
___________________________________________________________________________4 X4 i1 W9 b" J+ X5 Y
$ o+ a4 e% h- Y
Method 04: e+ G( I1 J; ~+ U' S/ K$ z; k
=========. T1 W: q6 I' a1 |& V1 c, }
" @* R0 M* |) f: m8 w# h8 [Method identical to the preceding one except that it seeks the ID of SoftICE
_; E: x" `! i1 O1 J6 YGFX VxD.& d8 Y0 n5 `2 v% z; m1 ?
7 v1 G* H3 C- n% F, T5 e: c xor di,di# ?$ Q1 c2 r' v5 m, s3 g1 I+ @
mov es,di8 M: _9 E- }+ u0 b) W6 e' w
mov ax, 1684h ! Z7 K' r3 m# w. E3 L
mov bx, 7a5Fh ; VxD ID of SIWVID
# `& |9 l0 w/ t1 H6 i, [$ _ int 2fh3 @6 L' u. Q2 H7 Z
mov ax, es ; ES:DI -> VxD API entry point5 G- \) T' b$ N+ M/ n6 ]( M! P+ c) c
add ax, di
, R& Z+ W! \& J/ s test ax,ax
7 z9 @: [ v" y' a6 w; h jnz SoftICE_Detected- z# r; j6 E, ~
% @' u) C; j; z__________________________________________________________________________
6 L# W( m( Q% }7 ]4 R' ]/ ^9 {' m2 @: ? A O1 e7 n1 X: d2 m
( p0 f4 k6 D& }, U6 m* D
Method 05% I6 m5 P+ L2 w. f& N# F
=========6 m: e9 j Q. g2 u7 r6 t6 f: r- X( v
8 a( h& J* ^* }* l" w0 ]% J, [# g6 Z
Method seeking the 'magic number' 0F386h returned (in ax) by all system
, \2 _% `! ?6 [" d7 pdebugger. It calls the int 41h, function 4Fh.: d! j1 ~( k# |1 V6 ?
There are several alternatives. ' A+ R( F* @. V$ j% b1 L
/ ^! }! R7 l5 k* l' lThe following one is the simplest:7 F! a6 m1 a. S! K, P
2 Q) ^% \9 p7 b mov ax,4fh
( Z# O% Q, W, x8 o/ f3 m int 41h( Y# p* X5 t- `# f
cmp ax, 0F3865 [2 T) @: y/ E
jz SoftICE_detected8 U9 x$ ^: g& r G% ]4 y
1 e) d* ~1 l7 `0 P/ `
* |. O1 |2 g. G+ x9 n& S8 aNext method as well as the following one are 2 examples from Stone's
' U! u# X6 i7 x2 J" s4 o"stn-wid.zip" (www.cracking.net):* R/ A6 h7 N* ?
2 H. n' L2 m# {) ]
mov bx, cs* `6 E, ?' h" R* Z& I9 A% r$ B
lea dx, int41handler28 j) r% [9 U# L; F' ?
xchg dx, es:[41h*4]
) ] t0 M/ |9 W. n3 ?- m, `1 |+ g xchg bx, es:[41h*4+2]. O) @1 S& G. i" r& j% m
mov ax,4fh0 U7 N. s6 d% H; [
int 41h. w/ r; W* `- M* G( o
xchg dx, es:[41h*4]
: }0 S4 t. L4 e: w" N9 t8 A xchg bx, es:[41h*4+2], d' z: H6 d( E7 V
cmp ax, 0f386h* h' F5 E- M2 ]
jz SoftICE_detected
9 M5 _! W& ^. x! E, r# h$ D1 a. d0 s/ V
int41handler2 PROC
) ^' ^3 I+ B( q( Q1 Y) a9 S iret0 r" G: W/ d3 ]" e
int41handler2 ENDP6 d5 ]! S# G; Q, E- ? _" A9 F
( F" J5 D) {6 | ?, K" P0 d! X5 z- b7 B
, Z0 @3 o9 c+ n_________________________________________________________________________: L8 g% e! o! Z2 ~* g7 n
- ]7 H, ]$ X7 B8 j* @ q$ O; w2 E/ F$ f
Method 06: {8 j, a) O/ I5 ?9 p
=========
1 [% }" P* V- Q' f: M
$ \$ [% j& B. k( \4 V5 J) R& t u$ C9 L% k9 c
2nd method similar to the preceding one but more difficult to detect:
8 v& V8 f; e& Z9 g8 W# ?& y- \; E- k7 u
2 X3 l0 K" e3 p' R7 T' }
int41handler PROC
/ ^( s% x7 b* \( p& x; e3 _9 Z mov cl,al! D: ?% n/ ?5 [$ t- w" Q3 F; c
iret
$ [# A) \' P' {) J% Hint41handler ENDP8 S4 f+ } o) j
4 l. w8 P& Y$ E$ W+ {
, m' j U- }; b9 e xor ax,ax
1 x+ ~" s- i5 I9 l2 | mov es,ax
, U) F. E: {8 F* w mov bx, cs
, F% N! [, G+ F. F8 v) h lea dx, int41handler; T( O! s1 T+ _; u
xchg dx, es:[41h*4]9 }. z# ^3 [6 ~3 }: S: V; H* l
xchg bx, es:[41h*4+2]
9 J7 V5 X( I# v3 s) z; `, u, C; z. H in al, 40h
, ^: b0 v: c1 ^ xor cx,cx9 G% T0 W: q4 V" h# D% w* Q5 l, z6 R
int 41h
v6 e& V, O5 e) D* f/ U xchg dx, es:[41h*4]$ Q- n7 f ]1 r: W
xchg bx, es:[41h*4+2]
/ F- r L0 N3 A @) c* {1 c0 ]* { cmp cl,al
2 x2 i9 ]& h( t jnz SoftICE_detected* m: @) y. U" Q! P/ @& m
: w' |: R: G' k7 i_________________________________________________________________________
1 @( S4 t e6 Q! \
% }) Y! s2 F+ n( r( S U4 Y4 SMethod 07; }4 F' b# b' F) ^2 B
=========
, r) n6 C/ ?+ c9 w# `* Z& [, D4 K- t0 A0 B
Method of detection of the WinICE handler in the int68h (V86)+ T: z* U) }' u
0 ~3 y7 x1 C! L0 x5 X4 S- u
mov ah,43h0 a$ L) S% B# S2 M9 u2 A, g7 p m9 Q
int 68h
! [' b" `$ |3 V, U cmp ax,0F386h
2 n" W# y* Z& m( V$ ?4 T1 |) ` jz SoftICE_Detected" @6 t4 t2 D/ y
. C F7 a( K! c% ~- V: Q T, Z! ~ u1 _/ |+ f
=> it is not possible to set a BPINT 68 with softice but you can hook a 32Bit/ y; h; Z9 _2 O1 [1 n
app like this:
2 k: D+ R, T+ c8 P' \1 y' e( j2 V& M' Q, m/ }
BPX exec_int if ax==68
; R& }3 z, p2 a; a+ _0 J: ] (function called is located at byte ptr [ebp+1Dh] and client eip is9 j( t, U/ y! M
located at [ebp+48h] for 32Bit apps)
$ g- W$ \5 h1 Y) M__________________________________________________________________________, c% s9 P [. b
7 @% u# \, ^' d1 T0 B: W) O8 n5 |4 `8 @( h: T& z5 [
Method 08
5 s W9 v X+ M/ E=========9 `2 t; @6 j& q+ u+ Z' M) ^
. b" |5 d5 k* h( f ^+ o' B
It is not a method of detection of SoftICE but a possibility to crash the
, s( p# t9 s3 Z3 wsystem by intercepting int 01h and int 03h and redirecting them to another
& X3 ^& O! @, F" q" [0 broutine.
) v: J9 O9 m( V! _It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points+ s8 t; B! V; @( m, V( z# _
to the new routine to execute (hangs computer...)
2 N9 S; K" m: C9 d2 e4 h1 K# l7 X6 V3 O) j
mov ah, 25h
- G' f, I2 b5 j' O9 H" E8 G mov al, Int_Number (01h or 03h)
; d5 Z+ X" z8 _0 x mov dx, offset New_Int_Routine
* k9 f+ S3 V7 ~( ` | int 21h
% ?- g4 T! r4 e# ?' u
1 ]% v. |5 }4 J2 e6 X__________________________________________________________________________
- h2 ^5 ?: g. [1 E" \5 \: Y; S( a- J
Method 09
+ l8 r# H- S* |7 U=========% O3 W$ A. p: `) F$ w+ e- [
2 H: T$ W8 u9 Q7 {
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
* l' B2 A, ^" C% b+ Cperformed in ring0 (VxD or a ring3 app using the VxdCall).
) W. @# Q3 Z* aThe Get_DDB service is used to determine whether or not a VxD is installed
: J8 \ ~2 g4 L+ b. a+ |for the specified device and returns a Device Description Block (in ecx) for2 p5 a/ `. G4 a9 w4 r
that device if it is installed.
4 G: `6 h) a0 |
! n8 a, A* h4 j; Z8 \ mov eax, Device_ID ; 202h for SICE or 7a5Fh for SIWVID VxD ID' r% ?( E' x' I+ I; p- n
mov edi, Device_Name ; only used if no VxD ID (useless in our case ;-)* [3 r/ F. p# y( \ R) N
VMMCall Get_DDB0 A7 f2 y. m4 z5 z" g
mov [DDB], ecx ; ecx=DDB or 0 if the VxD is not installed
4 }" t1 q; M0 J$ T$ C! @( y& W+ z5 l
Note as well that you can easily detect this method with SoftICE:% j6 L8 i2 D% q$ w5 `/ _
bpx Get_DDB if ax==0202 || ax==7a5fh' u j: A0 |8 g$ f
7 W `4 [, v& _: N
__________________________________________________________________________. A' O! ]. m7 h6 w0 k
$ _" B. Q% ?5 X" Q X* N% {Method 10
]* @. B* ~# U5 P=========- D3 l* F/ {, @9 R+ W5 v2 V$ r
+ f( | Y0 ]" r, U=>Disable or clear breakpoints before using this feature. DO NOT trace with
`1 X$ T8 T, @$ N" C SoftICE while the option is enable!!7 M! T1 _8 v$ N/ r( ]
, i E U. G, M2 @. {
This trick is very efficient:
+ H/ L1 g) B7 R8 ~8 ~# C+ kby checking the Debug Registers, you can detect if SoftICE is loaded* j1 Z! K/ f+ E" M+ r/ m
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if4 w% A" ?; e' O* a" C
there are some memory breakpoints set (dr0 to dr3) simply by reading their
5 j) A) e* m! h# P2 \8 g8 M: t$ Zvalue (in ring0 only). Values can be manipulated and or changed as well
7 F8 y0 q1 R2 w& l% R(clearing BPMs for instance)8 u' u ]/ R+ z; @- n7 O
+ Q( `8 x( u. ^
__________________________________________________________________________# O0 v4 B2 i/ m# ^5 U m% h# u
+ @ F( m) F- M) X6 o1 I) H; YMethod 11
. T" i0 {5 O! L. Z2 X========= U. O! t! i' C/ U i9 t: E
4 b! g# z& j/ ?* q6 B. TThis method is most known as 'MeltICE' because it has been freely distributed
% _* B) q% q! ~2 q" f$ B' i( \via www.winfiles.com. However it was first used by NuMega people to allow g& L2 p" ~4 N
Symbol Loader to check if SoftICE was active or not (the code is located
' c4 D$ i0 h- O) z P; }inside nmtrans.dll).
; J. G9 O1 F. R, \+ d/ Q
7 H4 u8 S4 y e9 d: N! VThe way it works is very simple:9 c( l; v$ ?# q. r# b
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
- M9 m: C' u/ }7 s Y' q# h6 BWinNT) with the CreateFileA API.. V) K- U" x; f: H# y
# h, N2 A! x, x( _
Here is a sample (checking for 'SICE'):% Z. t9 Z6 Z9 m. ?$ v9 s
% u: y$ H1 L3 j6 ~+ a" SBOOL IsSoftIce95Loaded()
! h3 C) Q# @; q% g2 u2 L; O* B{- W+ g; [" F4 I' j+ a
HANDLE hFile; ' N& h9 U- b, G/ A5 R2 r
hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,4 W. N& C' t3 c! n B' F) H* T& j
FILE_SHARE_READ | FILE_SHARE_WRITE,+ e* D: z, M* L! F* a! Y
NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);3 x; B) P6 r) [( {
if( hFile != INVALID_HANDLE_VALUE )
: S7 v9 W7 w( c0 p, ^ {
# k5 o: `% {/ B1 {8 _) z' |9 c CloseHandle(hFile);9 ], U, ~8 k' b B
return TRUE;( s$ o0 t/ A- v
}
/ W8 | p, M6 ? O' H# Q2 c4 [" X return FALSE;; P" Y0 b4 d/ l" Q. O( z7 f
}
8 b* k) p+ [8 Q6 r q$ y- b6 L9 e) @5 I3 E. ?% Q1 @
Although this trick calls the CreateFileA function, don't even expect to be& r: A* Z- v! J& t
able to intercept it by installing a IFS hook: it will not work, no way!
# S3 o) W+ K; p7 X' f- nIn fact, after the call to CreateFileA it will get through VWIN32 0x001F
$ p, m5 w4 y, }: L' cservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)) U8 P2 D- W. Q: a4 \0 `5 L
and then browse the DDB list until it find the VxD and its DDB_Control_Proc
7 U' ~2 b* |2 Ofield.# |& x% w0 v/ m1 l& w5 m
In fact, its purpose is not to load/unload VxDs but only to send a
8 P8 r5 I& [4 R7 MW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)) ] V) J* ^/ B5 O
to the VxD Control_Dispatch proc (how the hell a shareware soft could try
5 q8 }7 P2 o& e2 ?& n5 G& ^1 t0 @to load/unload a non-dynamically loadable driver such as SoftICE ;-).
4 ]5 g0 n" g$ E& g3 zIf the VxD is loaded, it will always clear eax and the Carry flag to allow
. `) O7 I" ~( h# x: x7 f; Nits handle to be opened and then, will be detected.
& e. V! Z) m" NYou can check that simply by hooking Winice.exe control proc entry point
, ]- d) M( L# N6 @* J- }5 @while running MeltICE.5 l' ` {0 ~( U! `1 ?1 n
# ?* V; f3 w6 R- _, Q( n0 A9 L% F. v8 q& Q3 \
00401067: push 00402025 ; \\.\SICE# F6 \3 Q+ R* G5 @6 E( D2 ~
0040106C: call CreateFileA! P4 S0 A' n* k+ J. y9 h
00401071: cmp eax,-0018 ` q# U0 }3 ?3 W+ K# Q
00401074: je 004010915 V; r, }. f! b3 ~! Q
. C! b$ c5 X7 `
/ B, j5 O+ B: [/ C% v; g
There could be hundreds of BPX you could use to detect this trick." O" O; v9 e3 f3 ^; t: Y; u
-The most classical one is:
- r' ^) N# w: u: J& h# Q BPX CreateFileA if *(esp->4+4)=='SICE' || *(esp->4+4)=='SIWV' ||/ T8 L2 \$ d/ Z+ Z0 s
*(esp->4+4)=='NTIC'
) o4 w& H2 O7 J0 L4 O; e3 @+ k* g& g+ K
-The most exotic ones (could be very slooooow :-($ h# r0 A' D; h0 h; f0 [8 u
BPINT 30 if eax==002A001F && (*edi=='SICE' || *edi=='SIWV')
8 t% Z6 j \& y ;will break 3 times :-(8 `/ C1 j- I, @
. Y; U3 X& j: b0 W, V3 I7 s/ m
-or (a bit) faster:
3 }1 h- D! k% ~% F6 ]2 s" d BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
# F3 U4 z" O8 f0 [! @; _/ }
" j, G' [, f: R# E4 ^ BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'
0 U- w, o; G) h. w$ L) Z ;will break 3 times :-($ ], W: K8 _7 j$ Z- e% `: p8 Y
5 I0 @! o2 [9 f- f/ I0 o
-Much faster:
7 ?# T q2 `/ B! Y8 H" X2 @/ i BPX VMM_GetDDBList if eax->3=='SICE' || eax->3=='SIWV'6 v6 H9 F2 L) ?7 f- t- d7 m
' b/ c7 o. O( ZNote also that some programs (like AZPR3.00) use de old 16-bit _lopen* b5 p9 T8 y0 y3 u
function to do the same job:
8 m. Y" h6 t8 H
7 z! W6 r k) p) N, ~; I push 00 ; OF_READ a( x2 I/ ~& M( u, C* L- G
mov eax,[00656634] ; '\\.\SICE',0" x! `, M% P: W: `
push eax
6 u [1 y4 {. p* \* R- W call KERNEL32!_lopen* M: l0 p& \2 C4 r, }
inc eax$ @% w3 J) X+ C4 y) ]3 j+ ~6 _/ e
jnz 00650589 ; detected0 B; G) l& L$ H, M& ]" n
push 00 ; OF_READ$ E, |1 O, u: u ~, N& L+ k6 }2 C
mov eax,[00656638] ; '\\.\SICE'
A7 f3 L$ o( X- L0 X# O push eax) b2 g. c: p" A. v4 Q
call KERNEL32!_lopen8 B: U, M( R! _6 b, Z' d, M
inc eax- n5 P( i+ v4 O( F
jz 006505ae ; not detected
9 D6 d8 A, K; r# b8 ?3 D; s0 A$ d2 ~8 N9 s
x5 S% T% x- _( D2 S2 ^
__________________________________________________________________________# X. A9 f& Y* U8 ~6 V. F
# N- N2 M8 g( }
Method 12
: W. E k5 o0 d$ |4 X+ i1 D=========# G) q/ W: h' ?
9 a8 C1 k3 `$ I1 |2 Q( E5 ]
This trick is similar to int41h/4fh Debugger installation check (code 05
$ L. E. z- r8 I4 H/ ^& 06) but very limited because it's only available for Win95/98 (not NT)
0 a9 _: Q7 } Y( n- eas it uses the VxDCall backdoor. This detection was found in Bleem Demo.
1 d, o' r7 c- k' b: r7 a& {3 o6 n. c; K8 R- W1 p1 ] f
push 0000004fh ; function 4fh
9 K; x, e( [# W+ |. J+ L' M' W8 P push 002a002ah ; high word specifies which VxD (VWIN32)% Z8 g+ b* Q. ?0 W8 T
; low word specifies which service- D! A( C- `+ g' V7 F- V. @$ v
(VWIN32_Int41Dispatch). k5 x. N2 o8 c( q) B4 y
call Kernel32!ORD_001 ; VxdCall0 }1 F5 f l9 h6 n) k. W! c4 U
cmp ax, 0f386h ; magic number returned by system debuggers, Y9 J: ]" c ~ X$ N
jz SoftICE_detected
, T5 r( A) K. e) O5 a: ~; \8 T5 X7 r. i' t
Here again, several ways to detect it:0 Q: e" x! Q0 y- v" G" i3 ?! @
1 L2 R+ B R! W3 n
BPINT 41 if ax==4f
3 | l( B/ e& O# i: u F8 q$ Y" q# E/ g" Z: H5 l) }
BPINT 30 if ax==0xF386 ; SoftICE must be loaded for this one0 B4 L. Z* }" u2 _" H3 b; L" B# H
3 [" U! V8 d; D1 G9 u9 m6 |5 e BPX Exec_PM_Int if eax==41 && edx->1c==4f && edx->10==002A002A
* j4 O9 s( f# z& `( b) u
9 i1 Z$ t, F( g4 } BPX Kernel32!ord_0001 if esp->4==002A002A && esp->8==4f ; slooooow!( q. D+ F- s) I+ @. C# J
" x$ w) C! ^5 {. r0 h: _2 `: `
__________________________________________________________________________' q1 t! @8 Z9 J) a; S/ p
7 G# i1 w) l' |: \0 W: FMethod 137 ~+ z( ?2 ^# W7 P
=========9 z2 m2 R, S) |- K$ e4 G" H/ r& [- w
9 O2 m- f8 |- X" x$ [2 H( sNot a real method of detection, but a good way to know if SoftICE is% N4 e& q8 [, B
installed on a computer and to locate its installation directory.
: [* v, s7 W" [& O2 V$ JIt is used by few softs which access the following registry keys (usually #2) :
7 U& S: }! h7 b! e, F5 U# j7 z. \% z5 L/ {9 j' F- @3 v6 u& s, P: ]
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion J+ |7 o8 R/ I; y+ e+ w: U$ r
\Uninstall\SoftICE2 B$ b& u# q& R9 R. V6 I
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE* e/ e# `( v5 ~/ u/ f Y
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
) Z4 Z m! `% {0 V2 h8 F1 t9 h\App Paths\Loader32.Exe
' x S& I9 x- j/ j$ n4 x' [* U4 [6 W# u# V% U/ V4 f) f
3 x! |0 e. Z, [# FNote that some nasty apps could then erase all files from SoftICE directory) Q9 L% `- P1 `) H9 ^3 n
(I faced that once :-(# b. h3 S: u3 \( b3 D" S& ?5 @
0 m6 r2 y; Y' t3 A
Useful breakpoint to detect it:. e7 q7 ^2 ?- x8 B* `) B1 m
" @, ]5 k P& ^9 A BPX _regopenkey if *(esp->8+0x13)=='tICE' || *(esp->8+0x37)=='tICE'* B% ~) H7 @* ~5 w/ |
/ L! R& a/ C1 D9 ?! o- Z& T__________________________________________________________________________
" i+ Q+ q0 R/ H) p; F; d3 b- m: S4 o& K. h. O6 E: T6 O
7 d/ s% T2 S' |( xMethod 14 ! k6 K0 V2 H( y3 A2 Z6 o5 C
=========
' P/ Q! i# d6 j+ c* P
9 P H, F" d Z& QA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose9 m! d1 f4 n* E
is to determines whether a debugger is running on your system (ring0 only).8 _ h e. M8 U
( e& Q& F6 j2 D* L( Y% L+ J VMMCall Test_Debug_Installed
4 I+ L6 p/ U D k" M) m je not_installed
5 t/ l' j) O& |% Z% e0 y' Z7 O
! f) b! {- v2 j0 qThis service just checks a flag.
$ q/ B0 m4 D5 \& \0 N) F: K, P</PRE></TD></TR></TBODY></TABLE> |