About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>! S# a" K+ x$ d* y7 f+ _
<TBODY>
6 @% e, @8 q8 Q' O# E! g<TR>
0 w/ Y) r  Q  Q1 w2 u<TD><PRE>Method 01
" h0 @0 i) y0 d7 y  ^5 I=========
1 F0 x2 L3 M) f$ `+ Q4 G& o5 x6 b& _5 U  [( [5 `
This method of detection of SoftICE (as well as the following one) is* D: W4 b. f0 L1 l
used by the majority of packers/encryptors found on Internet.
  g0 m9 L6 z# e: DIt seeks the signature of BoundsChecker in SoftICE' O; g% [, m) a8 X) _$ B

$ ]9 J2 b5 J: r# q    mov     ebp, 04243484Bh        ; 'BCHK'" g4 F3 D( ~5 P
    mov     ax, 04h, o5 {3 N9 V+ f$ W: f1 X
    int     3      
& U7 }6 D# Q0 ?, t    cmp     al,4' w+ Z& U; w, \2 t, h: P( i
    jnz     SoftICE_Detected
2 D4 S$ v& A9 g7 h8 L# t) V) A* S6 U
___________________________________________________________________________
& G; B$ y( \: a' g. {1 f" n2 E: K6 h& ?, R. r7 y" V4 l' B$ n$ {9 D
Method 023 n! j0 R/ `4 y) T9 ]+ U. C, R% v
=========* N% Q* _  K3 y8 T. O# ]
" K) x1 Z( ?: h, @
Still a method very much used (perhaps the most frequent one).  It is used
  k1 r. ^! R- G2 Rto get SoftICE 'Back Door commands' which gives infos on Breakpoints,
0 d2 g# H) [: q) vor execute SoftICE commands...
- F3 t; I$ {& q8 J4 ZIt is also used to crash SoftICE and to force it to execute any commands
+ w4 U5 i$ j4 u# J; f, d(HBOOT...) :-((  # b' d' O* m- e
1 P% C7 }8 c& _1 \7 \  e
Here is a quick description:5 P- `: [6 S: s( v
-AX = 0910h   (Display string in SIce windows)% t  N4 ~. e2 j/ w; d
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)) f0 b; a& q" T6 J. \) [( s3 H7 \
-AX = 0912h   (Get breakpoint infos)$ j- B. u9 T% t/ g
-AX = 0913h   (Set Sice breakpoints)
; Q6 K* `% A* i8 ]-AX = 0914h   (Remove SIce breakoints)6 Y# r. v1 `0 ~& }, z% D9 q4 S  C. x
( m8 p) ~+ W  }
Each time you'll meet this trick, you'll see:& J; f7 D0 @. J9 M& s, k
-SI = 4647h+ g# |6 u; R+ T5 i/ I  l6 \) {/ g8 D. t
-DI = 4A4Dh
1 q& M3 t" x& a* UWhich are the 'magic values' used by SoftIce.
8 [" G4 U# ~7 n+ c: K* _6 {& QFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.
, g& n9 _( V) q! T
- l5 g2 L. O2 _0 z4 D4 K8 P! |0 bHere is one example from the file "Haspinst.exe" which is the dongle HASP
$ o1 }& e- c$ N$ N% YEnvelope utility use to protect DOS applications:
! N: X& u9 ]  X) F7 I& R9 `% B- L) S- G! K6 v
- n4 O- H) |! u. b" h
4C19:0095   MOV    AX,0911  ; execute command.
- T& F- ~9 t% v4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
/ V6 E" s2 w# }5 f. z4C19:009A   MOV    SI,4647  ; 1st magic value.
+ ^7 B4 C6 f! o8 O* D4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
: @, Q0 \; X( l! z9 P1 |1 f4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)$ Q$ I8 u* i$ t* ]
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
- ^/ U6 P7 }5 m$ f4C19:00A4   INC    CX
" G: `5 J( ^. }( _; ^( n. I+ w: ^4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
2 m# G# k4 O; |4 P5 G+ ~( d, V4C19:00A8   JB     0095     ; 6 different commands.
; M- b. v7 d% w4 N# x  I( l4C19:00AA   JMP    0002     ; Bad_Guy jmp back.8 n3 P. w) W5 x& [8 J$ x
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
' W4 S1 a3 O9 i( ?7 X
4 y/ t' L4 Y" mThe program will execute 6 different SIce commands located at ds:dx, which
/ o# B8 z6 X6 k9 p) j1 care: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
, z3 S8 E5 k" m, V  o3 @; l1 i8 t. L. E3 {* z7 L) v
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.6 X3 P- Z. J5 A# ^! M
___________________________________________________________________________
3 S9 \( G( L* G+ l0 W4 l; Y# S% r) W: v4 o

- _9 u, l+ M/ n+ X8 M5 ?/ X' gMethod 03
  \6 L! ^% Z; N=========
& ^( h; k7 ]8 h, Z( o9 _
% P, E2 H5 a) D! i8 f" fLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
% m; Z% R, [2 ?(API Get entry point)
  W) C0 f7 T' D7 m- u8 r0 L        5 K7 G. ^* g, E0 ?+ _

5 R3 |7 h* ]: b    xor     di,di% D" ~0 G1 {$ {2 q$ ]" _$ D$ h! b* h# M5 R
    mov     es,di
$ b! |: d+ |0 g9 {9 S    mov     ax, 1684h      
5 Y' Z2 l$ z( b: S# j    mov     bx, 0202h       ; VxD ID of winice/ t* S/ p* C9 x; f* r
    int     2Fh
6 |+ |: D. n2 t# U5 o    mov     ax, es          ; ES:DI -&gt; VxD API entry point
% p" G- S: D4 l( `* X    add     ax, di- Y; `" S6 O+ k0 A3 _" o6 T$ _
    test    ax,ax
9 i% A* h' j2 y% C3 b. A    jnz     SoftICE_Detected
0 s) v" z  w! B
, u1 `% v4 ?8 q7 Y$ i8 G___________________________________________________________________________
* O& y! l* j2 J0 f/ c' q
: D. |- i/ V4 C6 E6 a$ yMethod 044 e( n* M" r4 j$ R
=========
. f4 i& p5 Z2 b4 X* _
% e) J! k/ Q/ a1 w8 e. mMethod identical to the preceding one except that it seeks the ID of SoftICE& p3 }: d) v: W( E
GFX VxD.
7 ~0 P% M2 x2 E- V& t3 t: v# x# u# F. g6 @% |, z) A: b" b" J- T
    xor     di,di
. ?' w1 O$ J4 f( v* ~    mov     es,di
% F  ]# m+ T' j! {    mov     ax, 1684h       5 f% Y2 N& d* H+ f* `+ B
    mov     bx, 7a5Fh       ; VxD ID of SIWVID3 e" j; @' t% r- y. h8 L' n
    int     2fh' q; P) _) d1 x8 @: R- K3 ?
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
! p+ z& }* W: U+ V6 `    add     ax, di
5 t3 q; i! M; d( q4 \- a    test    ax,ax6 U( G: C& o0 `; \6 H
    jnz     SoftICE_Detected  Y+ _9 K; \, A( k$ a1 B

7 J! v* F/ a9 u& k5 q- N# h, t__________________________________________________________________________. M( x$ D) C9 n3 ^1 v" n
& L5 f7 w& [: J" D6 m# w" o( l
" h' Q2 H0 Y1 y6 v- }
Method 05
+ C! Q1 w* I* E) o1 T=========) U6 H2 q3 o" A' p' @

  Q% _% Q* z* W5 IMethod seeking the 'magic number' 0F386h returned (in ax) by all system+ S* T, \2 c) _2 ?; d$ x
debugger. It calls the int 41h, function 4Fh.% ?5 k1 E9 d' S3 ^+ B5 b% }
There are several alternatives.  
/ Y+ b% P1 ]+ O5 y! ~, S
! f) B. n3 E3 I: BThe following one is the simplest:4 `5 k. f: U( w7 L, H1 u, [) Z

/ J; T8 m! r' [; {/ i    mov     ax,4fh
' f1 p, N/ V! N% v) Z  a: F    int     41h" u2 o- }, L* ?. g
    cmp     ax, 0F3868 M4 Y$ |* F4 f% ?1 V+ i
    jz      SoftICE_detected
, ?( {, Y7 s, e0 h+ ?
4 |! I1 H1 W7 n& R7 J4 E2 }/ X6 k0 r2 E+ K0 W8 x! j) J5 n& u
Next method as well as the following one are 2 examples from Stone's
# d- `9 x, P2 }6 q5 v" z! d"stn-wid.zip" (www.cracking.net):
& {" _: D, x0 P4 ?6 J; S
2 T) y# @! J' }) C    mov     bx, cs
& O9 @5 X& U9 b" }    lea     dx, int41handler20 U7 L8 H# ^: ~: t# t
    xchg    dx, es:[41h*4]) F! Q. t2 ]+ ]0 t' J% ]1 d; T
    xchg    bx, es:[41h*4+2]
# I% }$ ?7 K% W1 O1 _* _    mov     ax,4fh
/ H( p6 d  ~6 e* E8 z    int     41h
9 r. R# K# v2 t7 X2 e/ @    xchg    dx, es:[41h*4]6 P2 W; n8 M5 G" h1 K4 f& Z( B' J/ Q' p
    xchg    bx, es:[41h*4+2]
5 V7 b5 _1 |) X7 i; z    cmp     ax, 0f386h5 D0 S+ R" r8 \6 h8 [0 \1 q
    jz      SoftICE_detected! r; C5 c3 s+ x* f; k9 L. a# {
7 b% F2 i% g$ H+ P
int41handler2 PROC
$ @+ t3 M+ i0 ~/ t    iret9 J" q9 r; x( P, P4 R6 U
int41handler2 ENDP
! q' E; {. T; v, W+ H: N# v, @& `7 Y& z/ D7 r# R
  i! c. s9 B! |& w2 `
_________________________________________________________________________& U: }' ~5 c# v6 Y( L1 D) A" G# A9 Q
$ b- L/ o) D" N1 z2 P

9 H" R6 X5 ]0 v! ~) AMethod 06* X* r, Z0 \; {; H
=========( g) S0 e7 q; ?4 P( g* U

" i! \7 S8 j6 B3 ~$ U  O5 C4 `% G5 [8 z! [% d( _
2nd method similar to the preceding one but more difficult to detect:
0 L) e* @! [) d4 i! R. w, S
8 l9 B6 @" ]3 u0 a4 q- S+ C- u, Z; X$ K: I; \+ Y2 t: x. i! {
int41handler PROC+ N" h2 |( l& Y% p6 L: q
    mov     cl,al7 o- N# t' d1 W: A- e9 E% M
    iret
9 {' ^& j$ r& pint41handler ENDP
& {! ]" w- X& p9 E5 C
( B8 y$ A" r# x. Q: Q+ |5 e4 j2 C, I; ^1 ?; v
    xor     ax,ax
* P& \/ Z3 D" r. j6 ?    mov     es,ax
5 s. Z4 o1 \$ J  Q, ]    mov     bx, cs
2 K8 J3 D1 I0 P  e0 I  l    lea     dx, int41handler3 m2 F- |- Y4 c" n( ?# p
    xchg    dx, es:[41h*4]8 p: ?) v9 C3 d& }
    xchg    bx, es:[41h*4+2]
' k! |6 D9 ^6 }: y2 [& W+ c    in      al, 40h
+ H, `$ \: R1 l( T$ k; H  v    xor     cx,cx2 h8 J% V9 ^! w7 F5 |) \  m
    int     41h! A; `; r* ~/ j
    xchg    dx, es:[41h*4]) g4 n1 m1 m9 i; z! l  F( @
    xchg    bx, es:[41h*4+2]
4 t2 W1 X2 a1 y& a/ b    cmp     cl,al4 N6 }! A* A  `5 A5 W3 Q7 H* ~1 g3 l9 X4 G
    jnz     SoftICE_detected1 h) y1 a& w& u4 P
9 k  W! d- w" }3 P: X5 [" J) s
_________________________________________________________________________
" \2 T" u7 ]' ~' i, H
& k- ^) T. X' i  C- E8 H/ R7 XMethod 07
) Q+ S# J$ M. c- B0 p0 j! H=========
; ]5 [3 W1 g8 f0 t% U: A
5 ^( x; a- e' _& C! `  m7 IMethod of detection of the WinICE handler in the int68h (V86)- Q, O0 n7 t- l& z4 {# {+ Z" O% c& l

" Z! e6 o" O1 d$ D    mov     ah,43h% G/ x' c/ v/ D# h& Y
    int     68h# D5 M% B/ z& R. i- L
    cmp     ax,0F386h
5 u9 n' W) z' a/ ?5 I- y    jz      SoftICE_Detected
- r( y* D; X' c
& a( D2 W( C- D- L2 [  h  g( B" ~8 ^0 G7 J0 H+ i
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
3 z* }( |6 y  p5 H   app like this:
8 A: g/ q; ^" c3 ^6 w, J8 Q+ H
, A7 X' P$ k4 `* I- s   BPX exec_int if ax==68
' @% J& e" A# g" p. }3 l   (function called is located at byte ptr [ebp+1Dh] and client eip is) g% ?' B  F; d
   located at [ebp+48h] for 32Bit apps)
* R; Y9 |4 a( M  G3 }( j; f2 ]__________________________________________________________________________
+ L- _1 \% }  M7 M. Y- y7 {- M# Z; ]. G

$ ~7 H4 V5 y  \8 u1 `' j; t* {3 AMethod 08
5 G) j2 Z+ Z% O8 b/ F( `# O=========
7 T( o+ ]  q0 L. v+ S
5 V- g7 p6 H% n5 \% T% A5 AIt is not a method of detection of SoftICE but a possibility to crash the, o, ~! T! X' x" j6 v2 o! _' e
system by intercepting int 01h and int 03h and redirecting them to another
. @( @' U" v9 iroutine.' W5 ]% k! F' ~- m- \
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points: r" C( _) a# f9 w, Q( I
to the new routine to execute (hangs computer...)
0 ^: f) s3 f: Q$ U' t9 `. E% S6 E8 j' O1 w5 S
    mov     ah, 25h: [5 O2 V* f# p4 D# d1 N
    mov     al, Int_Number (01h or 03h)! X7 A( C: N& Q) C3 A
    mov     dx, offset New_Int_Routine
6 d' m7 R/ j) H3 m& b4 W    int     21h
6 `  K9 N% w+ C" T. |1 p( \; D
. \* x, H+ b1 ^. C__________________________________________________________________________$ \5 ~2 q  d3 b# [8 A
7 ~' r$ L* P8 B! P: a+ E- S
Method 09* g. A9 b' {0 v- o$ I
=========
& o5 g, }/ f( N; H) A! ~: b$ H3 M- ^* d" S2 B6 B6 {) b7 s' R
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only+ o8 w2 k, a+ o+ t7 y1 ?
performed in ring0 (VxD or a ring3 app using the VxdCall).. c3 q- n( w. c1 e) k8 g) D4 x. K# E
The Get_DDB service is used to determine whether or not a VxD is installed2 y$ I) F+ b: N: }! z8 ]  R/ }2 c$ ~
for the specified device and returns a Device Description Block (in ecx) for/ E3 V6 r. E! X
that device if it is installed.
  D- h7 ]6 z" V  A
! B. s1 r2 g$ X2 `   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID- o: f3 F0 l( f. j9 j4 U8 O
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
  E% P! d: g0 o# {, C5 O- M   VMMCall Get_DDB
! ~. R" K% d8 [6 K) N   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed6 w9 W6 |2 _  K1 H6 U7 T

5 n2 N& c" J2 {& |7 d5 L5 HNote as well that you can easily detect this method with SoftICE:
( M$ d7 q2 C8 x  m   bpx Get_DDB if ax==0202 || ax==7a5fh
/ E; d) y# I! [2 N% h) N6 T0 J" `; e% H" E5 ^# T2 \* S5 W* y8 t
__________________________________________________________________________
4 Z; [: s. Z# z7 R" r7 x. G4 I0 v! e- ^
Method 10/ _; Y2 i( Q+ {2 W
=========
: ?7 t, l+ L3 X7 E  `1 b
7 R$ P3 s0 {8 k. ]  p9 K=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with, A- p0 D, A  t2 T0 u$ p' J( O
  SoftICE while the option is enable!!  J2 y; s3 n- n. M/ l# ], k

( [: V* {6 Q" A7 {( Z: C7 X% DThis trick is very efficient:
7 ]& S1 P3 g0 w! o  r, l. T" yby checking the Debug Registers, you can detect if SoftICE is loaded
. l) W1 U: S0 l9 ^* L$ C(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if8 U! l5 h, I/ s. K0 h
there are some memory breakpoints set (dr0 to dr3) simply by reading their
8 K  I9 z( F+ Y& R3 S! S/ |value (in ring0 only). Values can be manipulated and or changed as well4 Q0 }( ]0 [! r# P, a% t3 v/ R
(clearing BPMs for instance)  c! j- I) u; _

$ b* x* y9 L# D$ k; u__________________________________________________________________________
2 ]9 c* `8 u5 q$ y( H, r& f7 J- b$ t( y  N8 t: i" a
Method 11$ c% q3 y) K2 f
=========
( U2 G7 d% w1 @. L7 [. p! j& F
This method is most known as 'MeltICE' because it has been freely distributed( P  i- z3 ~5 x, o6 d( J
via www.winfiles.com. However it was first used by NuMega people to allow
& @, o! I: y0 \- {/ Q+ DSymbol Loader to check if SoftICE was active or not (the code is located+ p% g8 p& E( }$ S7 q
inside nmtrans.dll).
# Z5 a( P* ~. R9 k7 G, Y+ h6 R5 X# ^0 c& e$ ]7 `: _
The way it works is very simple:
2 _0 F# g* @+ O& r& A6 WIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
" ^7 D7 q. Q, x/ T9 J" n/ xWinNT) with the CreateFileA API.! m+ V0 l* r/ M9 P" f) y& j/ S% Z
0 @( I0 F; V0 y
Here is a sample (checking for 'SICE'):9 M  N8 b2 ?/ m0 M' L

0 i% m8 n8 Z" i* m' YBOOL IsSoftIce95Loaded()3 r9 z" ~% o6 {5 r
{0 Q7 B' o+ {( t" r+ D
   HANDLE hFile;  4 L% A3 ?/ I3 u
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
. e( p' x; l2 m( K6 {2 }                      FILE_SHARE_READ | FILE_SHARE_WRITE,8 G  B* Y  @* g! y/ {# Y, T2 x0 P& p
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);, o+ q, a% c  q& j1 v
   if( hFile != INVALID_HANDLE_VALUE )2 U9 l; b- F+ ^0 K0 g# y# g1 q6 S
   {# A1 t4 R  _& J, @$ R3 \, h
      CloseHandle(hFile);4 O# u' ^" E1 m+ Q
      return TRUE;
4 }" v3 K. O, n( {+ [   }' |2 O) K8 n% O8 f1 r1 e
   return FALSE;7 X& n6 W* ^) n1 u: f; A8 I. x
}
% U$ h& _1 R4 ^  Y. {: ]: i+ g5 [1 V; {
Although this trick calls the CreateFileA function, don't even expect to be2 n2 [( f$ s* t7 [  Y
able to intercept it by installing a IFS hook: it will not work, no way!
6 A8 o% a, f1 l+ L3 W0 u" oIn fact, after the call to CreateFileA it will get through VWIN32 0x001F. r, [; y5 z4 k: V$ k
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
3 ]& b6 C* Z1 F, Hand then browse the DDB list until it find the VxD and its DDB_Control_Proc
# T. [/ P! t) Q7 w5 ?field.' U0 p) ?! ^7 S
In fact, its purpose is not to load/unload VxDs but only to send a ! u0 W9 P5 L+ C
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
% ]; @9 E" Y% h, j* a$ pto the VxD Control_Dispatch proc (how the hell a shareware soft could try
) l6 a. ^, V9 qto load/unload a non-dynamically loadable driver such as SoftICE ;-).) o8 c) _3 y' r8 ?1 V7 ?$ |1 ~% v
If the VxD is loaded, it will always clear eax and the Carry flag to allow
# Q3 U$ q* @; }) sits handle to be opened and then, will be detected.6 x3 F8 k# R) P# Q/ m' ]
You can check that simply by hooking Winice.exe control proc entry point/ U' l# m4 R; v; a, n$ ~/ I& n/ m
while running MeltICE.
0 N2 A8 J3 l! [/ |
) \1 H6 Q* I  V9 P3 e& Y( d# q  x: z' {, ]3 O# f& R" M
  00401067:  push      00402025    ; \\.\SICE
5 Q' E" u, a$ n# u; N  0040106C:  call      CreateFileA
( y5 h3 a. @1 F, m3 t7 l  00401071:  cmp       eax,-001
3 {) c& n- _' E  00401074:  je        00401091
2 H1 D) W# `+ B* |
8 \+ W3 n  x8 t+ W, s" A, J+ S7 A6 \- K0 d/ F5 Y( ~
There could be hundreds of BPX you could use to detect this trick.
: {6 p! }, Z, ~: |; C2 w% ?-The most classical one is:  p% z% \1 L: S* J: T: m7 @
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
" K* Y3 ]1 m! i8 X1 m1 r3 p+ w    *(esp-&gt;4+4)=='NTIC'( D5 O* k5 q/ d2 Y# Q) r
* W* s2 v8 T3 V4 k' {$ r: p
-The most exotic ones (could be very slooooow :-(+ q$ |9 \3 w, O; T- b
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  2 e( s& A5 |1 L; s
     ;will break 3 times :-(' _5 h9 m2 V9 ^+ T1 W- [: R) q4 n
2 m8 w4 p! j! o; M5 B
-or (a bit) faster: 8 \/ T. A8 s( v$ k5 E
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
: z9 `3 e& N6 p. j8 S, h( k. p  A% ~
5 t/ @6 B: ~7 A$ M& [   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
6 ~$ J8 V; `  d! {1 U. D) \     ;will break 3 times :-(6 U! U( s: w# @$ c
" Q2 O2 V/ v: a8 f
-Much faster:
, A# G) x+ r: _  b   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'3 T7 \( H9 z9 I* L5 H; }$ q, ]. b
3 _" }9 z+ Z/ p) }  ^/ _9 g- b
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen7 R3 h' p2 E  I- ^
function to do the same job:
5 @( }* l$ j( y: E% t
. Y4 q' _7 T8 g) U/ Y- Q9 M   push    00                        ; OF_READ6 T$ A# {0 I/ J; v
   mov     eax,[00656634]            ; '\\.\SICE',0
) u: n' U* x+ G/ `* Y0 z. b7 a   push    eax! e& I9 y  t$ x3 B# |9 U
   call    KERNEL32!_lopen. s  H' O. k" x5 r1 p% y
   inc     eax
  Y. T" p3 j& b6 g   jnz     00650589                  ; detected* `: K! I" N; E0 \/ d  S; r
   push    00                        ; OF_READ# }/ C; D! c9 U/ v6 Z, M0 ?$ z
   mov     eax,[00656638]            ; '\\.\SICE'
- C8 P$ X! t* x" h8 _1 d   push    eax
$ x8 L" |, o$ u3 B   call    KERNEL32!_lopen
' g3 `+ Y$ I% T6 @8 G   inc     eax' A1 F. }  Q; m  f; p% |1 H9 M4 |
   jz      006505ae                  ; not detected
" p3 g& G. L) \% j$ O
" d2 q; @3 Q; U( a  X0 k: D+ u, c, I6 o% x  @0 x
__________________________________________________________________________
9 b% `# |$ g9 x0 N, J3 R
! P9 c$ V0 N2 p, |. d7 q, b+ m) GMethod 12
  w6 r# O" w7 T7 c=========
$ h* f. Y0 v+ b3 h9 v+ O3 v/ a# ^* {, f  D6 S
This trick is similar to int41h/4fh Debugger installation check (code 05
( A, m( @( ^1 d7 ]* {/ i! |&amp; 06) but very limited because it's only available for Win95/98 (not NT)8 P( |" G% t. R9 C; Q
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.  r* Q# I$ |% o' k" @# [
5 i, g' R7 E1 w  Q/ X( A
   push  0000004fh         ; function 4fh
( _) S9 E) J% H. }' a) [: g9 k   push  002a002ah         ; high word specifies which VxD (VWIN32)1 I3 P3 z, z% s9 q$ g! ?/ c" y
                           ; low word specifies which service
/ `. }# w: _/ z+ T7 y$ {# G                             (VWIN32_Int41Dispatch)" Z" k  N4 a# w' t
   call  Kernel32!ORD_001  ; VxdCall
7 y, J5 |. C6 `* D& @- v" p6 i   cmp   ax, 0f386h        ; magic number returned by system debuggers
# C6 ~' N5 Y) n1 L1 F& G   jz    SoftICE_detected
6 ]$ ~3 l% d5 w1 O! N
  k+ y; o7 Z( i0 MHere again, several ways to detect it:
6 ?' f" Y& T8 R; s) ]/ S; A- Q
5 ?3 B) V9 W, T2 I7 [    BPINT 41 if ax==4f8 \8 ~& B! C5 d1 A' p

3 Q! x1 {. |/ @' z# E    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one3 Q" T) [; B: s  D3 t  X
/ K( i' F/ O: P! G+ D7 n8 K
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
! G# p# ~5 ]& H3 D0 {4 G5 U
+ w: g' Q0 j, l* x9 i7 \    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
% a0 q* Y- n7 e* Y. j4 q1 Z8 Z' D1 h
__________________________________________________________________________
: U. l- g( X; s( @% ?# }' @2 H; J
Method 13$ ^2 w) X2 _+ }; t6 w0 `
=========5 O, W, [- W/ z4 t) M+ C0 d3 g
- P- ?# c/ u; B3 n& L, q* {
Not a real method of detection, but a good way to know if SoftICE is
7 D9 ~# t0 z8 J- N# u9 |9 einstalled on a computer and to locate its installation directory./ z8 V0 R3 C7 j) v% ?
It is used by few softs which access the following registry keys (usually #2) :
2 |9 @: g$ q0 d6 i: w
2 t) S% T* _$ ^-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
& R  O6 m# P; k5 o) ~3 {$ ^# F' L\Uninstall\SoftICE
3 W5 F2 H# z* p/ A- B' D-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
, @  ^* X7 ^$ l& O4 j-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
: i6 t# n1 w# t9 r: r5 o3 ^\App Paths\Loader32.Exe
7 ]/ S5 I+ e1 P7 s2 G5 G4 w( B* \& k5 U0 O0 d$ v

8 v9 O6 l5 j7 U7 P2 }Note that some nasty apps could then erase all files from SoftICE directory
- b& C, T8 z( G. Q+ f(I faced that once :-(" @9 M5 q+ q( u/ B" E8 n

3 @, J# i$ @, lUseful breakpoint to detect it:5 Z) e+ V6 _3 v, w& j, V

) Y, w$ r% k5 K: s- ^+ j1 R     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'9 [) ^" j* F% y% I6 L# m3 ~8 ?) S

3 h4 I. S5 }7 r1 y__________________________________________________________________________
' X- Z) y2 V  \) c
/ _1 q: f; c0 X1 u* t; H/ W6 L0 r* S- `: T2 N0 p' Y9 D8 |! B- Z3 g
Method 14
) G' p% E/ S2 Q1 W# j# s3 h=========! ~. ?& }% B% H; u

" j  \; H0 H3 JA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose9 H$ f% @. i. Y
is to determines whether a debugger is running on your system (ring0 only).
; ]# Q9 C* H* i% s
# K8 M: f3 O5 D   VMMCall Test_Debug_Installed9 }# b( s8 n. h6 f1 l) c
   je      not_installed# o0 H4 }/ B- y0 U% D1 Z9 |

+ O9 _3 Z/ ?- D. {$ c# @This service just checks a flag.
' {5 f) s2 X+ J$ s  }0 B</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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