找回密码
 注册

QQ登录

只需一步,快速开始

About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
' u6 _6 C$ I- r+ w5 f<TBODY>4 O. l  L3 C7 G7 A1 ^6 Q
<TR>
5 X. e6 u. B/ u. e4 n$ O<TD><PRE>Method 01
5 ]8 A7 W0 ^* N5 z3 Q3 S=========. @3 \0 R0 J- B

; k$ I7 b" F* K$ wThis method of detection of SoftICE (as well as the following one) is
$ U0 V* ]! ?3 g6 Fused by the majority of packers/encryptors found on Internet.2 ^' K: B7 w- k: {3 d: b
It seeks the signature of BoundsChecker in SoftICE
, R7 v: ?6 N: b( Z' }+ [! h
! s# v6 c" x+ A" s% y    mov     ebp, 04243484Bh        ; 'BCHK'
. P  ~$ x; z- c) P; N: X* V- k    mov     ax, 04h+ ~3 w1 @# P) T2 R, e& R. S
    int     3       / g: J+ o/ \2 Z( Y( h
    cmp     al,4
8 B9 E( r8 A0 S: |! c6 ?& K$ E: z    jnz     SoftICE_Detected
% R1 A6 N0 ], r3 O. k# J! Y' r, t$ [( q; `, H5 W& p
___________________________________________________________________________6 n+ Z* G- r  z& y- F

8 r4 M, J5 L/ i8 r6 X0 ~& q/ ]+ Y' D* ?" TMethod 029 I8 [" q( z, D& i/ i0 ^
=========6 ~# U+ K1 W/ h5 s3 F/ t
, K2 E& y. s8 \* y% E
Still a method very much used (perhaps the most frequent one).  It is used. \6 T# {$ x+ A$ k- j0 A8 w
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,/ G: L% H" _( F+ h; v
or execute SoftICE commands...
5 Z0 o9 Z! h+ _6 NIt is also used to crash SoftICE and to force it to execute any commands
5 f: T! B- `& z5 v' Y0 ?% o(HBOOT...) :-((  
; u2 J  `* W7 L4 ]- y5 ]3 J& ?& R3 W/ P% L) N6 d$ V
Here is a quick description:
) C  `1 C9 ^. ~: U3 c-AX = 0910h   (Display string in SIce windows)5 f4 F% W7 T9 a
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx): n4 X2 Z* k1 E1 U1 c2 [
-AX = 0912h   (Get breakpoint infos)/ z7 S4 x( B2 E: p! F4 S' ~  M& Z
-AX = 0913h   (Set Sice breakpoints)( Z! M* \! d+ ^' W# X/ k0 }
-AX = 0914h   (Remove SIce breakoints)
: |7 x5 H* ]* \' T* @
4 E- O/ p9 _6 \  J4 N1 @Each time you'll meet this trick, you'll see:
" V0 Y! n7 v/ g# }/ K-SI = 4647h
3 \* |. s( u! h- l/ u; S-DI = 4A4Dh, R2 b9 |# J$ u# M5 l6 h
Which are the 'magic values' used by SoftIce.* p2 K+ r+ r% |
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.
$ ~3 @% X4 a# F  C; N' s* I
& [/ d- t4 s/ t3 o# JHere is one example from the file "Haspinst.exe" which is the dongle HASP
% E. l" u) W( j  {' L: nEnvelope utility use to protect DOS applications:
4 W( Q- i/ J0 A; c. F
0 [1 q, t8 L1 ]. u/ h( g
& N1 v+ T- G& v4C19:0095   MOV    AX,0911  ; execute command.
! p- v* r- ]; O& G4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below)., c* B1 G, A4 ^  T6 t! f( d
4C19:009A   MOV    SI,4647  ; 1st magic value.
6 w% v7 ]+ S* t& K  \/ Y4C19:009D   MOV    DI,4A4D  ; 2nd magic value.& c" M3 f$ \8 Y! V; X* q
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
! k# r+ F7 w7 c- r4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
, o3 o3 v  A8 t* C$ B& v: Y4C19:00A4   INC    CX: N/ c9 y6 |7 W* }) M4 f
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute7 e/ Z( X. J& ~( H# A$ G
4C19:00A8   JB     0095     ; 6 different commands.% R7 Y4 n' `, _5 O8 Z( p
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.4 w% ?! U) m$ m# K; e9 ^
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
5 V- [- j% s: O& m; e
# R) C$ H# M) xThe program will execute 6 different SIce commands located at ds:dx, which
5 H, N' L8 [3 J# f: J8 U4 Tare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.. S) U( a" I/ a! e
4 B/ x, ?7 K+ L% V
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded., H" S* O$ P% F' J3 L
___________________________________________________________________________
3 y1 z5 e) X# s5 S1 O/ w/ {! F% a, [" N/ o) P* I
& e/ P& o! V5 h3 s7 ?
Method 030 h# }7 j7 a( o6 D# C: A
=========# |0 U: V. x5 h+ {7 ^+ X

4 I7 b# c$ |( y, R& V9 U# eLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h, Z, n) {2 J' ?
(API Get entry point)
3 i8 `" F2 P1 c+ L        
  F  p, Q1 Q6 k3 J% N, U+ c6 l
2 T' ?% T, _2 ~  }    xor     di,di4 G7 l' I; O$ o! m6 E: E0 j$ p: C
    mov     es,di
, o) t! |$ `6 M6 F; z! b4 S    mov     ax, 1684h      
. R* I) O7 J8 E" T* D% D/ Q* e5 W    mov     bx, 0202h       ; VxD ID of winice) J1 b& v2 \1 L) j: L& |% {
    int     2Fh1 j8 V* F1 s# S3 S- H
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
* A; o1 Y4 E) J- l5 k    add     ax, di1 s1 u1 H& u! A2 ]
    test    ax,ax
' s* }$ x. L# K, s, L- G! X    jnz     SoftICE_Detected
# |% [8 S$ i0 c! s  z' d3 \
5 g  m& ~' k' D$ d' P3 @' D; ~: B5 g___________________________________________________________________________
/ I7 m( [8 I6 I5 ^* a1 U  v
+ _, m4 B7 _# s0 I2 iMethod 04" J' O$ a6 j- w- X$ Q
=========2 g1 P+ R* Z. q: B. X

% o( V* ~7 a& ZMethod identical to the preceding one except that it seeks the ID of SoftICE/ W8 B" R9 I5 e6 ]/ ]8 U6 U: k1 B8 [
GFX VxD." ]+ o2 Y8 j0 T! s! Z( W

8 P9 H0 K. a# Y+ C* b    xor     di,di' D8 o  v5 X9 J4 m
    mov     es,di
  H' z& b% P0 a: `    mov     ax, 1684h       2 Z5 F0 D. r  M+ Q% G. B
    mov     bx, 7a5Fh       ; VxD ID of SIWVID  _& n) f% R' `+ S0 U
    int     2fh
( j; f: K  T% L* K" R9 R$ M    mov     ax, es          ; ES:DI -&gt; VxD API entry point
* n& \9 j: ?) g5 @    add     ax, di
8 E- |+ ~& o7 k0 \% v' @    test    ax,ax1 t! i3 [* M- N: Q6 C
    jnz     SoftICE_Detected
4 O1 n7 u% p3 B5 R; n/ Y4 F' p4 f( j+ L3 K! S* j6 b/ z2 l
__________________________________________________________________________7 f. j0 g7 ?4 q# D. E

0 b1 N, d- W& q# s  \0 J& ]4 Z' L) @2 z) W4 j* }
Method 05
! b9 ~- ~7 y* x/ V=========/ Z# |/ j- U, M: w4 `
. l( ]7 \" z) z' R
Method seeking the 'magic number' 0F386h returned (in ax) by all system
. P7 X% V. y  a$ c) Odebugger. It calls the int 41h, function 4Fh.
/ Y9 k( i4 ?% v% \; zThere are several alternatives.    F" G" d* B: k6 B  L5 s# g* q7 K, ?3 M  ]  v

; {% B) n" A# HThe following one is the simplest:0 C1 |; ?6 I* E. x8 @5 V% t, i% O

! O+ {: h% |2 u; w    mov     ax,4fh- q' o( X- J/ ~( ^& t. l, D( h
    int     41h/ v$ h8 Q& {+ I
    cmp     ax, 0F3862 f2 |3 r5 X  `) X* w
    jz      SoftICE_detected
( V' |# |' r; s4 o0 a& E. ~7 J9 V$ s: m
3 Z9 U/ d3 S- l* p+ v' }
Next method as well as the following one are 2 examples from Stone's
; u" l# k4 {! I+ m"stn-wid.zip" (www.cracking.net):! X5 g3 A! U2 k8 q

4 D- y7 b8 N  s6 [1 I, L. I: n    mov     bx, cs
# P) U6 D) L; c    lea     dx, int41handler2
1 G# k" L! ~4 `4 N$ e) k. [    xchg    dx, es:[41h*4]7 J) n; x5 ]9 ?6 j# R% P3 w
    xchg    bx, es:[41h*4+2]
" a! E, s# p5 g7 a: E    mov     ax,4fh
3 J7 q- S2 f" r. Y    int     41h
+ J: i7 r. `  i( w  U! [    xchg    dx, es:[41h*4]
6 ]5 i8 y7 _' o3 z    xchg    bx, es:[41h*4+2]
  B& l! d$ L. k$ N  z0 K    cmp     ax, 0f386h7 j3 P2 o  Q0 o
    jz      SoftICE_detected4 f% _+ Y/ Q* e+ k1 x

* h' z4 U! M, P& j1 g" N( _+ ?int41handler2 PROC% K) a% ]" e# g) ~
    iret( s+ T' @' h& b6 J0 ~! I& p
int41handler2 ENDP% s& B/ A# w; c0 L. J* g- q- e  M
% {$ O0 n9 X% |( g4 l' m3 h3 `

! i7 p5 M& H4 J_________________________________________________________________________* j; p- P) [3 S# A; ]

1 o& B& Z4 m- t# y8 U0 a! B$ d( P) z' h& ?8 x0 S. e2 h8 x8 ~/ ?! P
Method 06
( x5 K$ P- a1 n, y6 p. ~=========; i+ ]$ X+ C( O  D6 _8 v
) h4 d% G% B! F/ V( c, @( z
( ?: r7 X' |9 l
2nd method similar to the preceding one but more difficult to detect:& L8 i; y( d7 g# E  K$ f9 B+ Q

: N* y5 ?0 E- g4 d, i+ ?) F2 r
9 H; y( [  j) _int41handler PROC
3 v* t% p7 N2 k+ l8 E    mov     cl,al
+ O$ G$ t# S1 Z1 l+ Z8 a+ l    iret
# I8 ^1 _( Q$ z  {5 x1 ^int41handler ENDP
+ p7 B# v# i, N0 }- `* C: A: O% @4 A& y& O3 m

1 m% R1 M8 Z4 P+ o, v& I    xor     ax,ax6 P1 Q7 Q8 p) G' n
    mov     es,ax( G# ^/ j8 p! S1 d5 H; F
    mov     bx, cs+ ^3 f2 z1 N, |' a- _
    lea     dx, int41handler
2 |! L" J: r: E6 I0 U6 L    xchg    dx, es:[41h*4]- g4 h& ^1 M. x: x
    xchg    bx, es:[41h*4+2]% s# E6 k5 _( o  h/ {8 @4 \! x
    in      al, 40h
8 I! M; A- A$ G: z/ G    xor     cx,cx
$ L8 k: T# Z" s: ^( w    int     41h9 A; m: r4 e2 ]; I* @
    xchg    dx, es:[41h*4]0 z6 Y- d$ M% `; n+ W* J* X# o
    xchg    bx, es:[41h*4+2]
, ~9 P# K" ?) M9 k9 y    cmp     cl,al
7 I" a! q/ t- `+ s( S, }  `) R    jnz     SoftICE_detected
4 j; {$ u5 R" a- U* Q6 e! P/ }! u2 M0 U2 U2 X# h. r
_________________________________________________________________________- d8 N, ?8 A2 m8 i% K9 E3 M3 Q

  v+ I4 p* u% W; _Method 07
5 }: n5 h( ?5 J) |' m* m3 M$ X9 K5 H=========
. Q. x; K& Z' Y
4 |, a; f# d9 o$ E1 O5 x; RMethod of detection of the WinICE handler in the int68h (V86)
9 |) F+ S( U3 c: P+ P2 k! N
# J% k' d$ F3 o    mov     ah,43h& w  W! |, l3 r4 E( W0 B6 H0 }/ g
    int     68h5 V9 g0 M3 Z: G; y6 W& a( [
    cmp     ax,0F386h
. f& d7 D2 J1 j2 N7 D1 y3 f    jz      SoftICE_Detected; E. l8 b* i% ^( g
- b: [8 b1 U* W8 C: H  Z: ~% P
( [" C7 M9 J' i" o; p7 o  s
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
7 `! [' F, O2 K6 U/ X9 L" O6 y( n; o   app like this:
$ W5 n+ @* }" C5 C  p! `5 v& W6 T( N( _0 j( A
   BPX exec_int if ax==68
- t! k7 d: ^4 `( n& T( T- I   (function called is located at byte ptr [ebp+1Dh] and client eip is) }! K3 @8 t6 {
   located at [ebp+48h] for 32Bit apps)
- Z& _/ u. g2 w/ ^" }: f& L7 q__________________________________________________________________________- M- G- c( a4 h

) n! e7 V: e0 l* D
& m( E2 x9 N: x; AMethod 08
3 N, P# b+ C  }* r. \0 D=========6 i  O: v1 b5 h
4 O" L8 \1 c0 ]4 l) X! P  Y, o
It is not a method of detection of SoftICE but a possibility to crash the
. ]; d% y0 k6 x. w0 h0 `8 d& _/ hsystem by intercepting int 01h and int 03h and redirecting them to another
, A. O9 p  |3 Mroutine.
) f0 T/ i7 s7 a* ]9 ~5 _8 V1 _It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points4 s2 X* U! J- A( r  c4 y
to the new routine to execute (hangs computer...)
/ @* \, l4 y# G0 A* U
! t' g- B# m1 P, d% |0 W6 e    mov     ah, 25h
" j) s2 M. \3 d( X, F2 ]: n    mov     al, Int_Number (01h or 03h)* K( f! K2 R! e5 ]4 t0 z
    mov     dx, offset New_Int_Routine
  P% {4 C$ r7 m6 y& @0 x! |) I' j    int     21h9 B* c7 A2 B6 z- ^, R9 `: u! Q

  G' D: F% }/ A2 c5 s0 w& ?__________________________________________________________________________6 ]) S0 ]4 G2 n* ~% }

6 ]  G4 l# x: z; Y: O2 wMethod 096 g$ P6 A- L/ V& K
=========
% M4 F  c9 U# J4 X2 {3 M) u, N- e, }# Z
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only- L$ P6 m# {, ^: X/ k9 }- j
performed in ring0 (VxD or a ring3 app using the VxdCall).4 Y9 R4 S" {# [& |6 Q
The Get_DDB service is used to determine whether or not a VxD is installed9 N2 U% r* G) f- p
for the specified device and returns a Device Description Block (in ecx) for) o; L1 X4 i8 L) J
that device if it is installed.+ g; N; x) T  a

( d. U" p' U+ s% |! |* E, Z   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
; y* C* S& {1 f* n+ i6 u! w   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
  g& j( \2 s0 \& Y+ w* T   VMMCall Get_DDB8 p+ r# y4 y% K4 T# J. Z
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed! ]) S/ P" c& _5 _1 {
0 a% i5 H& K; P: t* ]- x4 C
Note as well that you can easily detect this method with SoftICE:
3 x. z; J) q1 v% e7 p2 O, f   bpx Get_DDB if ax==0202 || ax==7a5fh' e0 P+ n0 @' A# d# E1 N
4 r0 F$ T' S% d
__________________________________________________________________________  B" L4 k* G+ u* E# \0 _6 D$ o
# O1 q7 u9 w! k" x5 j: Z# ^, o: U
Method 10
( s1 j$ C7 d2 n+ s( i5 \=========# T2 }( ]5 T7 V

2 K# e7 [8 e3 @1 q=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with3 V0 u# P" _) a9 ^. b# ~# F6 u( f
  SoftICE while the option is enable!!
1 T2 g, w% ]" j! v9 j! y  V; N! Q* n$ b, l- L9 X! e" u# o
This trick is very efficient:( \% R7 I- @6 i. Y- a3 g
by checking the Debug Registers, you can detect if SoftICE is loaded
& {, ]& b  T7 V& W1 `2 R7 L7 s! D: ^6 c(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
% A7 ?* d( S# V4 }+ S7 R6 gthere are some memory breakpoints set (dr0 to dr3) simply by reading their
: T! e! A5 F0 `* N# T0 V6 \value (in ring0 only). Values can be manipulated and or changed as well
9 e6 J  b; {- ~. u6 @  F(clearing BPMs for instance)
7 ^# _& I: D0 V2 ~; {  J. O( N6 B" T. x: u
__________________________________________________________________________
+ e/ H: N( s. j' }) q6 h0 P) I
Method 11
; Y2 u2 T1 C/ w8 m- ~=========5 _) j$ ~- r9 ?. y- v

: K. G) l8 G" z8 H! B- y$ a) kThis method is most known as 'MeltICE' because it has been freely distributed
* z8 v5 `. a9 o2 Svia www.winfiles.com. However it was first used by NuMega people to allow6 r- d5 t; o6 K. x
Symbol Loader to check if SoftICE was active or not (the code is located
+ n- `% `$ H% Z5 binside nmtrans.dll).
' ?# [, H" Y. I! W# m, B( I/ G* Z8 q; @; B. H8 |
The way it works is very simple:
* c/ ^( q2 s& a0 _) B4 mIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
/ l7 E2 C5 X9 W! A1 Y3 F/ ?; }WinNT) with the CreateFileA API.
! O  Y& V: h" N6 b7 A  ?  [
  {8 v! V  e& |6 nHere is a sample (checking for 'SICE'):
, t' T2 ~4 H# n/ P9 C: t5 B3 D( `' D5 z8 s
BOOL IsSoftIce95Loaded()7 g7 [1 {! X; ^. k: a5 U
{
- l1 ?# }* W9 ?/ [% f9 Y+ \   HANDLE hFile;  4 J6 u& x, {9 b( u& R8 `
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
  |% [0 y) }1 ~! P0 R" H3 _6 W* Y                      FILE_SHARE_READ | FILE_SHARE_WRITE,* A6 N8 s+ l6 T8 V4 N3 m9 R
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);# W; o% H6 h0 ^4 _2 A/ J
   if( hFile != INVALID_HANDLE_VALUE )% O8 S% l2 I/ ^" o; P) W
   {
* ]3 i0 ~" U$ w/ o      CloseHandle(hFile);
1 Q$ ?4 I( `* n1 g! S; G      return TRUE;# V7 x# ]1 g2 P; O% N( H
   }6 n' W( @7 V1 E. a# n
   return FALSE;& k4 N. o+ }6 a1 _
}2 Z3 F3 E$ L! s: e* Z
2 P: a7 ~* z0 o; a5 Q
Although this trick calls the CreateFileA function, don't even expect to be. B+ z" W+ G5 J
able to intercept it by installing a IFS hook: it will not work, no way!+ k- \" S; a. U  j
In fact, after the call to CreateFileA it will get through VWIN32 0x001F
( ^4 w* Y/ f- L3 N: r2 ?2 z; eservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
) G. b  j0 z- V& Iand then browse the DDB list until it find the VxD and its DDB_Control_Proc7 B$ ~$ w* J- Y5 v0 }! n
field.! }7 W! U6 I/ S8 x/ w' a3 y
In fact, its purpose is not to load/unload VxDs but only to send a # {/ O- S* o+ K5 \6 J- A" @) t
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)# x' y# W, v! a: F$ R
to the VxD Control_Dispatch proc (how the hell a shareware soft could try
; V, J3 V1 j$ E6 {to load/unload a non-dynamically loadable driver such as SoftICE ;-).' O% ^$ X: }8 b0 W- V- O* x! f
If the VxD is loaded, it will always clear eax and the Carry flag to allow
6 k) I; x  l. t4 T9 _: Pits handle to be opened and then, will be detected.7 k# N2 ?$ @* ?. t/ P6 J
You can check that simply by hooking Winice.exe control proc entry point" J/ Z) d- X; `8 H0 Q5 ~
while running MeltICE.
4 A8 i" M/ M8 T& L' k8 U. h; O* v2 }, H4 S
- p6 {4 y' k0 U9 Y
  00401067:  push      00402025    ; \\.\SICE
# H6 h" U5 s7 u+ Z& r  0040106C:  call      CreateFileA2 I: k6 g# w& h8 H% y
  00401071:  cmp       eax,-0012 `; @- J8 h6 U4 d
  00401074:  je        00401091
  S* i( h! S9 X6 M# Q$ l% _5 V7 m6 }2 i0 k: k0 U9 C8 z
& S2 y' k6 S* `, q. ^7 O
There could be hundreds of BPX you could use to detect this trick.
- p0 x% r: u$ m, n: q% ~-The most classical one is:
: ?0 }( k- w. H7 Z  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
1 s& K9 }5 b1 F& v9 r    *(esp-&gt;4+4)=='NTIC'
: M: Z0 R; y! l$ [* \4 n- y0 M
-The most exotic ones (could be very slooooow :-(
" Z; B1 q* d  L2 d. i8 \   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  * M( v+ r9 @$ w9 i# ^2 m
     ;will break 3 times :-(
6 c3 F7 H/ J( ^1 A; g! i
. Z+ \3 H2 ?- U4 _-or (a bit) faster:
4 i1 z# B' |% {8 a8 I" B: L   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
' |3 g4 p& [; R% o& c) C( ?. _- |9 }8 C
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
6 X* t1 M7 E& e0 q* N1 V6 {( b+ L     ;will break 3 times :-(  o9 J& C) U- G( F
  W2 p" D/ d  H8 H! [2 m
-Much faster:, ~, N7 {* Y% ?* |/ E* x
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV', j' o; P  M; F* U
& D# E5 i$ |) R9 f6 |9 |
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen# P' D) J+ A/ l& k4 M
function to do the same job:
9 i% `& W. C3 h4 }7 ?% _! R% ^& F- R0 K* r0 u$ h' f
   push    00                        ; OF_READ
) c; p4 q  u; S' g: p6 x; [1 ~   mov     eax,[00656634]            ; '\\.\SICE',0  }* V: r8 u  q$ [
   push    eax
' B; H% g0 `9 B# ]: M   call    KERNEL32!_lopen
) m7 ?+ e- y" Q9 U- _, i/ r" _% K   inc     eax! x, ]- w9 P6 `5 ]
   jnz     00650589                  ; detected8 o) I- G- D% B0 r9 J# h
   push    00                        ; OF_READ( j, r. [5 w& e
   mov     eax,[00656638]            ; '\\.\SICE'7 Q9 p7 F: o& h/ [) a) Q. g
   push    eax" r, `/ J9 E; D& O6 n* k1 a( u
   call    KERNEL32!_lopen
7 p  P; ]" U8 J/ l% ~! t7 K) p   inc     eax
% s7 D9 E  [  r4 i- r   jz      006505ae                  ; not detected
1 Y& N  {; `. C( |, ^4 L
. ?% V. O: u. Z6 H4 D. o" }, _6 ^8 l% Q6 Y5 ?1 Y; t2 T
__________________________________________________________________________
' `7 y% R% [- g' m
' k7 d0 X$ l% x7 Q* @! FMethod 12% r% J3 u2 i/ U$ a
=========, H& c7 ]% [2 d$ k6 Q
* Y! W' ^. r8 @# I$ ?0 t6 B
This trick is similar to int41h/4fh Debugger installation check (code 05
* O+ j3 [' d  X0 M&amp; 06) but very limited because it's only available for Win95/98 (not NT)
  U) F8 ]. i4 ]$ m+ o, m1 b2 Ras it uses the VxDCall backdoor. This detection was found in Bleem Demo.% u) y$ D  r( _! Z2 m( X# d2 M7 J
. d" K5 o" B# ^+ w" y! C! b/ O
   push  0000004fh         ; function 4fh
1 n9 O- g6 R9 O7 b; ]   push  002a002ah         ; high word specifies which VxD (VWIN32)7 q# d8 T' n: y8 c* _
                           ; low word specifies which service! e" u# z1 K1 X1 m9 q
                             (VWIN32_Int41Dispatch)$ n7 B5 @" [' l( _( r
   call  Kernel32!ORD_001  ; VxdCall
$ R+ ?1 c7 A' F  i6 C   cmp   ax, 0f386h        ; magic number returned by system debuggers' I' l8 c; S# s5 r5 V; \
   jz    SoftICE_detected" |- C, Q; p& I* z
8 p8 F- E; P% V$ K  r# _% x% }
Here again, several ways to detect it:
3 j: U3 R3 G, V+ t) B# |% H4 E$ x( H" B9 ^7 j& ?& i: U% u
    BPINT 41 if ax==4f9 L+ K- G4 W" `( s. r$ O% C

- e, ^0 b7 X/ U) S. E7 l    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one3 B; l8 V& S/ f) i' a  D5 p6 E* C2 y, ~: S
* f1 X7 z' X% I! ^8 ?4 \
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
  z- c8 C2 {% o3 k% k
% l( \3 d; l$ X  `$ P    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!' \8 J. P% ~* H* V4 u1 M

$ @$ W- Z% _* _' |% ?__________________________________________________________________________
* r6 _; J! d: H2 c  ~2 |! U7 J
Method 13
; M6 t0 m5 D$ y2 U! `! e=========
8 v: h9 I7 y' f, H% b0 y, e/ {0 V3 F  _! H0 S5 U
Not a real method of detection, but a good way to know if SoftICE is
0 w% S" g' x( }installed on a computer and to locate its installation directory.
6 [1 y" K/ q: }2 G, m$ ?  G& R. OIt is used by few softs which access the following registry keys (usually #2) :' Y4 P0 G6 ?9 I- a0 z$ U
9 o/ ~$ @: w8 y, t% O# G
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion- |' U- [+ k6 N! m! O3 _9 W
\Uninstall\SoftICE
- ^* m. F' c7 q8 m/ U5 o-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
" U( g/ l' X8 d2 ^9 J-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion4 n: s+ L8 p' a) M# p
\App Paths\Loader32.Exe" a% b$ E. o. r: L

& a; E; p- z! f% {+ M, i% X% }8 t: |# |9 j6 Y1 u
Note that some nasty apps could then erase all files from SoftICE directory1 y" R* X0 C: A8 b$ b
(I faced that once :-(
* w/ r5 {, E+ d; L
6 n" n5 w5 l. u" Q! PUseful breakpoint to detect it:
, X; @% Z" A- \9 f& X* i; [, a$ s" F2 |( k" l) l, O
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'8 X% z- C4 |1 L' x6 X8 S
$ A, m/ p6 y: H7 _0 K, j! f
__________________________________________________________________________
: t% X$ ]  @4 k8 z- `, W
7 Y# K: N* ~" z1 k* p3 J: A! l4 h/ W& [
Method 14 / E/ Z; M& z1 R4 H2 C
=========
2 e2 B5 Y& F: x! S) @! x6 m( e
! v" b" Y; C9 @) k: qA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose8 P6 B9 _1 C3 q, U
is to determines whether a debugger is running on your system (ring0 only).: P0 ~7 t, I: M' @2 f9 d

" n1 p5 K# M3 `! h+ W' r   VMMCall Test_Debug_Installed
7 f0 u- P. \9 I0 L2 w   je      not_installed7 c$ j9 |1 s1 @5 \
! T, M6 @4 L7 V& r( i$ m( V- n$ k
This service just checks a flag.
2 Z4 P1 ?8 t8 o3 V9 ~</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2026-8-1 23:59

Powered by Discuz! X5.0

© 2001-2026 Discuz! Team.

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