About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>4 W8 i2 P% W: E8 I; `" W0 p6 }7 d6 W
<TBODY>
9 |: u- h: w- D! H<TR>3 i# r6 o2 I$ _  W& m6 Z
<TD><PRE>Method 01
. U- ~5 N8 O  B8 {1 Q=========
: ~9 }2 X1 B! Y5 ^/ p4 |; W; k4 I% u9 l0 Z
This method of detection of SoftICE (as well as the following one) is* o+ ^2 s2 ~: C! }/ T9 e* A
used by the majority of packers/encryptors found on Internet.) w1 Q9 d( A* ^# A" Q: Z0 b
It seeks the signature of BoundsChecker in SoftICE: C  u. u. f2 i+ i3 ?- Y% K

' H- d. y( r  G9 F$ E    mov     ebp, 04243484Bh        ; 'BCHK'
3 J: D! ?; E  J3 Q! H4 l& K    mov     ax, 04h
6 {7 @( z% N3 T+ p/ y; Z    int     3      
! D0 A" {) o6 C! l    cmp     al,4
' }, i5 F7 D. b! W# N& Q& {& H    jnz     SoftICE_Detected
; r) K& {6 C- T
' y6 X; w* W$ T7 f" P7 A___________________________________________________________________________1 G) g, h8 |! @- R! p

. F9 E" R! X6 b8 C6 M% z7 [! |Method 02
1 V8 ?! j$ Z; P6 X=========* C6 V3 L+ v& m0 V& P; {

' z; [$ V$ {1 T2 L2 R4 ZStill a method very much used (perhaps the most frequent one).  It is used
; v1 n+ H! G  J3 R( x, Vto get SoftICE 'Back Door commands' which gives infos on Breakpoints,
) N2 F9 ]2 z) V- g; D2 `or execute SoftICE commands..., @& E9 w7 o4 d- g9 v2 B
It is also used to crash SoftICE and to force it to execute any commands7 {' r7 a" f; k4 G4 M1 q
(HBOOT...) :-((  + c& y3 `3 V7 o
# M4 X5 W) H4 @- |+ C* g
Here is a quick description:
& Z! A6 V* u' N7 `-AX = 0910h   (Display string in SIce windows)8 f1 e" ]5 l: L
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
5 _" {' `/ ]8 y; p1 W  n-AX = 0912h   (Get breakpoint infos)
3 [1 n% L1 r2 W-AX = 0913h   (Set Sice breakpoints)
2 {6 G5 u' G# C-AX = 0914h   (Remove SIce breakoints)
; z6 c/ R4 Z9 k7 |
* ]# J1 E$ O! w9 J0 pEach time you'll meet this trick, you'll see:
1 t& S; |. a5 G- h9 V7 m0 |-SI = 4647h
0 U# @' n1 U% F* ^/ P7 Q1 z, ]-DI = 4A4Dh9 G- N6 G9 o) S" g8 [% N
Which are the 'magic values' used by SoftIce.
! H9 E# K! v8 k. a; GFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.2 m3 C" J  G  k2 t
. c  {; g; i; ]3 e& ]
Here is one example from the file "Haspinst.exe" which is the dongle HASP
8 b' Q% t8 B% E4 a* w+ k: EEnvelope utility use to protect DOS applications:
( y! v% ~1 J) m: V9 v: o( W4 P2 Z4 P1 r* W) P5 `/ z: |
4 p+ k% ]& E6 S" o1 e" i+ \* A
4C19:0095   MOV    AX,0911  ; execute command.8 J% \3 V2 c3 [/ v0 _
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
" h7 W; }+ Q5 w/ ?4C19:009A   MOV    SI,4647  ; 1st magic value.
+ C5 J3 T5 I. w, O, f4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
# I/ z! Z( t1 w& u1 p! c3 ^4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)& o7 C& W0 R+ {6 t2 H. G
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute: g4 c' k# s: G. f# R  m- J
4C19:00A4   INC    CX" k) f/ I2 Y0 v" i+ A; p
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
( P0 L/ s: h; y5 b" l$ Q4C19:00A8   JB     0095     ; 6 different commands.8 V! @6 ]' Z* U/ ?: N" g: T
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
! f7 e  a  T- I& a+ w! K/ x9 S4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :): L( m) u3 J1 p- _. T8 C

: L, o% c6 ]4 V' y; z9 V  Q" kThe program will execute 6 different SIce commands located at ds:dx, which' q% c/ V8 |0 ^9 ^) `( S& r
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.  k# Z" H# \8 i, t* C, C2 g2 X- ~

- p9 ], w+ U- t! f: x* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
: v$ o" s, ^* j+ m# `2 H___________________________________________________________________________. |5 X5 l& e; x) L1 W
; z, T; D! B; L' O

& Z) ^5 j$ F. ?. tMethod 03
% x3 ]& v* ~8 b=========
& x. r8 t- q/ B8 b: k. A- l, B6 t' {7 P1 N  Z* Z4 @: ?& ]( r+ g: o
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
/ y, k$ r1 d/ o! Y( z* O(API Get entry point)7 c: ]4 x- _7 R( i- |
        , A4 F( P- R  x

, N# ^; C! H  \% J    xor     di,di) ^4 ^9 \* t0 o! z% ~5 ~
    mov     es,di
, ?# v# ^8 W8 j5 q2 N- }1 j    mov     ax, 1684h       9 C/ c3 U8 f& G4 K8 ?  O8 ^! S! i
    mov     bx, 0202h       ; VxD ID of winice. ^. x. i% V% n9 v. s
    int     2Fh! ~0 [+ |7 |: q3 ]& S
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
" W4 K$ c8 N3 H: @    add     ax, di' O5 m  w5 I, a) b
    test    ax,ax
% ~8 R: }+ K+ y9 \4 W2 H: \; L    jnz     SoftICE_Detected
( c- N/ A8 q7 B) P. w# g* [+ y# P1 T6 w  g2 v, B  d
___________________________________________________________________________  Q$ i7 t( ~) {

5 R  k' x% i' z* e$ x0 _9 \% `' B* ]Method 04
6 m$ w5 _+ W8 G; w: D, o8 P) E=========2 {: J' _% d4 Q" ^, n
5 `4 i+ c8 g- l5 m2 e" \9 {( c" z
Method identical to the preceding one except that it seeks the ID of SoftICE
& ~8 Z* u& m9 f( UGFX VxD.1 U7 t* \+ e, C6 }6 V8 S5 D6 K8 ~

& ^; E. |- g2 d5 M; E* k+ L) d' ~    xor     di,di# P& V0 p6 P* M  o
    mov     es,di
! }8 c0 }9 S  ]    mov     ax, 1684h       ! @3 A0 i# ~4 I1 P  h: N& D% O) e2 u0 B
    mov     bx, 7a5Fh       ; VxD ID of SIWVID5 v3 h  e# B/ }" _6 j' Y1 ]
    int     2fh
  b( N1 Z8 l+ ?( b9 K8 E    mov     ax, es          ; ES:DI -&gt; VxD API entry point9 h. J, n4 }4 |
    add     ax, di
, e/ \1 `" Z! X+ V8 P    test    ax,ax
* E8 ]  J: s* D: i2 n    jnz     SoftICE_Detected
. Z  ~: d/ n) q' \. a, C
+ w+ I1 c0 @9 ~2 r; |4 R0 p__________________________________________________________________________
# C7 u% j' u: r4 B# s8 a0 I% z4 F0 Y5 C# K  D* S7 j: _% v
" ^( ^. {! Z; Y# `
Method 05
* B/ E/ z" n0 p0 ~: U% S# L! a9 d=========) R1 |, D$ U! H
3 L7 y: x. h! N, A, }7 l
Method seeking the 'magic number' 0F386h returned (in ax) by all system3 H" K$ A  K  `" |; Q' s; A7 P
debugger. It calls the int 41h, function 4Fh.
& }1 V7 o! R  D" I3 MThere are several alternatives.  
- s% R2 X6 H3 f+ p7 C$ q6 n/ `, X# O) _* k1 i
The following one is the simplest:
" e7 L* \. c6 ^* _; J& [( I% _
    mov     ax,4fh
# }* L, P, p6 L* I' ~) @* `) b    int     41h7 S1 S2 @: l! }: A9 x: ~
    cmp     ax, 0F386! u% K; `6 }4 j  ^$ F1 `3 i
    jz      SoftICE_detected' _0 d6 Z* ~$ W0 d/ o! t
. j# p& X2 U2 q) y7 }8 z2 ~; m

1 f* M2 c. o" V; ^6 D$ VNext method as well as the following one are 2 examples from Stone's 9 ]% h, f) Z: G! G6 n3 ]9 M: ~
"stn-wid.zip" (www.cracking.net):
+ L- J8 ?3 K4 [, v
) U( j2 V9 T1 e& U2 I1 \    mov     bx, cs
- O8 q- p" g' R: g) \    lea     dx, int41handler2
! O3 {% I" b" T7 g8 M; W6 k, L    xchg    dx, es:[41h*4]+ |& `3 g, d& s+ J, }7 k
    xchg    bx, es:[41h*4+2]& e; X* U" f* k* Y. w, I8 z" d( Y1 A
    mov     ax,4fh/ q9 z# V! Y7 m$ u* A6 P1 c
    int     41h) R6 \* }' W; c
    xchg    dx, es:[41h*4]
; t9 c+ h8 `% f0 ]0 A    xchg    bx, es:[41h*4+2]8 W" T. t4 U% x. x. R. t; q5 d
    cmp     ax, 0f386h
# k/ H4 N+ s: }# }! }2 Z* ~    jz      SoftICE_detected' V5 T; Y: a% k$ d: q2 |5 V

* r3 e# j7 V  A. zint41handler2 PROC$ U; e7 g( [5 S& O; _
    iret4 w- [, a. F; Q
int41handler2 ENDP
, m/ I6 t: t8 J/ X' w
& ?% c1 c! l0 B  D& \! Z4 _8 V
6 I6 q$ ?  u. |5 R! w) ?& f_________________________________________________________________________
9 b9 t) ~3 I' g8 o8 [9 L# l
) _* H4 [4 c* u% N1 E0 f5 \; {6 k! }( I4 ]3 e
Method 06
7 C" U% K: S* \: f" G=========6 E- f: R5 h6 i

% }& p$ D- C- e5 ?  ]! M* d' M5 w' W9 j: O& z: |
2nd method similar to the preceding one but more difficult to detect:
4 Z3 v" a4 R+ e  `* p& \* @
' T% |: u& e3 p4 l" z: c1 e: i  F
int41handler PROC
3 E/ w3 A: {: J- b- m    mov     cl,al- r# ^. @/ @/ Z5 M7 \$ u
    iret
: l" D  a2 ^' S$ Oint41handler ENDP4 c: z% H8 ]; `, T6 L( Q

* \9 b" c, P4 H3 c( n4 A4 }7 V$ p3 E  ~& I& |  U
    xor     ax,ax
  G0 M/ c3 e! J5 p' w$ C    mov     es,ax! t$ ?# m* M1 a3 x! Y8 d$ ?: ^
    mov     bx, cs. Z- q. o8 S" |$ Z$ x1 f
    lea     dx, int41handler
' d9 H) Z1 T0 I- e, D2 A    xchg    dx, es:[41h*4]
( F* E- D: G  a& y6 v5 n    xchg    bx, es:[41h*4+2]/ k) E& v$ d  A: Q- y3 v. s
    in      al, 40h$ B- j6 v$ p, [
    xor     cx,cx+ K- @' e% J. m  @% U) l
    int     41h- b, U2 m+ l( g
    xchg    dx, es:[41h*4]
- P# E: a+ c; N, p% ?& X    xchg    bx, es:[41h*4+2]" I# K- A' B* U. \9 K
    cmp     cl,al+ V% E0 d; M" Z- [; D; k1 y* [
    jnz     SoftICE_detected+ p' A. s4 h& R4 A4 v" ~3 W7 d

/ W8 T  {" `8 m; t_________________________________________________________________________
$ b5 ^4 |2 u3 Y# v  w3 k, E; w( p2 i# e+ M5 H9 d- {
Method 071 Q2 J: ~) I5 b
=========
; j' Q9 G+ a5 L! W" s8 o7 _
% y1 T$ Z% ~. P* Q4 e) [Method of detection of the WinICE handler in the int68h (V86)
3 X6 A2 W/ W8 h) U
9 ~# \4 R9 i8 Y8 X5 w! A    mov     ah,43h
" O8 B7 J+ p# f& ~    int     68h$ U5 d" {& m: X/ u; l. V6 \
    cmp     ax,0F386h; C  B; Z- S/ `: q, C1 E" ~
    jz      SoftICE_Detected& @! F5 z( u; H$ R4 R/ l$ k
/ E. A# p5 G+ ]) f5 j# z8 l+ u

; }& D. H+ y. s; u=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit+ t5 f5 _  E) T
   app like this:' i! y( m" U- U6 Z  w8 d

5 t: H8 l+ O+ J   BPX exec_int if ax==689 Y* f6 g  Y: \7 G0 ?
   (function called is located at byte ptr [ebp+1Dh] and client eip is: v  f2 X# ~3 a, O0 W/ v
   located at [ebp+48h] for 32Bit apps)( _* ~' i7 D9 X
__________________________________________________________________________
6 A+ T# L9 M, L& F) {+ r( |' a% F0 z; Q+ ]$ H7 c
' x% @% B$ y* J0 _. f
Method 08! p' F# T4 f7 y1 Z& m# W. u! h
=========
6 i: q/ y1 g+ R$ j6 x  U9 o  e1 q! ?5 s8 E& o# w( D/ p5 X2 J5 f
It is not a method of detection of SoftICE but a possibility to crash the% U  x$ b( g4 {4 @
system by intercepting int 01h and int 03h and redirecting them to another
# B$ `* c4 L5 ~; ]routine.5 _, @1 i! h6 g/ D* Q
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
+ B+ f' W1 ~8 ]9 mto the new routine to execute (hangs computer...)3 ^( x9 h; p+ d% _( |3 b

7 z8 y; q8 \/ W8 k/ f    mov     ah, 25h
; `3 {) I: A3 u    mov     al, Int_Number (01h or 03h)$ C5 ~) W7 ?" H1 ^; W1 B' \( d
    mov     dx, offset New_Int_Routine' h: A2 C- A" m$ T# ?
    int     21h
% ^+ W" R, Z* M; i& z& u% d2 l# U$ Q
__________________________________________________________________________7 W* `% B5 _# s* J* R
5 s, ?6 w; C; C$ M
Method 09+ W! o2 o' d/ F, C2 Y; ]' @& `
=========7 \1 ~5 D, }0 T9 N' W& n, L1 m
" N! Z7 O+ t( U" D4 n
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only: W3 n# r% W1 G' V- A0 ]8 o
performed in ring0 (VxD or a ring3 app using the VxdCall).- ^* e' o# l6 i
The Get_DDB service is used to determine whether or not a VxD is installed
6 R1 I7 f" E3 k5 r: B% _) A& p) Xfor the specified device and returns a Device Description Block (in ecx) for
+ ~" B2 o8 l6 ~. t' t$ othat device if it is installed.. {& c) j* |* {, t& W( T

& `& w/ p1 V, `! I# [0 [   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
7 o% l* e2 v) p4 d( g9 F   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
4 ]0 j% j3 Y( I  B$ ]   VMMCall Get_DDB" N* X8 X1 G% y- L0 d. |5 N1 |
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed9 ^: f: ]% l9 Y6 C8 \% o4 z$ m$ f
& e, Y! E$ W0 V
Note as well that you can easily detect this method with SoftICE:9 W3 b" h+ \4 B# T- g0 Y# t" H
   bpx Get_DDB if ax==0202 || ax==7a5fh
8 b, n3 G7 [0 b( Z  y( K) c' @# R* j( J7 A# K7 T( z1 w
__________________________________________________________________________
+ Z4 X' i! q, q2 w# \' a) @
& G2 l# s+ Y% E) U0 ]6 u# eMethod 10
; m' ?2 k1 ?: S( X3 s=========; b6 \% ^1 x# b1 `3 R5 r& Y. L( _

. o# [" _' w5 h% ?$ t" k3 \4 W=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with% T: g5 R! O& z. j" L9 I) ^! v+ V
  SoftICE while the option is enable!!' i* {9 ]  R& M: Y- X
% G. N9 g4 _/ H" \
This trick is very efficient:
/ G* }6 o2 p7 y1 D8 Q( }" }by checking the Debug Registers, you can detect if SoftICE is loaded& }" o$ I; \3 D! s( |9 j' {- _
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
6 ?( @/ |  U: othere are some memory breakpoints set (dr0 to dr3) simply by reading their: V0 ^# u, U  ^" X3 P
value (in ring0 only). Values can be manipulated and or changed as well
! {4 r0 `2 k3 ](clearing BPMs for instance)$ ?: ~8 x% M' g3 J2 A7 U
/ b& O3 M# i+ b' b4 S/ {1 f
__________________________________________________________________________5 Z8 _9 o& \* D4 d

1 }5 V  c% W# O; N! E5 I0 }Method 115 Q& W) V/ p1 h4 z9 N) L1 o: {
=========  I7 C9 Z$ E* f6 `

6 ^5 Q; T( u: L. r( B( u- S# `2 tThis method is most known as 'MeltICE' because it has been freely distributed
2 R9 o- e9 P7 K6 t2 t! B" b! Qvia www.winfiles.com. However it was first used by NuMega people to allow/ L9 V( A6 ]3 F4 }: k
Symbol Loader to check if SoftICE was active or not (the code is located! `! s" x9 l( v% _
inside nmtrans.dll).
* F9 P6 D* G1 b% {8 J" o- O& w" S8 \
The way it works is very simple:4 E* ^8 _+ [/ V$ w# S
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
. o3 n/ r$ o( Z! z7 SWinNT) with the CreateFileA API.
  w+ {, h0 l& g0 w; W: W; N3 b) M' ^. ^& I- j/ H
Here is a sample (checking for 'SICE'):$ ^. ?$ }& s+ I1 F9 \1 R
) b+ Q- c' I7 [. l/ z  r
BOOL IsSoftIce95Loaded()4 s3 M: |3 G6 c7 x* B
{
/ W) L2 \9 _) Q4 ~8 @$ o   HANDLE hFile;  : }6 l2 G! B* C  v: V# F9 Y) t; R: C
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,) V9 Y) f# [( \4 U2 w: n5 b
                      FILE_SHARE_READ | FILE_SHARE_WRITE,
# x$ E3 O" `$ c. p                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
0 \9 u6 {5 v" b; C5 F   if( hFile != INVALID_HANDLE_VALUE )
( B: @- H% c/ c# x& l   {
# B! h, Y4 z& D9 W. L7 S/ B/ W      CloseHandle(hFile);
/ B, T( ^' `: V1 n, G      return TRUE;
4 \& I- Q8 Z9 D   }
2 J9 \: [7 x6 @: @$ \   return FALSE;( E- [0 ?  G1 B( X
}+ Y0 C# {6 C5 o5 t3 e

" J( N1 f0 v* K0 j' C1 }1 rAlthough this trick calls the CreateFileA function, don't even expect to be
3 Q, i; k  u! P; k% y2 y' cable to intercept it by installing a IFS hook: it will not work, no way!
' F* x) F; P8 [& M7 d4 o5 s9 hIn fact, after the call to CreateFileA it will get through VWIN32 0x001F- U/ u' m6 U: I8 s% ]- `& u
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
) W0 s3 E0 W5 w5 l2 v3 F7 Kand then browse the DDB list until it find the VxD and its DDB_Control_Proc
: Z- }" `. I! b6 ^; `+ rfield.0 C" `+ T) S0 ^) c
In fact, its purpose is not to load/unload VxDs but only to send a
. C* A: P6 x3 @$ B& z9 f+ tW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
' m0 R+ t# W; |to the VxD Control_Dispatch proc (how the hell a shareware soft could try
) A- ~3 p2 T6 O, T& w. v; bto load/unload a non-dynamically loadable driver such as SoftICE ;-).- s$ F4 a  J: Z9 [7 G
If the VxD is loaded, it will always clear eax and the Carry flag to allow* N3 U" q% }& K
its handle to be opened and then, will be detected.
. M+ O' X" G$ S! T) HYou can check that simply by hooking Winice.exe control proc entry point/ I) J0 b' J: ?0 p' g0 q* i
while running MeltICE.0 r$ W. F/ s, ?& W4 n' d
; r3 T0 v) Z* g/ G3 `7 A( T

, a( i; U$ }. _+ b: s  00401067:  push      00402025    ; \\.\SICE
& O9 p& s3 ^1 ~" `, d) {  0040106C:  call      CreateFileA4 l! i8 f: W3 v% c# x7 z; Y, j
  00401071:  cmp       eax,-001
9 M) B7 @) h. \  00401074:  je        00401091
. P. J0 c& Y# c6 w) {& n. P. m8 m
1 n: [& e2 D; {
! I0 ]) o: Y4 C2 y# A* [7 |There could be hundreds of BPX you could use to detect this trick.
7 F' n( W4 L; A/ }. g2 X2 B4 l' Z) O% W-The most classical one is:# E& ^- H5 k9 V+ @+ P
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
: P6 a5 J" t1 n& z    *(esp-&gt;4+4)=='NTIC'
! |0 t/ a" D; `4 ~! g
: o1 X/ w+ G' o1 O-The most exotic ones (could be very slooooow :-(7 L. q) Y: A% x. X6 Z+ J
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
( Q+ N$ U2 ^! L9 Q( L4 U5 [& p     ;will break 3 times :-(
" u6 |; n" t& R# G* J: B8 n- U- a/ j: p4 l: }
-or (a bit) faster:
+ y/ v6 a# |8 d; z3 s5 q   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')% E; I( f, `9 M- b" R

/ ?) }: m& j$ S' ]8 n   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  ) o: a4 `, D. S' Y" q% Y; n9 {* j
     ;will break 3 times :-(  Y! h; B6 l: N0 X$ O9 G

  M  M: b, C* [' C9 S6 w& ~-Much faster:
" T  u4 P, h6 Q& M   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'7 P' Z; `- H# I1 I! }8 g

; \  A! U! k3 y" ]9 Y# J# h8 l) ANote also that some programs (like AZPR3.00) use de old 16-bit _lopen
" i* i" E; D8 D. Mfunction to do the same job:
% c# o8 Y, s, e: D; ~" a
! o4 C6 I6 R0 l2 ~8 b$ B( l   push    00                        ; OF_READ, L6 m' z: g  R- @8 I0 ?6 \' R
   mov     eax,[00656634]            ; '\\.\SICE',0
  N  `# {7 S9 Q. y   push    eax4 ^+ F: |4 d3 X0 x- K
   call    KERNEL32!_lopen0 E6 y' R! R4 s! X$ F, S2 u
   inc     eax, `2 |) R9 u. u0 ?5 Z. J4 L
   jnz     00650589                  ; detected2 S: w  p- w  D2 x' V, o6 L* ?4 Z
   push    00                        ; OF_READ/ y0 N  o) }$ O' ~  I' r
   mov     eax,[00656638]            ; '\\.\SICE'
# |8 U7 F& e0 l' O5 H! s2 I- H   push    eax) x5 M1 Y& ~7 N& C3 i6 p/ F
   call    KERNEL32!_lopen
! j0 C. F% h/ K) [   inc     eax9 f) D# j% ]/ b! ]+ Q$ p
   jz      006505ae                  ; not detected: R. z! P; d& t9 U5 q" M
5 @' v& q6 n: ]

0 }) Y$ K. q4 P& K- }__________________________________________________________________________9 ?2 D# @+ K9 n2 ^
% q) A; A" \; O' U
Method 12
! l- l: c( x. ^- g. V=========4 j3 P  X) l! t7 ^. g
! x. S3 D. z; l& i
This trick is similar to int41h/4fh Debugger installation check (code 05
  v& T3 z4 D' N4 g1 y/ A( H% E# K&amp; 06) but very limited because it's only available for Win95/98 (not NT)9 o. B9 o/ L- a8 x
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.  S5 X, [. `# Y" E) M
% `0 B/ X9 i2 M
   push  0000004fh         ; function 4fh+ h! l0 W6 q3 z7 f. x2 F
   push  002a002ah         ; high word specifies which VxD (VWIN32)
# Y* W6 v" n- j. l2 v% ]                           ; low word specifies which service
7 A8 @( W$ b7 ?' T3 o* e# @                             (VWIN32_Int41Dispatch)2 i$ a6 j% D4 R3 o" e6 j9 V8 c
   call  Kernel32!ORD_001  ; VxdCall  T) E6 q5 N2 H( Q6 Y" ^
   cmp   ax, 0f386h        ; magic number returned by system debuggers
# Q5 G* T& l; E+ u: Z5 @" b$ F+ F) L   jz    SoftICE_detected1 O1 X- G$ r5 s  X8 C/ l) _: s# o

; `: L9 X  T- P& P* hHere again, several ways to detect it:; A: Y& s8 z1 D- n

; d' S  u( S" ~( n: F( q( F3 s+ H    BPINT 41 if ax==4f
3 h# j. `6 i% F, C0 u' s# |
0 x& b) @3 [+ T& j    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one3 ?' |4 ?* c$ q. {

+ p8 S/ r/ _! w6 Q    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A  \0 Z6 \- P5 `$ A  v/ B

' S' O! X- c7 L7 W    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!5 F2 M8 ^6 M8 ~2 M4 [

' q( f* I7 ]7 F3 U% j& ~2 ]+ }__________________________________________________________________________2 b0 J: T5 W! H  Q

4 ]  X: C% ?: n) d) ?# B4 sMethod 13) \2 q8 |: F6 o3 P* ~: x
=========
1 i/ f$ l9 l; C; W$ V* a. M0 Z+ p; `5 A* y
Not a real method of detection, but a good way to know if SoftICE is
0 I# i1 z: d3 P/ I! ?- H$ p2 binstalled on a computer and to locate its installation directory.
" {. F* q9 c# f# ?5 o: t, hIt is used by few softs which access the following registry keys (usually #2) :
* U% V& P6 P0 f( d8 R' W+ T1 K' W3 n2 V8 \" H
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion4 U" |1 Q, @$ r/ q
\Uninstall\SoftICE# x" y* r6 X7 B9 E0 t8 N( I& f
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE) p5 i7 z9 n2 O
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion6 q3 W" C$ ^- z; x
\App Paths\Loader32.Exe/ @9 ?9 H  r$ ~3 P, k, |
" R& o" D$ a" ^; h

# M3 z" U: {5 ?: ~! l; ^8 xNote that some nasty apps could then erase all files from SoftICE directory  |3 a4 S& j# W) G% p  H
(I faced that once :-(
' Z5 b8 w; B& c# o9 V0 K6 r; h* p( v- ~6 m* ~4 |% h
Useful breakpoint to detect it:) i" f1 y4 ~. E8 J7 ?( e9 d9 b3 O
7 |7 l2 R: {9 F! ^  P
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
5 y4 B& Q" O" o- X" z7 Y+ q9 g. O9 `8 N0 [! k
__________________________________________________________________________
3 P9 h0 H, z+ ^6 G$ D- R- Y, L, b, G( z! _# J! W* Q+ f
8 d  g# s" l" a/ q9 x4 ~6 t
Method 14 3 `7 a7 t- h2 L  {* u5 |% E
=========* Z+ w& [; r6 ]- L4 Z4 @
" F$ @* u& W. d0 h) p# Y8 O
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
0 C( |3 c! n1 w0 Cis to determines whether a debugger is running on your system (ring0 only)., Q5 X. o" k& v# e5 k7 O" M- c
8 P6 Y0 `, y0 A6 j5 @: v
   VMMCall Test_Debug_Installed
- Z) H/ X. f( Y# e3 J4 X   je      not_installed4 Z, p% c' z+ W4 R
; k0 F& ?3 J! s# u
This service just checks a flag.4 t% {: F! `' x* ^& \
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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