找回密码
 注册

QQ登录

只需一步,快速开始

About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>0 B  U2 Y& L5 i2 B0 k
<TBODY>
4 ~8 P- D( ~0 G- I7 {<TR>
  f4 i% O3 x* {6 M<TD><PRE>Method 01
) Y1 @0 C7 S! v% e=========
0 C0 K, P) R- C( e2 H' c1 f0 q. x/ ~& u7 m. h$ I  J
This method of detection of SoftICE (as well as the following one) is4 W/ t# N- x' j) a* n
used by the majority of packers/encryptors found on Internet.; J8 a1 M7 @( S+ U0 z" H
It seeks the signature of BoundsChecker in SoftICE# j- d0 J  i# ~
4 |4 w3 ?3 G9 `0 ]2 s+ W8 v
    mov     ebp, 04243484Bh        ; 'BCHK'
) l. G6 k$ ~$ Y6 z3 d" h& }    mov     ax, 04h3 J8 ?( ]  m0 @( O; b- |
    int     3      
8 G# D5 p% T; j* W    cmp     al,41 Q7 z: E9 b& L$ P+ ?: C
    jnz     SoftICE_Detected  P$ R$ z  L/ ~; E$ S
% h7 c/ W/ }' l  V* A( C
___________________________________________________________________________9 m1 F. ^9 l' H1 Q1 z" E
5 _5 j! w- @9 e' D4 G! Y
Method 023 d* F6 ?/ I8 ~' g
=========; D. v: F. o5 e
0 y. X. r1 z. }
Still a method very much used (perhaps the most frequent one).  It is used7 c! K0 u  K- L
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,7 r; i  t8 U: m: F9 }/ y' A9 M' b
or execute SoftICE commands...& {" o, ^# ]6 u0 f+ \0 f$ @
It is also used to crash SoftICE and to force it to execute any commands: k) D4 i( }! b. t$ f& D
(HBOOT...) :-((  
3 E+ _! s* P0 `9 h' e% \* B9 N! b! g  ~9 O9 n  a& ^4 q* O
Here is a quick description:7 U+ o* Y4 c) V% C' g& b
-AX = 0910h   (Display string in SIce windows)
  |; Q+ T/ s7 K-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)$ {7 g  B) |: M( R' _
-AX = 0912h   (Get breakpoint infos)
- F7 H, b$ r7 i8 S* {3 U0 K) u-AX = 0913h   (Set Sice breakpoints)( ~  l1 o+ D9 B  J4 P7 J# x$ r
-AX = 0914h   (Remove SIce breakoints)
8 ^# k  S, Y* j1 g( @: v7 a* H
3 h6 m$ [( M* \Each time you'll meet this trick, you'll see:
! s( e& S- u% a2 L) b  T. I-SI = 4647h
' J9 Y: H# D# P3 V. S- ]-DI = 4A4Dh
7 d+ M4 d; c2 u) {Which are the 'magic values' used by SoftIce.# N' H9 o$ H" M
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.* V/ h' r% ~- z8 i9 l' v
, N) v5 b- i% e! j  N' o* P
Here is one example from the file "Haspinst.exe" which is the dongle HASP, S3 T6 h. j$ \% d$ R( g
Envelope utility use to protect DOS applications:
; ?5 P4 d& Q: K% d& I% ~+ b  K6 U! E, n6 x2 u; H9 a4 @, K% x5 ~

7 M2 e+ ^) w8 c' t5 H0 K4C19:0095   MOV    AX,0911  ; execute command.
3 d* u1 g8 H  v4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).5 h. h7 }, L4 y- b) O* K/ n& b1 K9 z
4C19:009A   MOV    SI,4647  ; 1st magic value.
, h/ S8 y$ P, r: B% A! u! q4C19:009D   MOV    DI,4A4D  ; 2nd magic value.; e. [3 W; o  a6 m
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)& h( w& s$ A6 r4 J
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
# ~  A2 m$ M+ J4C19:00A4   INC    CX
/ O+ i9 K# r0 Z) k9 r' m4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute/ z" K( S6 P2 p: K2 O* P
4C19:00A8   JB     0095     ; 6 different commands.7 Z" k6 E9 r& v; p
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.% m2 Z* C# L) ?6 G% ~2 B7 N# J
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
! W6 Y: d( T7 t0 v% ]! x) W/ m
% k# P: L4 S4 e7 N5 HThe program will execute 6 different SIce commands located at ds:dx, which
4 ]1 O  q' M" C/ a1 ~are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
9 n/ n3 R; }; e: v/ A0 e4 |7 U0 W7 J& Z) e# o. p9 s
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.  j' Z4 O2 R" C' v( u! n2 Y
___________________________________________________________________________
7 ?0 G  c9 `: |0 S! W* j5 W( m8 V( ^
% x- ~6 _' L# R7 h- x7 @
Method 03
" x, U4 D" Q$ T# n6 E8 [1 {=========
. y- L7 _' U9 |$ d4 R
& m7 A: z) o9 C0 ?0 ^/ P  b6 ^Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h. a% j! K6 M+ i
(API Get entry point)/ D4 w# ]. h' S1 d+ K
        
( R6 o& @8 z: Z2 v, C( S5 m
2 P" Z) z# k. i' b    xor     di,di
( Z9 Z$ s/ q2 L7 D& m; q    mov     es,di3 x, Y+ }: z+ D2 }
    mov     ax, 1684h       $ J% }, X1 g* S$ `  V+ H: ^" c5 m
    mov     bx, 0202h       ; VxD ID of winice
$ c8 A! @! ]9 z7 J    int     2Fh: ^5 ]( q, ~; }  I! x  n: z7 S* K4 W
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
# k4 |- p) m. T    add     ax, di- ^+ J: v7 Q- b6 @
    test    ax,ax
2 l' u  r2 A+ A7 _    jnz     SoftICE_Detected1 c8 a: g7 L4 n- j8 h" y

2 B3 F" W. Z0 m* V" W7 l___________________________________________________________________________" G. y  D5 P1 Z- M: h4 t. L
$ _# o% d7 g( v
Method 049 |: {- [% e3 o2 s: L. p+ _. J1 R
=========2 }9 \7 T# i' k6 p9 ^5 d, h. A
) Q! w  \+ H/ T( l9 B
Method identical to the preceding one except that it seeks the ID of SoftICE
" E3 _6 {  q1 }GFX VxD.6 ~8 U5 f- ^% Q- ]2 j' m/ V5 c+ g
4 @% W* E# g! X$ A
    xor     di,di
/ Y0 g* T' T8 E/ u! _0 s3 |    mov     es,di& H: U1 ~! A4 \% o; e% q
    mov     ax, 1684h       + \) i7 _" _! {" w
    mov     bx, 7a5Fh       ; VxD ID of SIWVID0 [* I8 q5 \) x" g
    int     2fh2 F& v: n, n' ]  r- i$ |/ p/ j$ ]8 C5 r
    mov     ax, es          ; ES:DI -&gt; VxD API entry point$ D# e, @: N: Q  p" Y0 h, M
    add     ax, di4 f9 |% v* l0 |4 X% O% X& }: C6 E
    test    ax,ax$ B# O: p5 d- a3 u! ^  O
    jnz     SoftICE_Detected2 [8 H/ H: _" A: N
3 j/ |. L* O: W' A
__________________________________________________________________________
' g9 D: L" }% \1 w8 `7 |& ]5 @
: t% I8 \4 b( F. ~0 ~" ?' y# R: e. B( b7 e4 w# R
Method 05
( V7 t, d2 S; Y2 ?# J: d=========
* l2 r. ]& i$ g. u; e9 s, L5 `
" L( {' D8 g: n) cMethod seeking the 'magic number' 0F386h returned (in ax) by all system% m9 ?6 d7 B& @: L- I. K) h, ~
debugger. It calls the int 41h, function 4Fh.
8 [2 L' J3 [  \There are several alternatives.  % {! F! Y+ z. S! j
% y- e' R( ^! X; y
The following one is the simplest:3 V1 }% g9 E/ |8 t9 Y
# A$ D+ P+ k0 [& |7 y+ D8 E
    mov     ax,4fh
' d) [! O- I  G, ~0 N* o    int     41h- [  [9 a' M8 \8 _* R
    cmp     ax, 0F386& D2 C4 ~# j, O( s3 ^
    jz      SoftICE_detected
& M+ T$ L5 ^% k9 f# q, G' m% S0 K  W& a1 q
1 |, h4 X! r- O' x  T
Next method as well as the following one are 2 examples from Stone's ( b6 M4 S" a! Z
"stn-wid.zip" (www.cracking.net):/ G; P$ C) R1 K, {3 P% }9 D
+ U/ _: h7 n$ p
    mov     bx, cs$ q2 I2 x. O. e" ]; b; P$ M& f3 i
    lea     dx, int41handler2
2 S$ P1 b! o. [. ?1 Z& e    xchg    dx, es:[41h*4]1 t2 f( n0 x3 G" F
    xchg    bx, es:[41h*4+2]( |* p( K5 E. I& J5 k
    mov     ax,4fh
* r1 L" x) \- W    int     41h
# p6 O0 V! d- o$ o, Y2 ]0 @* L$ M    xchg    dx, es:[41h*4]
, V' z( ^3 G3 i1 Z: p    xchg    bx, es:[41h*4+2]: w, j3 v$ T+ e2 \1 G$ F6 b, n
    cmp     ax, 0f386h" {2 \. f  Q& _+ R+ z
    jz      SoftICE_detected
' ?$ G# q( E$ l- |- f: o0 @5 {! F$ M6 J' k( V
int41handler2 PROC
& i9 P9 K7 U: r    iret' l) y; ~6 @1 ?7 u8 I
int41handler2 ENDP" q, r) i0 K% B( Y/ N* M( w

* J4 R2 X) C' A
& y% r6 p5 ?: @7 |- J3 m_________________________________________________________________________: N8 Z3 K+ h8 A) A& u
$ L+ a: S7 l& J

) \$ t' G: [$ S8 x0 s) AMethod 06
3 Z, w" Y, J8 A# M# z$ m! b=========* d7 q' O3 E, k* p
9 a. d  f, @. |
+ N* P+ G) E* J8 r# f$ T
2nd method similar to the preceding one but more difficult to detect:- M* }, W! A, t/ K5 m0 [" Q" b3 w& H) k6 {

7 O6 {, K8 |7 K7 g% F# v! j" d
" w9 s$ D! _8 fint41handler PROC
5 V% A* ]9 ]+ h2 x; G& g3 V    mov     cl,al8 G+ W8 i$ o1 R, E# M! b
    iret3 f, ~3 o5 ^$ ?" c, O2 z
int41handler ENDP
) [4 Y% S6 R# y1 f
. Q! J$ P4 J3 I8 q) i7 [2 w
8 p% c* h2 h! \) e! ~7 k7 x2 O* r    xor     ax,ax
0 J, [1 d  P9 K6 Q    mov     es,ax# k7 g4 @- h, U# {9 O6 a/ i
    mov     bx, cs4 y$ N4 j9 f7 i( R  c. w
    lea     dx, int41handler
3 {3 O2 z8 o" Q. |    xchg    dx, es:[41h*4]
# n$ h. J6 A& u$ M: c* ?    xchg    bx, es:[41h*4+2]
7 s6 D1 x5 G/ O. R" c3 y1 i    in      al, 40h' x. K6 {8 E  m( M) d8 e0 A$ D9 i- x
    xor     cx,cx
6 u' E% V$ M' o: z    int     41h
& Q. r4 i& H6 R% O6 ?3 v- Y4 j    xchg    dx, es:[41h*4]
+ P) m4 r# g2 m" ?3 e    xchg    bx, es:[41h*4+2]
: |+ X  e8 B5 Z& e) F* Y" [    cmp     cl,al0 Z2 u# U2 j; K
    jnz     SoftICE_detected+ r" t+ I# N; k/ L

: Z1 {0 n+ G4 \) G' e. ^. ]1 d_________________________________________________________________________
$ L* z" A8 }- J, C! m
! X0 ]( Y3 D, J3 B- x3 Q3 r8 TMethod 07- _% n$ R- z$ v) r
=========
, V1 [( R. n& x# k, t
3 l0 I$ r5 b7 u0 r8 ^6 X; z5 w' JMethod of detection of the WinICE handler in the int68h (V86)0 o9 O' F1 H0 _" ~

" K; o, c4 f! r# L    mov     ah,43h, k: T1 Y6 O7 @6 q( q9 H; S9 C
    int     68h
8 y& \9 ^0 a: k  ^    cmp     ax,0F386h
% Z3 P* d/ W9 D2 q! ^) i% i2 Y$ Y' v    jz      SoftICE_Detected/ c# ~* K3 V9 ~' q2 {

  C- Y! j8 ~4 Y. U+ j# S$ _7 E
9 }* J; Z9 M* v& Z, Q' a: z4 G=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit$ ^; v% G2 u) s  E' k
   app like this:  Q) [5 F$ _5 h$ `  f+ s

! c4 f: N7 \% Q   BPX exec_int if ax==68$ h, n! a  A" E, s
   (function called is located at byte ptr [ebp+1Dh] and client eip is; V0 e* V/ h1 ?2 ]( s
   located at [ebp+48h] for 32Bit apps)* {1 k0 E# n: w" t
__________________________________________________________________________
" q  X$ A' |6 m! y: j& L) \' {6 ?
% J9 Z) q! k6 b& [) l( I# p) c) O
% G$ G# |3 G) E4 P# y+ O$ D6 OMethod 08
( v& d$ N) i3 `8 b/ \' V=========
, N: i* U; f  L( |9 g- p  o3 a; o# K$ S) c
It is not a method of detection of SoftICE but a possibility to crash the, d; b& D7 d/ X- m
system by intercepting int 01h and int 03h and redirecting them to another3 g" w( d& T- }. d* j9 u
routine.
' q: k# j( l7 G+ d/ QIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points5 e7 s1 w, D; K# L% p
to the new routine to execute (hangs computer...): L6 W8 `' ^2 `0 H
  V, f* E* z; l6 [& f: N
    mov     ah, 25h2 [& C# @9 m8 ~3 R' [4 H
    mov     al, Int_Number (01h or 03h)
7 i! o' M+ o3 C/ b1 Z! l- u    mov     dx, offset New_Int_Routine
  A! c+ `6 x' D9 G0 I    int     21h- @; J8 B* R; E: {" c! S
* l+ H1 A: g% j/ c4 ^4 O+ q$ \
__________________________________________________________________________0 r0 |  Z4 ]. K4 b; j

! t! ]% J( w$ WMethod 09
: ?/ t7 ]/ G) k=========
; n/ }+ P' g7 M1 W8 T
$ l7 C* X4 F2 Z7 p" s! y" {, nThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only; r- m( f, c  f
performed in ring0 (VxD or a ring3 app using the VxdCall).
. |9 O  t8 o  LThe Get_DDB service is used to determine whether or not a VxD is installed
8 s4 p- r8 y* O0 @( @4 O3 k' cfor the specified device and returns a Device Description Block (in ecx) for9 S( c1 U9 ]& }8 w
that device if it is installed.
2 J6 R! D7 F3 X& X. P1 X4 Q
+ q# F+ w2 Z0 _# ~' Q* J4 t- L   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID8 W& [( L5 G6 v1 Y+ e2 T2 S9 n8 x' n
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)" \' _; O5 s: o4 e" ]' R
   VMMCall Get_DDB
9 D# @8 j$ c! ^0 S6 U* [7 T$ }0 e+ L   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed9 k7 m2 X, @# V6 o1 H% k& ?9 a

. O( H3 M, W" @3 F  p2 gNote as well that you can easily detect this method with SoftICE:: T" z9 I9 t# f
   bpx Get_DDB if ax==0202 || ax==7a5fh
$ F; B; Z$ w( m- p' N! k
; d# b+ ^! [) Q1 d$ g__________________________________________________________________________. E+ K1 Q" I' u9 A4 _

) W0 ~: B" D3 p+ H  k  m  ^Method 10
/ n. o$ ?4 B2 G4 e8 r=========# g7 m3 q  h8 \+ u( L( Q$ {. N0 ~+ F* R( b
8 v( a% K# I; E- x/ A
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
/ c; Y# ]0 S3 x9 x6 v$ V, R  SoftICE while the option is enable!!1 m3 z- G4 {1 \& p# d1 g# a1 o
' |, Y( U9 Y: v# Y& R* O
This trick is very efficient:: v4 b0 b3 |9 n5 Z5 G, H/ ^
by checking the Debug Registers, you can detect if SoftICE is loaded5 a. \3 s) d+ y- w: p
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if: T; d8 m8 g" e; F! A9 P
there are some memory breakpoints set (dr0 to dr3) simply by reading their
$ \% w( G! r! E0 d3 i- bvalue (in ring0 only). Values can be manipulated and or changed as well
/ `" X. o4 g* L( R& u(clearing BPMs for instance)
) P) ?8 R3 H5 X* A/ E: A
: @! y% b2 Z# e3 q__________________________________________________________________________; X+ E8 s  C- u" v9 r/ M
8 y# X  k" X$ k* Y& }+ K+ ^5 R1 g
Method 11+ ], ?( V1 r7 |2 D# `
=========% t- Z+ `. ]+ H- y* K! C
' b: W( ?3 z5 F
This method is most known as 'MeltICE' because it has been freely distributed, n9 F$ D* P; ^" c5 `6 U
via www.winfiles.com. However it was first used by NuMega people to allow
5 _$ d. p+ E: i$ g( D: nSymbol Loader to check if SoftICE was active or not (the code is located
6 x. I) p3 \9 N) }& linside nmtrans.dll).
+ {0 v0 Y4 k* M4 b7 ?# j; D4 o. R0 A  c  d  o
The way it works is very simple:$ {/ d$ K2 `5 }- |# h$ Q9 _
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for- J1 q5 V  c, Y# f7 C) ^- {
WinNT) with the CreateFileA API.
% A; b- {5 X! O5 s3 v& L; f- D1 J5 j8 [: S, d+ G9 u) u! X
Here is a sample (checking for 'SICE'):
7 `% U% J' j5 X& Y( N" r+ W$ Q$ R$ O- P: m# O# |4 ^
BOOL IsSoftIce95Loaded()$ p3 Z% U( M. C4 g& S
{2 J: c/ G0 n4 Z7 i
   HANDLE hFile;  8 m6 F& P+ L% ^6 D' G( Q1 I7 Y
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,& F1 k2 P" k+ I3 Y$ ~) D
                      FILE_SHARE_READ | FILE_SHARE_WRITE,: G. j; S: E! i! r% I
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
$ E, b% Y, M; x5 l& {   if( hFile != INVALID_HANDLE_VALUE )
) j2 [) c1 D4 S   {
  b) x3 F! a/ g- Y* S      CloseHandle(hFile);5 F% r+ V( \# A: z8 X
      return TRUE;' q& J5 [$ b; u$ @6 g+ l8 L
   }/ O0 R- V" e. s1 Q" t
   return FALSE;* }7 G! V1 n, r, t$ H: h
}, D, |+ m2 P; C7 A
6 @4 A$ \( |& F+ F) S  i
Although this trick calls the CreateFileA function, don't even expect to be( _- z: A! k7 Z. u: f( U0 l
able to intercept it by installing a IFS hook: it will not work, no way!* y# B* p$ Q3 S% s% D% h& M/ P
In fact, after the call to CreateFileA it will get through VWIN32 0x001F
/ a! N2 s7 H2 iservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
: V) O" o' Y! ?' uand then browse the DDB list until it find the VxD and its DDB_Control_Proc
( ^3 X: L2 a# cfield.8 t/ z6 @! D$ S8 V% G; @4 b( _* a6 O
In fact, its purpose is not to load/unload VxDs but only to send a + @" r: B  h, ]( Z3 m. l
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE), M9 ^  N' g% Z' f" O5 F7 A
to the VxD Control_Dispatch proc (how the hell a shareware soft could try
/ l8 {5 q2 e) g2 Q1 g4 X0 p9 j' N8 Ito load/unload a non-dynamically loadable driver such as SoftICE ;-).
: b! ^1 ]0 S; Z" |# FIf the VxD is loaded, it will always clear eax and the Carry flag to allow
4 M" c" |5 a5 s$ n/ n0 h  Nits handle to be opened and then, will be detected.; c9 B( {7 v! U( S* r# r
You can check that simply by hooking Winice.exe control proc entry point5 d6 I/ n* A7 l, H1 l% s) l1 u. Q
while running MeltICE.
% c- S, n4 Q6 j1 r" _1 A0 d( o% {1 f7 b
! T) y0 p/ f# f( H- o% {  b
  00401067:  push      00402025    ; \\.\SICE
6 O! w. S% o  p* h  0040106C:  call      CreateFileA
" h  @( J% C' u( g+ ^  00401071:  cmp       eax,-001
* e7 f5 o0 T1 q& g1 M  00401074:  je        00401091
" m2 j5 s" X" C6 H, G5 H3 z* v* P0 d: n0 V2 l: L) I* {

3 p. \" J3 |, Y7 W! kThere could be hundreds of BPX you could use to detect this trick.1 C/ P# q% s- a0 q/ ~
-The most classical one is:
8 B; O/ m4 u; P+ P  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
" C9 M  h0 \' n0 l( _' t1 [    *(esp-&gt;4+4)=='NTIC'7 K. C/ N+ f" p4 K/ Q: O
, e% {+ k6 [" Y# F
-The most exotic ones (could be very slooooow :-(
+ T* v- M0 l& x4 Q6 s/ v   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  % O0 L* @8 n5 M! `" V$ E  Z
     ;will break 3 times :-(
; j  l& q8 l1 O' Y  Y% q
* T4 @1 G1 _$ E: M" n$ t-or (a bit) faster: + I3 Y  v  N: \" Y5 V
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
+ _  N$ ]5 U: m2 r
& M+ Q- d- a8 e- G" U5 I, |   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  5 {+ b, p6 K  Z1 _: T* u" B1 r, V8 U
     ;will break 3 times :-(
# M1 B8 v1 ~7 ?1 X/ A! |2 H) g7 u& z1 e0 x
-Much faster:0 Y* C1 l/ ]0 v" p- i; f! A9 w1 M
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'; h  }7 o- S# T3 o& s, j

  j* n, H% C+ Q$ ?, {9 DNote also that some programs (like AZPR3.00) use de old 16-bit _lopen
+ P* S8 I9 |& b, n$ V; Mfunction to do the same job:" \5 }! g+ t- x7 q( V6 X' o

( [: v0 n7 i* \   push    00                        ; OF_READ
/ b4 z. x/ X2 m7 D   mov     eax,[00656634]            ; '\\.\SICE',0
/ d% e# ?, ^6 @& W2 N+ b9 r6 n; [   push    eax
; B. c. E5 z4 m   call    KERNEL32!_lopen% ?' Z# S0 Y6 d9 Q. O9 j" ^
   inc     eax
3 M! [3 C( D; R& F4 v2 A2 j* Z   jnz     00650589                  ; detected
. x' V* _$ M" \+ I* O) ^2 f4 U   push    00                        ; OF_READ
4 v" L; F) r# F- b* e& Z* j! y+ Y   mov     eax,[00656638]            ; '\\.\SICE'8 i# P; B- S# p* Y% y  i
   push    eax9 Y6 g' D" J; {% ]- m
   call    KERNEL32!_lopen) @- S) [$ V  V' X. n& w
   inc     eax' O; w6 Y' g6 V) U) y( j
   jz      006505ae                  ; not detected
$ p  R6 p$ u* F' g4 m5 v. g) e+ A: n

; S! S) G0 g" j+ r__________________________________________________________________________  }9 Q7 Q" b3 }2 q8 G& U; G+ D

- i8 W" {  D* D5 {5 EMethod 12
$ k; `7 V2 V: w0 B' e=========
% m4 h& ~0 b8 U/ g; b
1 P& x4 J) H9 d9 \, S! ]% [This trick is similar to int41h/4fh Debugger installation check (code 05
4 g- j" e! w( H3 `, S" Y2 @&amp; 06) but very limited because it's only available for Win95/98 (not NT)
  \- i0 R3 s' H: j/ `; y, Bas it uses the VxDCall backdoor. This detection was found in Bleem Demo.% t4 ]9 m1 k/ J. p+ q$ A
' Q& L4 h" n) I; b+ B- ?. s$ Y" z
   push  0000004fh         ; function 4fh
6 _* S& j3 Y/ K# ~  R   push  002a002ah         ; high word specifies which VxD (VWIN32), o, m! B; p% C
                           ; low word specifies which service! ]# p5 J4 @: ]- f
                             (VWIN32_Int41Dispatch)
" p8 I  c9 M) |5 Y% \   call  Kernel32!ORD_001  ; VxdCall- \, @: n8 d% {4 @
   cmp   ax, 0f386h        ; magic number returned by system debuggers
) S0 h/ n9 h1 z   jz    SoftICE_detected& p! H9 {2 T) H/ N- S" x0 m  p

/ G+ v  G" f: E3 yHere again, several ways to detect it:
6 l  V  ?2 x+ ~
9 ~! W- Q& x$ B  t  ^    BPINT 41 if ax==4f
: I) R8 k" o8 n4 j; C$ M1 Y7 N
& E! c3 }! s) E: \; a    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one3 I/ Y  D& g6 g( h% ?6 A/ F$ D
5 z7 j) q4 z; I. v
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
5 o$ q' @9 Y# F6 h9 H( K% m. Z1 \
, |8 _9 S5 k0 V( l    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!! D) A2 M" j, I4 Q
0 o+ |. ?9 X7 f6 k5 ~) p8 J6 T3 i
__________________________________________________________________________) o* j0 v3 F! b' P
, K- B- _* c% Z& I/ d: B
Method 13. W- d# Y# D" ^. s
=========
- {2 t! _; Q" S
$ I$ E) E; I( w& LNot a real method of detection, but a good way to know if SoftICE is
, g4 X/ [- M' l. Ainstalled on a computer and to locate its installation directory.0 S7 r8 ]: `& k3 n
It is used by few softs which access the following registry keys (usually #2) :
) q" g: d. u3 b' ~! d3 C
' M7 I5 i3 A1 M0 P( }, S, I0 g8 i-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion. r* ^9 E2 e9 A- ]1 s
\Uninstall\SoftICE+ ^1 r* N/ V/ r7 V8 I' ~
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
7 j3 q5 l, E% L# }; }3 i) v9 Z' ?. ~-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
) w* ^! R+ I9 V- ~. [\App Paths\Loader32.Exe" j9 v: b" {1 o; Y; P
1 M8 b  k$ v: f& G- L3 X: \5 u- D

0 D7 P8 d1 U8 e( t7 JNote that some nasty apps could then erase all files from SoftICE directory
) n7 j# {0 _2 b' U(I faced that once :-(
7 Q7 W2 H% W4 k/ u7 l. ]  m. f( _# y9 x  ]
Useful breakpoint to detect it:" ]; C' a. R7 o  Q$ \! n( w- P

: J9 z/ V+ ^2 k3 ?. ?) {, v2 }     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'. }+ V; g  b! i

  k' e1 D* L7 x7 i9 a0 n' O__________________________________________________________________________
! L7 A9 b0 k- x: s# Z8 |- J$ _# K, \$ s/ t6 B8 s( ]3 |% a( w: Z* {+ ?
+ d( m& n4 g% }0 n8 o
Method 14
7 s9 [) A2 V1 P7 d6 _; {=========$ A, l& _9 F( G

/ k$ [& N" w6 B( GA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
( @; C- d% s* A$ @: n- ~2 _is to determines whether a debugger is running on your system (ring0 only).( Q. H. a1 B5 D

7 O, Q0 S/ Z. A8 j2 M% {   VMMCall Test_Debug_Installed- w( \- u" M4 [9 ?% z  h
   je      not_installed+ s8 Z& h) J$ m; ]
% i7 m3 a3 K$ w; n+ t
This service just checks a flag.) K4 T& _. O9 n3 \7 x8 l
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|本地广告联系: QQ:905790666 TEL:13176190456|Archiver|手机版|小黑屋|汶上信息港 ( 鲁ICP备19052200号-1 )

GMT+8, 2026-3-10 21:59

Powered by Discuz! X3.5

© 2001-2026 Discuz! Team.

快速回复 返回顶部 返回列表