About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
) n1 D" `9 {  n/ R<TBODY>( \  X: U: t5 a
<TR>
# d: o9 j8 {: u/ S- w% f+ o' U<TD><PRE>Method 01
: A0 N5 s" K2 F  W+ U* I=========- f; j1 u/ i' g3 N4 Q+ H3 x

1 [' v6 M  t) Y4 {: yThis method of detection of SoftICE (as well as the following one) is
! ]9 H+ W. u7 D) ?3 E( Fused by the majority of packers/encryptors found on Internet.$ A  ]8 v! p8 S( z0 f+ t
It seeks the signature of BoundsChecker in SoftICE
6 g0 [( U0 n- L1 l$ g- |. u& F3 i. n
2 R5 z1 b( ^/ @4 @/ G1 L  O% b    mov     ebp, 04243484Bh        ; 'BCHK'& z# e4 I0 \$ v. Y
    mov     ax, 04h8 m+ T7 T. Y  L# f! `4 T
    int     3       - c2 w& l3 r% i) K& C
    cmp     al,4+ N0 G& q9 r5 g6 P# f
    jnz     SoftICE_Detected
3 [) _) F/ ~/ d0 p, @
, A: ~$ P. I/ L: r4 O___________________________________________________________________________6 H8 Q2 P1 b8 P) ~6 F% l* V, r

; }8 z) @* \" k8 t# }Method 02
+ ]& k% u/ S  ?' B7 |0 ~=========9 [: m7 j) F$ w$ X9 R& J: y
# ^" b6 K. n3 p- H
Still a method very much used (perhaps the most frequent one).  It is used+ I7 r* Y: d, f1 R  p
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,9 b7 W/ e+ F' R. Z# @& P5 E: G+ c
or execute SoftICE commands...
( i# t! d( W1 k/ EIt is also used to crash SoftICE and to force it to execute any commands$ r% L* Y- G/ Q$ _2 p) g6 [
(HBOOT...) :-((  " @9 {' b5 Y' Q3 H9 B, d

; W. Y# n6 {! vHere is a quick description:5 k4 {8 m  ]$ \8 b# F
-AX = 0910h   (Display string in SIce windows)
7 r/ r" z; x6 y) ~3 j, B% A5 x-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
2 g/ q2 e4 ^2 \# U  H3 F  g  }. k-AX = 0912h   (Get breakpoint infos)
+ [! w& M0 r. l* M! i% Z" a-AX = 0913h   (Set Sice breakpoints)+ c2 g& u# B( _; C, c/ A3 D
-AX = 0914h   (Remove SIce breakoints)2 U* v; n' D1 L6 p6 n# D& E3 R

* H; `8 I! h& tEach time you'll meet this trick, you'll see:6 n0 y4 H* P: C
-SI = 4647h0 ^$ F' C# w& k4 u4 i" h7 U* p
-DI = 4A4Dh
7 K! ^+ m6 o/ @  @/ U2 ZWhich are the 'magic values' used by SoftIce.# F* B5 y$ W" {. `
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.- c) e' K6 c6 z3 Q! P

2 u  P- @- _6 v1 J! pHere is one example from the file "Haspinst.exe" which is the dongle HASP  C; N* C- S; H! u* K
Envelope utility use to protect DOS applications:  _/ y6 O6 r3 o0 I; g; D
: ]5 G* [& p/ {7 v3 s. u' F7 m
. X( {2 s; h' p0 B% h+ k
4C19:0095   MOV    AX,0911  ; execute command.
5 d0 Z5 h/ Z7 L( M; ~, ?: \4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below)./ {; z: R; A& R9 i( l
4C19:009A   MOV    SI,4647  ; 1st magic value.- X# F3 w8 F& E( r6 r
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
. U7 E6 g# N1 h9 H# ^  R4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
3 `( C) T: H# Z1 _5 a6 ]4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute! z& o0 L( Q: a- ~
4C19:00A4   INC    CX0 Q5 o7 c) n8 y2 Y
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
# t3 B0 }" ^! r4C19:00A8   JB     0095     ; 6 different commands.
8 \0 W& M0 O) t$ Y! q+ ]/ K6 G4C19:00AA   JMP    0002     ; Bad_Guy jmp back.9 I5 y' \' T. e
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
3 v; i. @, i7 ^
' U, ]5 x. l8 i- ]6 `, fThe program will execute 6 different SIce commands located at ds:dx, which! d& H$ a9 j& C3 C0 o9 g1 ~
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
' B/ a  j$ h' n  B
2 z' a2 y) }: C9 K+ R3 l* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.: \- J) A2 _: Q+ H
___________________________________________________________________________) X: f: J: g$ I* Y- H  `

4 l9 M1 x, g: m1 t: w3 o, x, Q; ]$ `) r; t
Method 03; v3 c- V# ~* Q) \7 o2 X
=========
/ a0 J5 h4 t5 s8 p
' {) ~$ Z7 @2 @; p- j: v1 hLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
4 {3 A* _* L* E: X9 p7 L7 D(API Get entry point)
- T( |1 _5 k# V+ \, [        
, h8 H# ?, v9 b7 |
! P( F5 H$ ^2 Z# [    xor     di,di4 V( P5 D; E: P8 [) f
    mov     es,di5 Z! \4 E: |4 c
    mov     ax, 1684h      
" Q9 C0 m6 y' Z' ]* f    mov     bx, 0202h       ; VxD ID of winice# q5 ~% n' z) s. j( j6 J
    int     2Fh
- ~: S- g2 F' r( a# s% I    mov     ax, es          ; ES:DI -&gt; VxD API entry point
! v% ]. U7 J4 ?' x1 f& @    add     ax, di
! H+ @$ L; I( E! x' r    test    ax,ax
+ d! D$ S9 i6 c* N" Z    jnz     SoftICE_Detected
: ^" |  X% ~1 m9 r0 D
+ p( j1 h& ^5 q6 ^7 d7 k( e___________________________________________________________________________" O; J3 F1 A' ~/ h2 J

" j& J( u, a# B$ Y5 h% rMethod 04
% L% x/ l7 N; u$ v+ i; e6 x- u; R=========2 V& @- Z$ D7 }7 B$ T8 C
3 F. R2 `- E% f/ J6 s
Method identical to the preceding one except that it seeks the ID of SoftICE$ u! l* `2 b: }* V: K" ^8 Y2 U" Q4 U
GFX VxD.
2 \* I* C- z' g* r  Z" U& \' d
! C1 j% P8 r- W- \; L5 M9 l    xor     di,di
6 m3 V0 k0 \! K: C2 {# U  i! }    mov     es,di  y' R. Z6 E- s, p6 h
    mov     ax, 1684h      
' \$ n3 \- e; n# t2 f. n    mov     bx, 7a5Fh       ; VxD ID of SIWVID* [0 J) w# p9 A; b  B* @
    int     2fh' j5 Z5 k4 ^" t+ q! j
    mov     ax, es          ; ES:DI -&gt; VxD API entry point1 x. P6 B, M& n1 _/ f3 \2 {0 K& s
    add     ax, di; w  i3 Y$ {4 \% v$ l
    test    ax,ax+ q# S  ^3 l# a) a1 I) j1 _
    jnz     SoftICE_Detected# H6 u2 u4 E8 `

$ f% l6 N% W, w9 p) W__________________________________________________________________________
: @# h* B1 T" P- T
4 \. U: I5 k5 G6 @6 }. v
. N  L6 S5 Z( @" J1 {2 i/ pMethod 05
: v; z1 o; X. x, K* h/ h=========" O  r: Y. k0 @' e  r, W

- |! B  q- e) Y' n& J' j3 g! z. SMethod seeking the 'magic number' 0F386h returned (in ax) by all system+ ?0 `+ \3 |) W4 P+ \, s! v3 ]3 e% X
debugger. It calls the int 41h, function 4Fh.
+ O7 M- d) E) Y$ \There are several alternatives.  
' {  B# U% ?1 m8 i
% c% `, W+ C+ f* e9 JThe following one is the simplest:8 \0 q; a# b! E/ c5 B
/ ~7 ^% G  Q. l# s8 r
    mov     ax,4fh
: O, D7 m. E3 u& F- y1 [9 w7 E    int     41h2 n, [6 `- o! c' Y3 ^9 D1 {" Y
    cmp     ax, 0F386
3 z6 s# w( K2 r( q) j, N" |/ ?    jz      SoftICE_detected3 S+ K" W+ H. X1 s0 A
2 i" P: b" o: ^; H/ @

- [" }  i$ w6 H0 @: l$ s: TNext method as well as the following one are 2 examples from Stone's
8 A% x8 e; R, X% ["stn-wid.zip" (www.cracking.net):  G0 e# H( ]* Y) V
, B' k, i8 D1 u7 i
    mov     bx, cs' t8 v' D3 J" N4 b
    lea     dx, int41handler2
4 g8 v' z9 r8 ]" H    xchg    dx, es:[41h*4]1 z! ~8 r0 ^( `. ~, T: b! \
    xchg    bx, es:[41h*4+2]7 Y' @8 n& l: b
    mov     ax,4fh! d0 ]( g" l! G# x  x) C# V; E5 z
    int     41h
* X4 c  c' K' C& {! P8 w    xchg    dx, es:[41h*4]
( ~1 Z* V" _8 R, U    xchg    bx, es:[41h*4+2]
9 m2 \( o/ k" m  N- R6 H& s/ B    cmp     ax, 0f386h% B% S: x( \8 X' F8 K
    jz      SoftICE_detected; D' D( D. b  Y3 J- ]$ t* ^. r

1 Z0 X$ [; q- z4 ]! k, A3 jint41handler2 PROC# f6 I1 S" U4 k; D
    iret3 m0 y% ^6 t$ C0 @* y6 f+ {( a
int41handler2 ENDP+ t3 t2 D* b+ K- u

5 d% ~3 g8 ]/ }5 J# d0 q1 w/ s3 _# C1 }' p( Z6 w9 m
_________________________________________________________________________
& E9 U4 ^( I* R1 A
! e8 b% {# b6 r$ p9 B
, F1 |; A! x6 {* ^5 L8 B: W7 eMethod 06
; Y" Q; N3 D( N& ]* e=========
4 \6 I- J* o) I1 k; [  d7 A; h9 {3 r9 p; J" r" G: R
- k: A* Q6 H5 l
2nd method similar to the preceding one but more difficult to detect:
1 N$ [4 m0 n2 ]' G; e) u8 g1 |% b" o" {3 |7 f# R

+ ~, j' m8 X9 Y, S* s6 a* ?) Dint41handler PROC, o8 _% Z0 p, {3 W1 L: g
    mov     cl,al
! j9 [" L) A7 A6 D+ o    iret1 h  r1 m& Y1 F! Z0 K
int41handler ENDP
! Q7 Q' C5 y3 W2 K% z: i% j% {1 ~* `1 Z- h  u
: x: q" Z+ N% B8 N
    xor     ax,ax
% q" ~2 r* {7 q; |' Q    mov     es,ax2 W- I  u+ o/ e6 d6 b* A
    mov     bx, cs
5 t4 Z. p0 v7 g7 f    lea     dx, int41handler
4 k* G$ Y3 x3 z( j* Z    xchg    dx, es:[41h*4]
( X( a. Y+ L: Z. U9 H    xchg    bx, es:[41h*4+2]
  ]5 W+ A& t  q4 A! g0 X, C& R    in      al, 40h
1 y% F. e. e' F) F    xor     cx,cx" b  a* w! ^5 ^0 O( F# Y
    int     41h8 |/ F* {0 S0 H' G/ o
    xchg    dx, es:[41h*4]" {! o' F, @/ k; B  y' V
    xchg    bx, es:[41h*4+2]
0 @* C) n2 n9 T2 S4 m7 c& Q    cmp     cl,al( B) `$ G5 X2 C4 J4 ^
    jnz     SoftICE_detected
" G- ~+ w0 Z, g  V; I" ^
$ `$ ]: m0 a! X7 ^_________________________________________________________________________/ z4 m& X+ d* |, U/ m5 D. L
7 z$ x: S' T1 J6 z1 i2 F4 @
Method 07; z. l1 j" Y- r. h6 }, Q1 B
=========
) o- s. R/ h+ a6 y9 S' T* E: l3 @" t0 E  k+ h4 r2 N% ^
Method of detection of the WinICE handler in the int68h (V86)3 s4 c- Q7 ?, t* |8 q# [3 E

$ o+ A: }% r( I( A+ N. s; E    mov     ah,43h$ K: T9 |# E0 d& J  Y+ @- _
    int     68h
3 M: M& `7 t1 y: o    cmp     ax,0F386h
- d) N, y" u: D" h) ?    jz      SoftICE_Detected' T' ]9 }4 ^! }. w

; \  I% `" H# e" `7 r; T; P7 F  `/ q4 F% n2 i$ a) I
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
# T& N$ t9 F0 P4 N   app like this:
1 i: g* Z1 n8 c! }
$ L" e8 q- |2 f, N4 v8 t. [   BPX exec_int if ax==68
/ D  k* ?! A& h5 w* w; Y: a   (function called is located at byte ptr [ebp+1Dh] and client eip is9 F# ~0 _  b* n- D0 ^
   located at [ebp+48h] for 32Bit apps)8 ~1 {5 S6 M; g9 Q5 K4 _  J
__________________________________________________________________________* A7 ?; `: H# ]+ v# _; Q! f3 {7 }

/ m5 I+ ~$ u' n9 J, [$ ^3 W8 c0 x1 F2 Z7 l6 P
Method 08
) s2 [  D) N$ F: I+ O" J=========
; J; a' q! B- r
0 }2 |9 k# ]% P" @. K( e0 _  LIt is not a method of detection of SoftICE but a possibility to crash the
$ b) @7 q1 l0 t6 I; t# wsystem by intercepting int 01h and int 03h and redirecting them to another* \, D2 G( l# G' N5 Y
routine.% y( o: ]/ l2 N/ y' F& h; }
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points3 Y/ [0 K$ W: _/ }7 r9 O
to the new routine to execute (hangs computer...)
& b4 b9 b2 l4 d+ J. ]3 [
! ^8 V3 T; |6 \. L, Y    mov     ah, 25h; P) a* ^/ [( Y" W/ S6 v) O$ ~
    mov     al, Int_Number (01h or 03h)
( t6 q( o. {1 u6 a) q    mov     dx, offset New_Int_Routine
7 S! C2 m' B/ w7 j    int     21h
' l' x! \9 u' t# k: p6 B6 {1 C
+ u& j/ C" p: \, ~1 ~/ j9 `__________________________________________________________________________6 {% z5 b& F" S, Z/ ?1 r
9 X0 S5 j3 x% b/ }: L( c8 o5 ^3 u
Method 09
' }6 _6 z4 C$ q, B=========$ C7 u( @+ A3 Q' V

$ \) ]$ Y, q7 eThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
9 p$ p8 F8 r) V* G# L& Z- m7 I1 kperformed in ring0 (VxD or a ring3 app using the VxdCall).
- ]) a3 Q2 g% L3 G+ N) \The Get_DDB service is used to determine whether or not a VxD is installed) N( b) a4 m% w& h. ^
for the specified device and returns a Device Description Block (in ecx) for  z7 t% ~  j% r: w
that device if it is installed.
" X0 t$ Z2 [- f# Q8 |4 Y1 a0 S1 Q2 @/ x
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
% A7 s7 R8 U1 V7 L6 K   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
; j# i3 c0 I8 w3 x! ]( d# c+ i. @   VMMCall Get_DDB
0 l, b. ]& p2 \4 H+ j. Q9 u   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
; p$ J  o* k0 _( [4 w3 r% ], [
5 l; \- [8 [" Q* w# n4 TNote as well that you can easily detect this method with SoftICE:
$ B, X; k- }5 _% I) l+ w   bpx Get_DDB if ax==0202 || ax==7a5fh
/ z  \$ N. X0 m" r- h$ k' b( _% w8 c
0 M% x! F$ e, D8 n& X; u- [- |, X* y! s__________________________________________________________________________
7 h% R9 ]. P5 d4 h% ?( n; i/ q3 [2 r4 Q2 s" `9 H
Method 10
6 S) P1 @* I- t$ }  ]  M9 P=========2 `3 ?: m+ B7 D& T# f: }& [

2 d* ^( L2 E9 i$ r" [5 D! U8 d=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with. x$ ]" R* E+ A  S+ u. c
  SoftICE while the option is enable!!
$ C" Y2 v4 ]5 P0 o
+ P" P; U/ X2 r+ F4 c1 S- M# ]This trick is very efficient:& H' }9 w: k8 q5 S& N- Z6 K4 A, n+ M
by checking the Debug Registers, you can detect if SoftICE is loaded
* G- L/ u" x" U) d% V- T( g+ O3 c% I(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
$ y# z* P# k& h; _there are some memory breakpoints set (dr0 to dr3) simply by reading their# ~  @; B, g. C, _& c
value (in ring0 only). Values can be manipulated and or changed as well3 b: R+ P" m4 o: @9 E1 }
(clearing BPMs for instance)
  M/ ^1 h; e+ I; N9 m9 S7 {6 L3 O  I: E# {9 L, O
__________________________________________________________________________% J$ ^! c9 a0 Q1 Q' T+ N
2 @% N7 i3 l$ Z$ @
Method 11
% }% A$ m4 |. P=========- Z. z1 R) p/ e9 e% X7 F

$ K8 s5 [) c/ g7 X# hThis method is most known as 'MeltICE' because it has been freely distributed
( ]  r4 ?* A2 dvia www.winfiles.com. However it was first used by NuMega people to allow
, i) A8 v) H& ^4 LSymbol Loader to check if SoftICE was active or not (the code is located
  r- t, w( m# g+ {" ?2 F! R1 Finside nmtrans.dll).
) o6 `8 V/ @9 S) k! `% a+ n. v7 G$ v
: b- s" O. }0 ]& d8 hThe way it works is very simple:- v( u% H" P8 r  p9 Q5 _+ N( i
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for3 {( {% q/ U0 C) Z' o- m; U2 `, ]
WinNT) with the CreateFileA API.
  E+ e/ |$ f( S  V( T/ h. x
9 j1 ]) K/ ^0 G: m; k: nHere is a sample (checking for 'SICE'):# y& t1 j0 J2 d, T9 J

' W/ E1 f* \" T) O' r% t' U2 ZBOOL IsSoftIce95Loaded()
1 f0 Z# {& q5 ?6 E+ D9 p& ~{" M/ E1 \( ?% p2 M1 M  m8 x
   HANDLE hFile;  9 f5 U5 ]) T+ g/ @" R( N4 h) I
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,; J# e' }6 X% @- e# s# W( t
                      FILE_SHARE_READ | FILE_SHARE_WRITE,/ S$ D# r# J, i& t, ]* s
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
# k1 o3 m. X. G  k, u0 U   if( hFile != INVALID_HANDLE_VALUE )
" I. r4 _& d- H+ t   {
& ?' _/ F" g7 {) B( o' E2 b3 h      CloseHandle(hFile);
# a& y) O8 X# t( T" D      return TRUE;' T; v5 b5 z& K7 B- S
   }3 }8 P' ^2 U  X9 F) @
   return FALSE;
. e! n7 m5 J0 b3 B: R$ }}
! k# \: `) i3 U- T& ?5 m# s, ~9 i2 E/ [0 y
Although this trick calls the CreateFileA function, don't even expect to be
. H/ i4 S- s4 p( G0 Eable to intercept it by installing a IFS hook: it will not work, no way!; v1 W# p6 O/ n6 ~5 E2 j2 {2 E
In fact, after the call to CreateFileA it will get through VWIN32 0x001F
' ?/ _8 ]0 ?# Cservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)& ]/ i3 X0 Q, h  p4 V% P- @$ _- b
and then browse the DDB list until it find the VxD and its DDB_Control_Proc( T; E1 [' H0 |/ L
field.
+ p4 t, s- M) tIn fact, its purpose is not to load/unload VxDs but only to send a
9 i" \5 i) o4 j7 l% E- PW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE); Y& Y& R# `' ^8 k5 z: \
to the VxD Control_Dispatch proc (how the hell a shareware soft could try
7 e( ]1 h7 [9 e) Qto load/unload a non-dynamically loadable driver such as SoftICE ;-).
# a# d9 W5 o. r2 F) O* L. M9 hIf the VxD is loaded, it will always clear eax and the Carry flag to allow/ K; r& N$ Y0 ^( i+ ?8 q  K2 P
its handle to be opened and then, will be detected.& z: ^( S4 }1 y2 `- k" T
You can check that simply by hooking Winice.exe control proc entry point5 o( w6 E) @; I* y1 S5 `1 B6 V2 q
while running MeltICE.) }; x' ?0 {( Y( F
4 B1 Y& U0 M; m* ]9 j- a" [/ A

* F$ s$ W; o9 D/ k/ Q3 g  00401067:  push      00402025    ; \\.\SICE
% v) q* O2 Y1 h  N8 I3 [  0040106C:  call      CreateFileA' I$ Z( T/ f0 g0 E/ q$ d
  00401071:  cmp       eax,-001
) C& k3 R2 y' H4 H: d8 a0 o  00401074:  je        00401091
+ Z# [" \/ q. ?) J9 T: ^# u2 Y* `9 G( q

- v& `  x. N# m# gThere could be hundreds of BPX you could use to detect this trick.1 d; ]( C5 [( |  P' I
-The most classical one is:
% t8 O1 Q2 b/ a/ K  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||! I9 c6 y) I' r% q+ _( D) a
    *(esp-&gt;4+4)=='NTIC'
0 U4 d. O+ @7 M$ M4 s( `* t( v% U" I% q6 |! t0 t
-The most exotic ones (could be very slooooow :-(
4 m$ b5 w$ a- C   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  2 R; {% i& }/ e& q. s9 P4 ?
     ;will break 3 times :-(/ K: H4 B+ U" L' B9 y' I
) x: D6 ]4 P1 `" d. i; o
-or (a bit) faster:
9 H' b4 t+ l; U5 M- A   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')  V. Q; [4 y5 d. h' ]
1 \' i- W! D! u9 s# h9 V
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
$ X! q: e1 D% x' o" ~     ;will break 3 times :-(
+ \6 E0 p2 U" s( b# c$ Q' D& x3 x! _& U. _% ]( Q+ ?  ?
-Much faster:
  c! S/ R% p2 R6 z   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'! g  V( b9 `. F/ I$ U9 ?
1 G& b- s7 j6 [8 _) @1 B
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen8 y; H) U7 O" ]
function to do the same job:
; g2 S9 F9 h$ [/ L0 t( c/ Z# F
1 r/ ^/ V0 `  v! [; a   push    00                        ; OF_READ
5 m- `( k8 x6 B# ^$ \- \   mov     eax,[00656634]            ; '\\.\SICE',0
2 r" ~  A1 u# s& X6 ]2 F   push    eax
' s) D2 y; ^# S1 k- ~. v   call    KERNEL32!_lopen5 B5 T/ v3 \8 h2 o4 p" k9 d
   inc     eax% `; ^* z* P  @0 `0 A/ w1 _" [
   jnz     00650589                  ; detected4 h9 u& K' n7 ^- h
   push    00                        ; OF_READ1 k; E" h7 d3 a! \* f% N
   mov     eax,[00656638]            ; '\\.\SICE'
3 m" ]* y+ y9 O& \" L: y   push    eax) T. i5 y) J5 x9 d: B6 [3 {% S
   call    KERNEL32!_lopen
! |8 Y* A8 j* X! k: h   inc     eax
$ b5 b$ T, d2 d2 V: S   jz      006505ae                  ; not detected
- ]: f8 F9 t/ [* W6 X# |! V7 y, f7 ^# E% i
4 k* P( o  N- c5 ?0 _2 a
__________________________________________________________________________9 @# X" v& G' X5 C; X% j3 V7 V
  ?; Z+ Y2 |3 U* W1 O
Method 12
' `2 ?9 [# Q+ l  v; |( G6 V=========6 \7 U4 z- S  V, |+ z* {
8 v- ~& Z1 ?* G
This trick is similar to int41h/4fh Debugger installation check (code 05* C+ Y+ w% F. E5 Q
&amp; 06) but very limited because it's only available for Win95/98 (not NT)+ B$ G0 m3 W; L" W3 U0 ?# f
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.
2 i! N4 C' G4 _7 F; y/ Y8 N/ a* x7 G  B
   push  0000004fh         ; function 4fh) _6 }7 v& i( h3 f0 F
   push  002a002ah         ; high word specifies which VxD (VWIN32)
( a- R1 a2 K: L( Y; J                           ; low word specifies which service3 R/ h9 L8 [9 x# U' C5 c
                             (VWIN32_Int41Dispatch)
% t+ e! b7 Q* G* x/ x0 Y   call  Kernel32!ORD_001  ; VxdCall
3 f/ C4 w3 H0 Z& J   cmp   ax, 0f386h        ; magic number returned by system debuggers  M8 F) K( w1 O0 p
   jz    SoftICE_detected
. F% Y" |2 Y4 ~; @1 _, S2 U! f7 p/ {0 Q- q6 \( J2 \8 v; `
Here again, several ways to detect it:
9 o" A- r& z, M, C1 J' O. N! `+ Z8 G! C' G+ U2 i, t' l# K, F
    BPINT 41 if ax==4f. N. S* ^# o  E4 M* _
+ Y2 [/ o# W9 G0 e8 t  U' E7 F
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one1 S8 Z0 t+ p% q1 c

+ i  H+ h0 {7 _/ t5 H$ k! L    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
  A: f: l' e* a) s! a7 J/ c' j0 \/ Q' n3 X
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!- M& h0 m9 U. F' ^! ?  j

6 `; l5 [4 h0 V0 x* D__________________________________________________________________________
: M  p! N, R2 S/ v  Y# G1 N3 O/ {" {- p# U1 g; e
Method 13
, J; k# _1 |% d9 M% p0 u* p1 |=========& Y  R; c3 P3 Y- i4 ]  n* n0 N4 X, |
3 ?( i! _0 {$ l8 \; j  Q
Not a real method of detection, but a good way to know if SoftICE is5 c4 s# ?( E7 Q$ O! V
installed on a computer and to locate its installation directory.
- g$ U' y6 w  B$ I. o+ y5 f) Z5 ?It is used by few softs which access the following registry keys (usually #2) :
- a6 U' ]  q; Q# d$ T$ Q
1 B6 t; h; R" C-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
' o, ~- y* V2 @$ J2 L\Uninstall\SoftICE
+ a- N& B( B1 |- F-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
- B5 D6 C( a) m8 M5 b' ^, ]-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
9 [0 c# N* ?# x2 S\App Paths\Loader32.Exe3 a" B9 c4 g$ c5 C$ L; {; Z- q" x. f

2 Y) `- _7 I8 r3 P: a& z# {/ l5 M2 K8 p( m& _: ?3 x9 u6 b5 r/ {5 N
Note that some nasty apps could then erase all files from SoftICE directory
" V) u( N) {8 n# ~+ b+ m& f(I faced that once :-(
! Q1 \  u+ |: z3 A9 e; a, X% ~! [" z# P  X/ n
Useful breakpoint to detect it:
( L8 f) _4 o) q- n* O/ B- \9 z" X# }) Y) P  h* B
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
* R0 }$ H* V; M- C" {& z' p9 d& Q" {3 @+ A; F0 }) }, C
__________________________________________________________________________
  l4 a3 o. e5 q/ W+ Y% i
  T4 e! F' l9 m8 [0 E: @' F, A$ o. F0 B
Method 14
# o$ S3 n6 I5 i# e=========
7 Q8 ^9 D) p; b
+ a! i% a0 i4 h3 t$ d) PA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose$ d" l' q9 ^9 M; O9 \; d
is to determines whether a debugger is running on your system (ring0 only).3 W$ a9 M9 F6 T6 [( P  i+ n
0 ~0 N2 e5 J& T8 w, f( ]4 S5 ]1 O
   VMMCall Test_Debug_Installed' b4 k+ j- w6 u: {* W. Y3 E
   je      not_installed
* h( j$ ^: c) l( W! C9 |, S1 m4 q7 x2 }0 E! n0 X) ?1 f
This service just checks a flag.& w& x: t/ }! W6 a5 `- ]
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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