About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>% p" }: Y  p1 c2 _
<TBODY>. R4 V! |* I% Z2 q% K: d% z' v: W7 X
<TR>- J  V5 v6 I/ @# z& _$ ?# \
<TD><PRE>Method 01 8 D1 L( c, `+ l2 [: E6 l* a+ Y
=========
- ^' x; f7 \: ^7 }" V# ]; Y, {1 J# ~. R5 O" L. n" w4 B
This method of detection of SoftICE (as well as the following one) is
! y; J  J3 O  o- ?) cused by the majority of packers/encryptors found on Internet.. g$ C, R& V# \% X" _& B
It seeks the signature of BoundsChecker in SoftICE
2 ^9 i3 Q" X$ I) e. Z% }3 d/ b6 l" ~
    mov     ebp, 04243484Bh        ; 'BCHK'
- M* M/ G- G$ m0 u$ ~) b    mov     ax, 04h% W: {( [& m. a' E6 s) ?( m# c
    int     3      
0 R, i& E3 a. ?    cmp     al,4
( z' n. a# M  l    jnz     SoftICE_Detected
/ b4 _  g' S6 z+ I7 i! K2 A( [! ?, x: g/ S/ F! e) ?: @! y
___________________________________________________________________________5 F# z9 s/ Q( N5 R+ L- |

2 \, `+ R9 E5 g- L! O$ nMethod 025 U9 g+ `) B1 L0 ?! \/ d% Y6 ^
=========0 Z& C: i3 Z/ r7 Q
- D' Z( _: f3 d) H$ u7 d
Still a method very much used (perhaps the most frequent one).  It is used# g6 `7 F# @. T- Y7 ?" H
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,
" U  q" T5 w- t: U( [3 [* U# f* nor execute SoftICE commands...' v3 v6 j; C+ J$ Q2 D/ r
It is also used to crash SoftICE and to force it to execute any commands( K( h# |2 f& \4 C, ?
(HBOOT...) :-((  
1 ?& B, u/ }6 k( @
6 ]/ B  D! h1 h6 A' C8 E$ x; }Here is a quick description:
. f& |! s6 {9 w-AX = 0910h   (Display string in SIce windows)( f* x  a  O. W6 x
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
6 }9 N8 d" j8 }9 }$ F) {  }-AX = 0912h   (Get breakpoint infos)$ R- k; x2 `  I* T/ \9 G/ u$ P
-AX = 0913h   (Set Sice breakpoints)4 b* l9 T0 s0 N* R; K' ?% j! K( A5 D! c
-AX = 0914h   (Remove SIce breakoints)
& W' V& z. q, }3 t8 i" P& b& M6 F* b6 F" K, h
Each time you'll meet this trick, you'll see:, h* R9 b) i1 d: _+ S
-SI = 4647h
) v; b' T6 |- F+ C, L/ T! l-DI = 4A4Dh3 G4 N6 Q0 w! y
Which are the 'magic values' used by SoftIce.$ c" M$ a* Y, b+ X
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.
( a5 {+ R. P. W/ N% ^: {. E: h, o6 J1 [1 o
Here is one example from the file "Haspinst.exe" which is the dongle HASP' v) @2 x: O4 Z& g
Envelope utility use to protect DOS applications:3 l% _+ @; u# g/ b  ^, ?5 i/ V) G
4 d& q- v0 Q& }

- w- b9 N, w7 C% A! ~4C19:0095   MOV    AX,0911  ; execute command., |- R" |3 x) z- p: S9 a) F
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).+ x1 I# L  ^/ Y7 N7 t& P
4C19:009A   MOV    SI,4647  ; 1st magic value.
, g& f7 W- v  e4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
0 G& ^% p/ N, H$ ~# D8 x; x4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*); N! W* C# e. ~, o9 _& d
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute$ q; R2 ?3 M% k
4C19:00A4   INC    CX& K% t& F, p+ L5 s5 j! @% {
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute: E5 N* c9 V1 M9 O
4C19:00A8   JB     0095     ; 6 different commands.* ]% W6 y- [/ v; c0 _% d" g& n
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
. M" U8 i6 _. y% a4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)" f$ J+ Y$ M& r$ n$ t

# J1 ~8 m) [' eThe program will execute 6 different SIce commands located at ds:dx, which
3 Q) @$ N! k& ]0 Mare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.+ x+ {$ W3 u* V2 p& U6 d7 {
$ p9 M6 v3 Z& A9 \
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
* k6 n0 w, M5 z' o0 \___________________________________________________________________________9 X0 t/ j- k& K- U) U6 P
- i" Q4 q% a6 |- o, _7 f4 Y$ u
- Z3 }& p6 \6 x' s' O: l
Method 032 X2 a4 f7 ?: b* \8 b# i# q
=========
7 Q2 d; v! F9 M# ?% u
3 l) d$ j: j* f; kLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h" T% _: O% j, ?" H9 G+ H! }
(API Get entry point); a+ B0 X( c8 @8 \* m+ f3 E* u# ^
        
; e9 i1 m6 p  M, U, O, a
2 B" ~( e7 g4 w/ J! ^4 h    xor     di,di
$ R7 r/ r2 j* G+ [! _; M    mov     es,di
0 I% ^3 B  v' i' C/ C3 q    mov     ax, 1684h       * S) G8 {' O5 o1 P8 A" H
    mov     bx, 0202h       ; VxD ID of winice% S9 x6 [5 S# l2 P. v4 ?+ ?, h
    int     2Fh
/ b# O( Q4 Y: }3 Y( i    mov     ax, es          ; ES:DI -&gt; VxD API entry point/ i, O2 g1 N3 j4 }$ F5 I( k5 v, _
    add     ax, di) U" N0 k7 _5 L$ H8 Q3 [: J2 q
    test    ax,ax/ s& @8 Z; U: O" [
    jnz     SoftICE_Detected, a# N! q! ?  w5 s

! \  v, K: @8 D* I& r* ^8 i___________________________________________________________________________/ v5 I. c3 g: N7 k! R

& B1 s$ z0 B+ D% c  V0 VMethod 04; j4 H  X0 R3 `/ H( P  V
=========
% L/ t% M6 q, p
) x4 `# i! G4 j- {Method identical to the preceding one except that it seeks the ID of SoftICE
6 u7 n/ C. |! R- C. M; u, tGFX VxD.
1 w5 g9 [2 v3 T/ H* n3 w
+ o1 h1 j# b. }5 F    xor     di,di
" U  u2 X/ ]  \+ T0 S  h    mov     es,di3 V7 y/ R& ?5 M2 ]' Q9 a
    mov     ax, 1684h      
0 P2 e9 W+ N9 J! R5 e  F, {. n* z6 L    mov     bx, 7a5Fh       ; VxD ID of SIWVID
% T; J& _8 Y; d. x# f8 b$ O4 U0 H4 b    int     2fh) C  {/ e# [" \0 Y: n- Y
    mov     ax, es          ; ES:DI -&gt; VxD API entry point0 C- s* }# L# @, Y3 V0 {( v/ t
    add     ax, di
5 G5 t9 B6 K+ v2 _1 x    test    ax,ax
& f% p, C. n" x0 j    jnz     SoftICE_Detected" N' h+ o* \4 N

6 t6 z, @! @3 [) P' ?__________________________________________________________________________
- @, @; C/ p  n
1 G( {9 v1 [, p8 L( D- p9 C+ V0 Q$ Q# ^: o; E* Y
Method 05
. u; \5 x! x' w=========. m3 H' y' O/ e8 m
0 f- y& `/ b$ ?  E
Method seeking the 'magic number' 0F386h returned (in ax) by all system
5 J- d0 F4 T' }* U4 u  f) Adebugger. It calls the int 41h, function 4Fh.- s, X1 z  u7 A& n/ T6 D! O
There are several alternatives.  
; {/ z$ l# z% y( C. O0 Q
% `, S/ u4 R3 U6 \! q& j1 aThe following one is the simplest:- u2 D8 H$ H2 J6 ?3 i; m

2 J( a( C- m# a$ k% k1 f1 {% j    mov     ax,4fh
; U) g" j3 s# M# i% k5 i    int     41h
- f8 R. F- n, w1 @8 u    cmp     ax, 0F386
* o* V7 M" H. [  l! l' {    jz      SoftICE_detected
' a' l9 ^: S+ _. P' o# N; O* R" I7 P3 w8 b- s

. R& m$ S; h  [& ?8 _8 SNext method as well as the following one are 2 examples from Stone's ( M5 [4 o& g+ V9 X; }
"stn-wid.zip" (www.cracking.net):- h5 Y, u5 l7 ~) \

% q! u8 h  e" O+ K    mov     bx, cs
, @: z0 g; M1 q7 F6 i/ G1 l* L    lea     dx, int41handler26 p  o% r$ w7 h8 n: M
    xchg    dx, es:[41h*4]& Z  h" }: _( O; o/ F% v; S/ j
    xchg    bx, es:[41h*4+2]- r8 ^( s9 [* e4 P: c
    mov     ax,4fh
' p+ K0 s' M- K2 F# L9 u    int     41h
( C( J  W4 S2 Y3 W3 t    xchg    dx, es:[41h*4], x# b: l. ?' o6 D: F7 y
    xchg    bx, es:[41h*4+2]" ]" i% D2 u6 k2 J
    cmp     ax, 0f386h8 i/ [  q3 M% E- @- P" e) J
    jz      SoftICE_detected2 r+ V' X: }( l+ Y8 e

6 N9 i& d# T% T7 rint41handler2 PROC
5 T7 L+ t' _! E: o' R  a7 l3 i/ s    iret3 N8 {: V5 ~$ p+ ?- h8 W- C
int41handler2 ENDP
: U% f3 N- @7 @( K! E+ X; F* z# C! l2 q% {$ N3 E8 C7 d; l
8 g3 o# F3 h" w# O
_________________________________________________________________________6 ^; ~* ~6 @+ r% Q. t

. ]  \+ m3 T7 V2 b  m' }/ m9 Z, J  M( I, [/ S
Method 06. ]! K& a8 M2 A- X3 b5 d+ b
=========6 D8 L# M- X* h, i
% k9 P- H1 ?0 b; a5 r8 x
& |+ |0 b/ s+ R1 w
2nd method similar to the preceding one but more difficult to detect:
- J" T2 N- C% K: l: s
* H* G' r+ E& _, B8 o& g
2 u5 u( T6 `# i# Zint41handler PROC1 ]+ F3 ]7 P  F' C) D. D
    mov     cl,al
8 h' R- h( h) v6 P: h, B7 e    iret
$ D' ~1 ^2 Q$ Z8 pint41handler ENDP
5 o/ p& Y% t' ~0 Y4 B  q
4 b2 _& H  \9 W' J3 I  M' M- m6 L
7 I9 ?+ F: Z# T& A* h    xor     ax,ax  \' {, V8 h6 F$ E3 y& y3 V6 e
    mov     es,ax3 c  F1 ^8 |0 C5 J8 l1 X/ ~
    mov     bx, cs; r" t& l3 h3 ?9 A% ~' K0 w
    lea     dx, int41handler/ r) `! l+ {& m) b6 F/ n& g
    xchg    dx, es:[41h*4]5 d5 X' W/ L( P* n+ }, F
    xchg    bx, es:[41h*4+2]
" x! V+ B, p  O) X, ?6 C; `" k) L5 i    in      al, 40h
9 w* O  N/ K1 ~    xor     cx,cx. q$ P& M# @4 D- w0 Y' k/ Q
    int     41h+ m* B; R* @+ }. V9 `9 l6 |' g9 m) z
    xchg    dx, es:[41h*4]  W& ~& u. b2 e; M6 Y: Y! [
    xchg    bx, es:[41h*4+2]( V' ~. n6 P2 q8 K/ l+ @4 n
    cmp     cl,al, |" Y# [6 `# r3 f
    jnz     SoftICE_detected1 P& T) c" g) ?

1 D# R9 F% f! ~. I7 e) Z_________________________________________________________________________
5 V( W" z3 G$ s
& v- R/ O% w7 H0 EMethod 077 o4 z& ]6 d" A
=========% L* l5 |, n8 B, l* b: `' [, R

+ O1 n  a% u2 L  t3 o2 `. _Method of detection of the WinICE handler in the int68h (V86)3 A0 p% {4 [8 C& ~) `! T+ i
* B  \+ \+ x( v- B1 y
    mov     ah,43h
8 ^5 h' \3 O4 S8 |0 G. B    int     68h
, F# L2 X8 v, L0 S    cmp     ax,0F386h9 L7 s# J" G# a: Q( P3 n
    jz      SoftICE_Detected
# l6 Y9 r( W5 C4 s
% f3 C$ g. u9 m+ a3 i
  V: t) b1 m2 w" K9 j) y=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit$ Z, j4 B" e1 d2 k& ?& _, q. k
   app like this:/ ~- N; T) N9 r; G( ?
& E- v- Z( q/ v" }. G# t
   BPX exec_int if ax==68; b2 s+ c# |3 s. A9 n
   (function called is located at byte ptr [ebp+1Dh] and client eip is, `* k( L5 V' d! f: N( h8 X
   located at [ebp+48h] for 32Bit apps)
; I; g3 X. V* Q4 S3 ?7 y+ n__________________________________________________________________________
& d+ d! V1 r7 _( e
) Z/ W8 P& D/ O$ @. F$ _$ X" P- X2 D
Method 08
, M- C, b/ n6 \& _1 d2 Y* E6 G=========
, ?# h1 E/ ~6 S. T, _1 L& i# S4 B9 J0 u/ d0 W" l* m' T6 s
It is not a method of detection of SoftICE but a possibility to crash the  [& S# U( S# t4 t8 }4 {' u
system by intercepting int 01h and int 03h and redirecting them to another
# O! {) _* e3 F3 iroutine.2 \5 j1 x' F& T5 t
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
2 _* K5 K: r2 F4 ~8 m" }4 Ato the new routine to execute (hangs computer...)
/ S$ f# d4 E$ q8 ?, [1 C$ h4 M$ |" J: d
    mov     ah, 25h
  S6 d7 R) X' T1 ]: L    mov     al, Int_Number (01h or 03h)
: v* {1 V+ g# N0 R+ C6 ^    mov     dx, offset New_Int_Routine6 B5 k8 b; X) A! i8 X; @" H$ y, \
    int     21h
$ y9 _  W5 s7 Q8 L9 z, m! V5 o# d7 z- X" d- ]5 z$ A
__________________________________________________________________________
  B- U1 ~( D6 y+ @9 j
3 E+ x4 B9 E- W2 K1 w* aMethod 09
* z5 T5 I& V7 |6 w=========
# e% v( d; d0 B0 Q7 J: b& _$ J
2 J4 j; |' ?0 J* WThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
# B8 R$ L! J  t% mperformed in ring0 (VxD or a ring3 app using the VxdCall).
) F) K: V5 {9 E, \7 f0 PThe Get_DDB service is used to determine whether or not a VxD is installed
: W: J& I+ R) d) O. n! a- nfor the specified device and returns a Device Description Block (in ecx) for
% u- [- s9 Z& H' \+ C9 |- v2 Xthat device if it is installed.
) F* d+ k# j# ?4 f' T5 r% F! z/ P. `1 w3 f. x
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
: h: \. j( T; G( o& l/ P   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-). E) ?6 K5 |7 h' o) u
   VMMCall Get_DDB" [* A1 a1 C1 v; E) F! |3 f6 J
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed" y. \) t& m$ v. y; o, y! I" [
+ A9 O& t% k2 g
Note as well that you can easily detect this method with SoftICE:) j. {4 T/ o5 G
   bpx Get_DDB if ax==0202 || ax==7a5fh9 D% B# W4 V4 G' W& m" J
& O. i) G. [2 A. a
__________________________________________________________________________
% [" A# D. q7 r5 x! n" `2 G) W2 a& z8 b* O7 k
Method 10
# a4 d0 h/ v. b=========$ h- D: h# ?/ I5 ^) I! A/ X
  x- M5 F0 }( ]+ M  J0 T
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with6 ~% X2 V) r: i5 s5 _
  SoftICE while the option is enable!!# S2 A5 \& ]7 x0 @0 g

  V5 O0 y/ L8 x# W( v' f; w- ^This trick is very efficient:
! D3 S% i5 n( ], Z8 w( Y# Wby checking the Debug Registers, you can detect if SoftICE is loaded+ o! ~7 y0 v& f3 v+ _0 X
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
4 t2 G, C# s- b& }* k4 w/ ?4 Y& [there are some memory breakpoints set (dr0 to dr3) simply by reading their1 C  O7 D/ V. G' R. W! u! O
value (in ring0 only). Values can be manipulated and or changed as well
1 D# j, L  L& `3 t(clearing BPMs for instance)
* r: ~, [0 E8 A2 ^5 C! U
4 N3 W' m! s, g2 s! h- b__________________________________________________________________________
! J0 e) v  P& B  h+ L2 t! E9 @/ W/ @0 W: U# ~2 L: `' ~
Method 11
; G7 \- T( K7 z0 M# X5 w) |=========/ A* W/ N( x  W5 m) Q$ v5 `
1 x. l- \8 }9 ~8 [. {8 U% C
This method is most known as 'MeltICE' because it has been freely distributed
+ G" z7 l) C9 Fvia www.winfiles.com. However it was first used by NuMega people to allow
8 Y! m7 f: U/ `# ?6 SSymbol Loader to check if SoftICE was active or not (the code is located
* T! d6 M% d* N9 R* S5 Winside nmtrans.dll).6 U$ Q2 W! Y* U3 y! H5 [
5 _& m) g" w7 x2 f. a5 a
The way it works is very simple:7 o$ }% Y) ]% w% s  W; v% h: N
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for& y* c2 Y6 W6 R* x9 ?
WinNT) with the CreateFileA API.& b, Y4 b1 F- T9 f1 [0 r

) t. W( w" P# ^" n  HHere is a sample (checking for 'SICE'):8 I+ J" |0 F2 P" `+ u
# S# b3 Z; `+ L  W* O6 z  T
BOOL IsSoftIce95Loaded()3 W& V2 Q1 I$ \! q. a. I2 ?4 o
{! S  B" I, y# A- ^* w3 h
   HANDLE hFile;  
1 q7 l  m! L  d1 r+ b+ {3 @3 P3 A   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,& H8 V' H" x& ?# t$ [. w% y8 a, c  `
                      FILE_SHARE_READ | FILE_SHARE_WRITE,
4 z$ i. y5 P1 H" Z$ u0 X                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);0 t0 M4 e3 `' m& P5 C" W
   if( hFile != INVALID_HANDLE_VALUE )
8 `; v3 z/ n& C/ o& F# o) B2 x   {
9 W/ T/ `* A5 E4 p, H- }! b      CloseHandle(hFile);) ?3 s5 J& W; t$ D. r# ]6 W0 x5 Y$ x
      return TRUE;& {  J  j; J. i. G" n# ]9 g! t5 O
   }
2 E+ h) C' N8 T3 s& F. b   return FALSE;$ q! w/ }' W! u! d# e# J
}" h0 k7 N  c/ D
# ]) j: Q2 P7 L6 @1 K# I; B" _
Although this trick calls the CreateFileA function, don't even expect to be! @# Q1 F5 |# d' l. |2 u4 C3 Q, \  G
able to intercept it by installing a IFS hook: it will not work, no way!
4 ~" R9 b4 P7 \  T5 [* G5 A0 A( HIn fact, after the call to CreateFileA it will get through VWIN32 0x001F
! g& e5 [0 j/ h; yservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
; R& {" y% \0 E; Z$ band then browse the DDB list until it find the VxD and its DDB_Control_Proc
" M/ R* H% K9 t" m( ^* M% cfield.+ s/ @- P& V* Q0 }  D
In fact, its purpose is not to load/unload VxDs but only to send a
$ y! D3 O3 {$ A1 PW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
7 S' N8 ?, }3 y1 q, y# Dto the VxD Control_Dispatch proc (how the hell a shareware soft could try6 ]& A$ F" t9 m- j  q
to load/unload a non-dynamically loadable driver such as SoftICE ;-).
) }# J: S3 O* _6 @. n( u* x& DIf the VxD is loaded, it will always clear eax and the Carry flag to allow; j5 p$ [, z1 t$ f" d: N- \( S
its handle to be opened and then, will be detected.
$ |2 y0 j  w6 B6 z2 P' f/ wYou can check that simply by hooking Winice.exe control proc entry point8 b. s1 ]- Y2 L; j5 x
while running MeltICE.# i* }2 [& b# A5 G+ P& j

) w1 |3 \' T, s5 S, P& K. S% e7 l* ^( C% K* Z
  00401067:  push      00402025    ; \\.\SICE
/ U, H8 K& |0 m  0040106C:  call      CreateFileA% v- u) w9 ~4 W9 o; d- f
  00401071:  cmp       eax,-001
  c; V# _7 u  @+ F' V5 w  00401074:  je        00401091* C- ]3 V6 I( v: U( q$ J$ G8 Z

7 o. C. w5 a. f: Y; ~3 B/ [0 V* v; f& V8 K9 |: F
There could be hundreds of BPX you could use to detect this trick.1 A5 T! z# P3 [# `
-The most classical one is:* J1 C; F; x6 U, @' ?1 B
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
* E  V7 J2 }% I8 u1 u1 ^    *(esp-&gt;4+4)=='NTIC': S3 D- b  C3 S1 }/ _

! b  k% U) C8 a# J  b- H-The most exotic ones (could be very slooooow :-(- o  ^: n# H* U+ j7 G
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  3 K( o# G+ z. h* ^3 M7 [% V
     ;will break 3 times :-(
5 u1 B/ e& v4 g! l& Q; M- E. n8 B9 \" t$ K/ H, w  i4 h
-or (a bit) faster:
" U* e. H) B# F6 b% w$ F8 f   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')4 M+ k5 i: X; J, {" ]( O: x

& J! g/ x; t" G, a+ U# J   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  9 `. n1 w% r8 F5 D* D/ K
     ;will break 3 times :-(' R& b9 w6 {) D) R5 m
0 P& h  C, e( N- Y/ V4 V
-Much faster:. _7 {$ ~: \9 {+ H
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'2 \$ n3 B8 V6 q3 p* j

6 J/ n# D" {) {# U& wNote also that some programs (like AZPR3.00) use de old 16-bit _lopen
; m! s  J- d" ]+ D$ }. Ufunction to do the same job:
9 V* x9 G' k% R! Q7 E$ Q/ a+ R) d( V: g( s& Q' `
   push    00                        ; OF_READ: G5 U; ~7 _' k& _6 @; _
   mov     eax,[00656634]            ; '\\.\SICE',0
6 z! q2 ?0 f  M% N0 x   push    eax
. j( v8 O7 @; X# m3 B/ J  H9 \   call    KERNEL32!_lopen( I( u$ t) j  j$ r, @: c- k6 {7 G
   inc     eax
1 i# s$ |/ e2 u0 J! w   jnz     00650589                  ; detected
9 T3 m$ e& r+ Q6 O0 r   push    00                        ; OF_READ
; m+ e0 y: |+ [6 l   mov     eax,[00656638]            ; '\\.\SICE'
) F$ X: m8 Q( R1 Q   push    eax9 X! W! j8 }8 @8 K: y- A: v1 |
   call    KERNEL32!_lopen5 v2 K3 Q; F. d" `
   inc     eax+ T- a6 B' b/ c. p4 w2 d5 {: Z# y& K
   jz      006505ae                  ; not detected, C9 `1 h# J0 f# V. r- U

( x- G2 h3 ~, d; Y; b1 ]) C+ ]& L" P$ |- n' s0 @0 x' Q
__________________________________________________________________________
; \3 M; }" Q8 V; c
# L7 i; h2 j2 YMethod 12
+ h/ j  ~$ Q2 z' z. A2 C1 b=========
# X4 `6 J! t* w2 H1 G% B! B3 \# {* H# D- n# z
This trick is similar to int41h/4fh Debugger installation check (code 05# T; L) n9 {5 d" }3 s# d0 o; `1 f
&amp; 06) but very limited because it's only available for Win95/98 (not NT)
- L+ d6 q( P/ @+ z, S$ A& Xas it uses the VxDCall backdoor. This detection was found in Bleem Demo.
& k7 p0 _- k* h7 e! Z6 e( I
. C2 d7 M0 n9 t4 ^8 }& ?   push  0000004fh         ; function 4fh
$ B7 C$ x- K" u7 H8 R   push  002a002ah         ; high word specifies which VxD (VWIN32)# R, G. C8 E  ?4 ^9 i! j$ h% ^
                           ; low word specifies which service
9 Z: Q4 A/ y3 w                             (VWIN32_Int41Dispatch)
. }; `' q$ ~: D) A5 A# u: {   call  Kernel32!ORD_001  ; VxdCall
6 `/ m; t7 O9 [6 H5 y( A   cmp   ax, 0f386h        ; magic number returned by system debuggers
9 {3 [" X% W9 V- S4 W; m: G  ?   jz    SoftICE_detected$ H$ E7 J1 X+ B- ^! G2 r6 W* _: E

" [+ a) V! Y# L) B# q' `% n' u( w( eHere again, several ways to detect it:& }$ K$ i' W2 j$ E# w; `2 J9 i
. t  F( J* I. i9 [& W
    BPINT 41 if ax==4f# ]1 V" ?. v6 P) P

( ^4 T7 d9 r( B" [) Q) L    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one" L# H* I: ]- W, y: R' Z

# l5 w- q' L$ F% }/ l' O5 E0 r    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A2 B  r3 O. [% b5 R6 ]

9 f8 P9 I2 b, {5 C7 m- E    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!( R9 a# R9 S9 o9 f2 H) k
( A+ t$ g; _+ I( q5 k5 A* Z7 L
__________________________________________________________________________
1 b2 w: z1 f. N( {6 C5 F; b" @- p! _9 A1 X% x
Method 13
. K) w' x5 [6 e, R+ Y( r( |  g4 ]=========$ l# _* K; h0 y8 b
7 G4 g( k% m. r2 i0 d  I. [0 ~9 G
Not a real method of detection, but a good way to know if SoftICE is
+ @0 E. T% u7 I) oinstalled on a computer and to locate its installation directory.
! X, E! |+ k2 @+ R( V4 gIt is used by few softs which access the following registry keys (usually #2) :; u: I3 }  A5 j: I- N" T

/ u" B3 V9 x# J; s/ p! `-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion6 a/ _9 a* C' W7 u3 Y
\Uninstall\SoftICE
5 |5 P0 ^2 L% q0 _. X8 x3 H7 Q# s-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
6 A& W6 a9 y( n/ F0 }/ N$ n, O3 u+ g-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
6 c4 ~3 S8 J! u3 a$ s9 T\App Paths\Loader32.Exe1 y# ~, O4 k- L4 j. [; b
9 Z/ D0 A) i- i2 B& _4 Z! T' P9 j

7 _9 F7 c# b, Q0 l5 c$ ENote that some nasty apps could then erase all files from SoftICE directory) u0 |' _/ J2 W( ^" U: B
(I faced that once :-(( V' I4 \' c) H/ k" _) n( g
$ E' a% x3 d5 m3 t& K3 D9 w
Useful breakpoint to detect it:0 L" }3 [( ?  H: ^( p- }- L
4 N* U7 d- P2 @/ q
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
2 L1 H: F  S" W8 C  U3 V
8 J% l6 ?- x8 N9 k: T8 O( Q* G( Z4 v__________________________________________________________________________4 F. N8 D4 b$ N5 `

, ~9 t; g9 ~2 B7 i/ ]$ o: u" Q0 H
! x+ W- C  M% P% `$ W% y2 ZMethod 14
" {$ E; Y8 F6 r" m4 ~$ \2 Q/ N=========: `5 V! w; O" x! x

' H1 F, |7 u% G7 \4 mA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose; z- b# z6 B: Z# U- Q0 V
is to determines whether a debugger is running on your system (ring0 only).
9 O% Q, r4 {3 D" a* h3 k: ?: ]* j& U. ?# O
   VMMCall Test_Debug_Installed+ Y$ Z/ X* J. n: t
   je      not_installed
6 J" z7 E& |% t8 L: @& Y
! {* C) b1 J& iThis service just checks a flag.* [8 T/ a  J/ A; J- H2 @  r4 p
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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