找回密码
 注册

QQ登录

只需一步,快速开始

About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
9 C9 L9 u7 L$ C1 ~! D<TBODY>3 z2 r( @8 {. {$ P7 P* E+ [' C
<TR>! ~; n0 w' Q: N+ ]5 J
<TD><PRE>Method 01 0 h3 {/ S4 M& }7 R7 ?$ G/ U* h
=========( u3 Z  W8 ^. _7 g& |

( D0 X2 n; r& [This method of detection of SoftICE (as well as the following one) is
9 n- ]9 J: ?8 m6 \& z+ R7 Yused by the majority of packers/encryptors found on Internet.. t8 y; O: P8 u, J2 G
It seeks the signature of BoundsChecker in SoftICE) U- y! n. ]1 m, F
# g4 W( m- e# B6 c
    mov     ebp, 04243484Bh        ; 'BCHK'% M2 @" [( ^: Q% |( t# v# [
    mov     ax, 04h0 J6 G$ V5 s; e' K  C& T8 [5 ]) D
    int     3       & j) ~. d* G" c+ P+ m2 k5 e3 r' X7 g
    cmp     al,4
$ W* a: R7 w5 D1 I    jnz     SoftICE_Detected
2 Z" R. O  ^: {6 c' U8 ]
! s/ z1 [4 M  ?# |___________________________________________________________________________1 I6 o) f+ M4 E3 B9 l8 @1 G9 y: _

# ?5 k1 B, z$ S+ f* V1 `Method 02. R9 G- e1 @0 i, f
=========$ K/ ?0 q9 D& K+ }# }# L

* \5 Y( L& \( |  B$ A8 J0 FStill a method very much used (perhaps the most frequent one).  It is used& {+ K" l9 }/ d* O) }0 e2 \+ w' k
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,3 `4 ]( e7 k) z% J, X/ q) V' R- E! O
or execute SoftICE commands...
2 q4 `- a2 D1 Q3 @# j" jIt is also used to crash SoftICE and to force it to execute any commands. P  ?# l* ~$ f" n* R2 `
(HBOOT...) :-((  
% F. O/ U. m" [
5 u, m: T% H6 HHere is a quick description:
. v, q# U) [% y# K& S+ U3 E-AX = 0910h   (Display string in SIce windows)
0 ~* [, O" ]# z' L! D# W  f-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
- r9 W( L# B% x1 `- R-AX = 0912h   (Get breakpoint infos)  I0 q8 Z1 K  z$ L" R: }
-AX = 0913h   (Set Sice breakpoints)
" N3 Q& w" B; q" h1 M+ }8 f-AX = 0914h   (Remove SIce breakoints)$ C. k% t4 A: Q4 R

. u( Q  `3 |% \% g$ A+ Z, ?1 nEach time you'll meet this trick, you'll see:
* x! `* |+ M1 }7 N3 u-SI = 4647h
/ S6 R  u9 Z4 m7 E& r. g# Q: H% f-DI = 4A4Dh
* n* H% t7 v' `% _  W& pWhich are the 'magic values' used by SoftIce.
' X2 }; m  T, B# `) U' D. g7 DFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.3 u- c/ p$ l! O/ }) M+ U% t6 k  ~

/ g) A, z1 M; rHere is one example from the file "Haspinst.exe" which is the dongle HASP. v4 R5 C% @3 I! f
Envelope utility use to protect DOS applications:3 ^/ ^( n, v) {2 R0 {3 u

& _  J+ V" `* K8 C% K8 |! l+ Q# L0 {1 v$ j7 _7 W8 r
4C19:0095   MOV    AX,0911  ; execute command.5 y, E: K2 y$ @9 M! R! {. Y* H$ I
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
, F% z( R* A5 L: n; X: N: U  ?4C19:009A   MOV    SI,4647  ; 1st magic value.2 G3 i/ |( a& C9 x' M7 z
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
" _5 S0 D0 u% R" L- B; q+ a% f: c4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)5 J! @# r: S9 r4 Y6 \
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
0 X. g! I/ R; d- O- I5 Z  q4C19:00A4   INC    CX
6 N6 W* x2 x( x' b# s4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute$ |5 \1 d  \" r/ {% g
4C19:00A8   JB     0095     ; 6 different commands.( g/ y" o4 [5 F
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.1 Y* E  c- [  ?0 T
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
- x0 l; \9 D- Z- R# ?2 P! M8 Y) y( W
The program will execute 6 different SIce commands located at ds:dx, which6 s- E+ N% E) _: v! T$ c+ k1 M
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.& z6 d! v0 S$ f1 q! z0 C$ n- w% p' J

: \3 J; q$ r7 r- n; P" d* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.3 q/ ~& f' F. z9 R! S( n0 }
___________________________________________________________________________
7 I4 Q, Y3 ]3 _" \8 B# v. E2 w6 ?$ [" ?. O8 W" G9 }) V
) a2 L3 \* [/ @$ X% T$ t( w( Y; H
Method 03! S* L& C* [& q
=========
7 _; o0 L/ N' z% z: O) `" ]) y: G# i( r
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h, [9 V9 L) w8 Q1 ]  @# o# A
(API Get entry point)
4 Z5 K- V& u, ~, H/ G        
. _+ F6 s, D. Z9 {# }, ?8 q2 w
; o1 c* t( [( h; g# ?    xor     di,di
8 W+ D) J+ `0 |: Z: b    mov     es,di; o1 r# c* K9 t5 E
    mov     ax, 1684h       ) a/ `6 Z( Z4 j& D# v
    mov     bx, 0202h       ; VxD ID of winice; H9 x8 t4 j& w! E& x
    int     2Fh1 P. E. U% Q1 a6 k
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
1 Y2 T" ?6 E7 c# M8 r( t    add     ax, di0 {6 `/ C! _( ?3 K/ g3 w( ]
    test    ax,ax
$ E( V8 ^4 n. j6 Q& z, i; |    jnz     SoftICE_Detected- E; R$ g! ^1 S' i
  q  H, {7 e" |' F
___________________________________________________________________________
9 y' R( K% E0 }. T6 ~0 _7 ^9 z/ B3 U2 z& {% y# V6 H! ~8 X
Method 04
; A0 U; @0 b3 L" v=========
; J" Z4 a9 e( {6 Z5 q+ Q  \' K2 ^" m9 P  c6 C3 G6 Y% C* |
Method identical to the preceding one except that it seeks the ID of SoftICE
$ X; b3 c- ]% m' XGFX VxD.
$ Y1 z. z9 W& O1 [) ?  U" }( P* ~* e$ \5 o
    xor     di,di7 n9 D$ z0 z* [7 @$ |( k# L
    mov     es,di/ F5 B: ^, e: i( I6 H2 I0 [7 q4 }9 D
    mov     ax, 1684h      
6 {: h9 l5 r) P6 o2 j  n    mov     bx, 7a5Fh       ; VxD ID of SIWVID  [4 j, z. D+ J' m& F& L
    int     2fh0 k* I5 h  k3 I( o; t) |& s1 n5 o
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
: [; T8 s* m- S; T% \1 J8 _7 C: r    add     ax, di3 _: U) N- L7 P  i
    test    ax,ax
/ a, ?' i  O# k# S    jnz     SoftICE_Detected+ l# l6 U0 l2 u# I
) m( \. l2 v4 A, l) S4 d
__________________________________________________________________________1 V, m5 }) r" C" T* d$ O; F# G

/ _0 N1 ^; _: B% u8 J  ~5 }- G1 N& x2 }( z! F9 m
Method 05
7 W+ @3 y& C; u: e1 y2 w=========
( Z; X  Z8 h  u8 F
4 _6 ~! [! J. P  j7 D3 QMethod seeking the 'magic number' 0F386h returned (in ax) by all system
, P: S( o9 @  Z4 j' b  ], Z: |8 Y% zdebugger. It calls the int 41h, function 4Fh.
7 k0 v3 M& u9 g4 k) tThere are several alternatives.  & g' R0 b5 U( \2 q: o

2 Y3 J1 S9 e! K. ^7 f, FThe following one is the simplest:
/ ~) A' K$ m  ]1 N, K+ {1 ^4 [
9 q6 I5 r3 G1 R    mov     ax,4fh
/ Z6 e- S4 ?9 Z" e8 E    int     41h7 Y1 f; @# ~7 \9 \: S: u8 u
    cmp     ax, 0F386
4 R5 O$ P: ^3 ?3 I6 C" j    jz      SoftICE_detected
: I1 ^. i+ p" G- l7 l3 E+ c$ ^$ o' C! V7 m7 n  r9 c1 U8 x
# m3 ^- {# Y* `
Next method as well as the following one are 2 examples from Stone's % I) p! R4 V# S' |" ?2 C9 A. F! h
"stn-wid.zip" (www.cracking.net):
0 f8 l! Q) R0 m0 L! k/ Y5 ]  H! V, j! L# J
    mov     bx, cs
& m3 b1 o" `( _; i$ q9 @9 s    lea     dx, int41handler2
8 ~% n" |! O( L    xchg    dx, es:[41h*4]
1 o9 h, B2 N3 D3 \    xchg    bx, es:[41h*4+2]
& z0 q" r' H6 M) F    mov     ax,4fh0 F) S5 b! j# _
    int     41h8 m  [' t, z* G5 V
    xchg    dx, es:[41h*4]5 D( o, T3 r) `
    xchg    bx, es:[41h*4+2]7 K/ a0 Q1 ]2 T0 S; m
    cmp     ax, 0f386h
2 v- ]# X* J5 A* l% d+ @    jz      SoftICE_detected
7 Q0 C1 e8 b7 r0 P  P' K& F$ _, X
int41handler2 PROC+ H7 D" ~% S0 x: R0 R2 r
    iret
- [" p( y2 R" \( }: m$ F% qint41handler2 ENDP) S  a: S5 |" \  [7 r+ M& g

' J& U/ H. l/ S1 }. w6 M# K" a+ F4 Z) V0 @% }6 R: e
_________________________________________________________________________
% h! @9 ~, Q( W4 c* }# R, f! b* d; ]4 X% M) V: E/ T% z
8 E& |$ d% Y9 B, C( W
Method 06* A; m2 h& [& t8 V- g# s
=========: @/ j* I0 B9 o0 C' R( L* b
) b1 d" G) ]% L$ G: E0 A2 n
- D2 K6 u% j. P- u* f1 U, C$ Z" f
2nd method similar to the preceding one but more difficult to detect:
# A7 c7 C+ B/ L6 `& x- ?/ v9 ^7 ^& B' p8 c/ M0 \/ `. Q
- U- G' e4 s& `8 ]7 c
int41handler PROC8 ~) e' i  A  U& ^& P1 k. x
    mov     cl,al
1 b6 u0 q- q0 k# }! Y    iret
. g- P' Q7 O2 w5 vint41handler ENDP) Y2 K: i5 }" p/ j. I  E, B# s: ~! R
' ?3 v9 r* `  B. ], ^

2 E2 F, p# b, P    xor     ax,ax" {: I) k6 I/ P0 k5 \7 L4 @
    mov     es,ax/ T* T0 ^, q0 M, a: f6 j
    mov     bx, cs9 U. l, ~' m7 X' m. j2 Z
    lea     dx, int41handler
; s( }0 F* |" T    xchg    dx, es:[41h*4]" @5 X+ p% Z( U" K/ _: `9 j
    xchg    bx, es:[41h*4+2]
. p% }  n& J# N6 y) D5 A- Z    in      al, 40h
5 X, P* F" f. C    xor     cx,cx9 |: _2 s% l& y. a8 ]: j, V
    int     41h
0 P% A& L; M5 b4 v' b. Q* h    xchg    dx, es:[41h*4]
. D" z* J2 T( h8 W- {4 w% x    xchg    bx, es:[41h*4+2]
: C3 c! x! Q: a# Z  [    cmp     cl,al: O( I" b2 j; a- z2 A9 {- h! Z4 B' @
    jnz     SoftICE_detected
$ s! p! C# ~6 C1 v
: U1 L* p1 C1 q' D, o9 [; a6 Z_________________________________________________________________________7 \& ?) j. h0 m& B) X7 v

1 N! \* w) }' w" N3 B, \$ KMethod 07" p  g6 K3 N+ r0 ?
=========/ [0 r' a% `; x9 {# r- X2 _" H

' K8 B( U! f* {, hMethod of detection of the WinICE handler in the int68h (V86)
+ R% _. D, d3 l/ U2 y) v6 Z" z3 _" g- r1 j% ?: g6 J& I4 j# S
    mov     ah,43h( ]% Y" ~( y/ ]* \9 r
    int     68h* Q* Z! J, T  X
    cmp     ax,0F386h
7 [3 F. E- b! S7 p5 S; k' d    jz      SoftICE_Detected
! o' y8 E  T( H, _+ l
" n+ ]! y1 n! t9 |3 W+ Q7 R
( d! ~5 d+ i2 w$ e=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit/ L- G, g% S9 q: |
   app like this:
0 P: U" |2 O+ r& x& c* p5 t% w8 d( x) o1 c( u7 k9 h, x6 C' u* \
   BPX exec_int if ax==688 }# ?2 Y. W9 T) }) u  G
   (function called is located at byte ptr [ebp+1Dh] and client eip is( f2 b0 y0 t# |/ r# f) C
   located at [ebp+48h] for 32Bit apps)
2 k' E+ h# I$ f- H__________________________________________________________________________
# f' p* x1 }- @5 g5 b! X; e" Z( J3 g4 V9 o
, }* o* t9 ]* W0 b+ s
Method 089 N1 l$ ?( |9 ^8 ]- B
=========
; P5 a7 n# ]$ j, A
. u  @# j3 D. J' cIt is not a method of detection of SoftICE but a possibility to crash the- j& s8 P+ U$ c4 X5 q
system by intercepting int 01h and int 03h and redirecting them to another
* ^9 L; E* c% }* ]6 _, k+ g9 a% hroutine.
' L6 T8 L) r7 T& ^7 o. bIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points3 F# A( C6 ?7 U# \2 Y" }* J8 n
to the new routine to execute (hangs computer...)
' s5 u' ~1 Y- U  k+ `: V* O" U3 Y0 M" I$ g
    mov     ah, 25h
, E* L- D2 U' l( B9 k    mov     al, Int_Number (01h or 03h)/ p6 c5 L% O$ p8 u5 G$ k$ Z
    mov     dx, offset New_Int_Routine
1 Q" f. j. w4 c    int     21h
0 D% Z2 ?2 s" N: m% F+ N/ L1 B7 T2 M' v" B: b3 ]
__________________________________________________________________________  |1 W" C: J2 Q) n) R. t! ~5 w

' W: F* ]5 w. UMethod 09" F# ]7 x, C7 ?
=========
. Y: \6 R  ^  i9 w5 w% U
& q/ j) w, s" F& _; h3 X+ b) R# fThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only9 t0 s) t5 }) ]
performed in ring0 (VxD or a ring3 app using the VxdCall).# B* E+ ^+ `4 k" n; P: M
The Get_DDB service is used to determine whether or not a VxD is installed
9 N, Z% y: A& p. h+ @- xfor the specified device and returns a Device Description Block (in ecx) for
) V  v5 Y! }- w. ~3 M. Pthat device if it is installed.; O+ t; U' o3 L0 b' r: X- P8 z# ~% N

# ]! s9 |5 U4 ]+ \# [1 q0 k7 F% N   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
- P; g8 T  R, D0 k   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)+ a" z) \  F2 }! W
   VMMCall Get_DDB9 J4 I% |/ L' v6 h
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
$ M4 a$ P6 T, @/ e  L3 X# J! s+ P" ^. l& X# A
Note as well that you can easily detect this method with SoftICE:, u1 d! g8 _/ V4 Z5 X' o3 k4 |
   bpx Get_DDB if ax==0202 || ax==7a5fh# R+ [9 A# J: B! b: B

$ H& }1 ^& s# ^" ]* @  l__________________________________________________________________________) X& S& I9 L2 i% w+ F, h

/ k( `* Q" p7 o5 L( H. o+ q2 ~* dMethod 10
4 `& b0 u3 J1 c  T$ w=========& ~3 D2 k* G2 y0 k6 M0 _

& _. Q. J. t- w6 l( q=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with5 T6 O7 u9 A- `9 O6 E- [, ~* t
  SoftICE while the option is enable!!
$ V/ ^+ [; S& g
3 b& l7 n% _, x& }This trick is very efficient:
& R5 Z& d, g9 mby checking the Debug Registers, you can detect if SoftICE is loaded
( m; S' W4 {2 U(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
& }  I" t+ f$ L7 A" ?0 wthere are some memory breakpoints set (dr0 to dr3) simply by reading their2 H/ c, g# }6 u! @
value (in ring0 only). Values can be manipulated and or changed as well! I* N7 _/ E' p1 l& ^8 H! r
(clearing BPMs for instance)
9 X+ u  s! J" R3 u2 w) K
9 @/ Y  `  F+ X- m3 Q, b__________________________________________________________________________
6 {! K# ~% ~; s) A7 B; Z
& E* R  M7 L8 M! E9 p" V. mMethod 11( t( q/ ?6 Z: x% o/ `/ }9 T
=========
  s& X1 s; R% C7 B8 Q; a0 g6 {/ e: ^
This method is most known as 'MeltICE' because it has been freely distributed
  B. N+ B( ~7 Uvia www.winfiles.com. However it was first used by NuMega people to allow
8 o$ u+ e8 @7 K  M: c) x# ISymbol Loader to check if SoftICE was active or not (the code is located
5 `/ l+ e" E( k' Hinside nmtrans.dll).% V2 ]4 I0 J; d4 m( T8 f1 _
; r1 Q% Y& T0 _) z& a
The way it works is very simple:# S% C2 |( F( W4 t5 d* H2 ^
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for. m' R: n- z( C, J) c/ \
WinNT) with the CreateFileA API.
& U, Q7 M5 c2 E: J& J* ]* R, s+ z9 z! k. `/ k
Here is a sample (checking for 'SICE'):
' X5 q3 i; P7 y8 e& Z
# n: m* e( Y0 b9 y8 P& |BOOL IsSoftIce95Loaded()- d: Q# S. Z  P. O; n
{
) n9 e) ]/ R0 g! E9 v5 O9 W- o   HANDLE hFile;  , A8 ~: |$ V+ r! ~: I. Q
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
% U0 H/ W$ Y8 h: l" J2 s! I- s# s* O                      FILE_SHARE_READ | FILE_SHARE_WRITE,
) R5 l+ c) L1 ?1 G) i                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);$ p- K$ Q$ `# R4 s, h
   if( hFile != INVALID_HANDLE_VALUE )9 r+ E) ~( j, [) y; k# V# ~
   {+ r3 f0 t* L( A% {% Q6 I
      CloseHandle(hFile);
* Z$ E" y5 d3 Z" x5 V  _$ L      return TRUE;
# J6 q0 v. S% M7 D" W   }
* w+ W5 J7 c  {! @9 Z   return FALSE;
7 y* N) q+ _8 ]8 L5 U5 c5 s6 @}
& l: G, `# B7 H: q5 t$ p4 o  u8 T6 p9 x* G4 h
Although this trick calls the CreateFileA function, don't even expect to be
$ t4 Z& Q" J; g  U" ]able to intercept it by installing a IFS hook: it will not work, no way!" ]# q# l2 [& |8 Z
In fact, after the call to CreateFileA it will get through VWIN32 0x001F) f; i5 d' M( D8 X* c" I# A
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)* D# |: g0 L2 v% j; m
and then browse the DDB list until it find the VxD and its DDB_Control_Proc
) Q" d0 E/ p1 F3 X1 F/ m6 N5 m4 `field., B+ Z3 z  r* t2 s8 U
In fact, its purpose is not to load/unload VxDs but only to send a / R3 p/ S4 Z2 Z9 W
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)' N4 P. _, k, d- }; h
to the VxD Control_Dispatch proc (how the hell a shareware soft could try. D2 E6 ~$ l# T( W
to load/unload a non-dynamically loadable driver such as SoftICE ;-).
6 x; v2 W/ Z' [( `) e' W0 ?If the VxD is loaded, it will always clear eax and the Carry flag to allow
; I9 a. l7 V/ y; v$ `4 U: Xits handle to be opened and then, will be detected.
. r. \0 {' y' OYou can check that simply by hooking Winice.exe control proc entry point
1 G3 J( x5 l0 {while running MeltICE.2 A# W' x; u* b. `, |5 n. r5 Z
9 b: e6 }" r$ ?: \8 l( }9 W* k
& [. O2 [1 j3 a* a. o2 l& w
  00401067:  push      00402025    ; \\.\SICE
2 l# S  o4 w# N  0040106C:  call      CreateFileA, \9 B' e4 b" }" R
  00401071:  cmp       eax,-001
! H- z% Z. {2 f$ [  00401074:  je        00401091
) e) `; Y! W2 J3 b1 U8 D/ ^6 Y% O, t# }+ {/ Q7 L* |' ~# ?( Z( b
/ S: X, Q# O' Z; z0 f" n
There could be hundreds of BPX you could use to detect this trick.
' o; Y: k' b; I. U5 y8 j-The most classical one is:. B7 Z; P0 D4 ], k
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
/ @% `+ L6 J: Z; U4 K/ t    *(esp-&gt;4+4)=='NTIC'
( n3 }3 m- G2 ~) S6 A
# b6 ~  |. [2 ]0 E% V-The most exotic ones (could be very slooooow :-(
4 `  n) R) @& I# V6 v! M* V$ k   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  8 \- S/ U' A7 d, [% G8 L" i
     ;will break 3 times :-(
3 x) p4 [. d* o' r8 f6 H' Q! m! Q0 O+ k2 Y5 Z# O8 X+ o' Y
-or (a bit) faster: 5 y$ \- s1 z- \& K8 p1 u. E, J
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')0 z( x8 y4 K2 K) C. y5 P

0 y/ h0 ]# M( t+ A8 x" L: o   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  , j: B2 \4 x, C+ a2 G
     ;will break 3 times :-(7 [6 i' _' \  |# }

" B& M* Y2 A0 y, u, G-Much faster:  b/ @; ^  ^" W/ l4 O
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
( ~  Q( K" p  D6 O! \& U3 e( j# c7 a4 I9 w
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen
  p' t) y6 o+ c2 _function to do the same job:
  x( o9 ~+ Y$ L8 v7 o' l# n* F* b- c3 Y% e" n, m# ]
   push    00                        ; OF_READ
. X7 t( G3 w( a, y3 J7 f   mov     eax,[00656634]            ; '\\.\SICE',0+ [9 D& U& O( y; p6 S  p% U( ]6 \1 h
   push    eax8 ~" I! ]0 c) c7 S' v# |
   call    KERNEL32!_lopen8 H. n+ |' o2 y0 ]; O: h
   inc     eax
9 V9 \7 V- o8 D1 x% S   jnz     00650589                  ; detected" W; N7 V0 n( W. ?7 ^
   push    00                        ; OF_READ
" M( H$ V+ Q' e) @8 Q0 v   mov     eax,[00656638]            ; '\\.\SICE'9 t7 @/ C$ |( T
   push    eax  S& D5 E* `& C0 o
   call    KERNEL32!_lopen- S1 Q1 u# b+ H
   inc     eax
2 C% V% @2 H% A4 [   jz      006505ae                  ; not detected) Z! {$ P! j9 z+ t9 A) w

8 I: T  h0 p; @. Q: _7 K0 y
) D$ ?, t/ T9 y) U8 y% O__________________________________________________________________________
2 s. j+ v7 J2 V& z7 t0 q6 `4 B! i- |1 k! ]6 n8 c& C
Method 12
- b9 b, r* ]* I5 Q=========
6 ?2 n  S) J" l' E
6 y) A$ y$ Y* r8 SThis trick is similar to int41h/4fh Debugger installation check (code 05
" Y- a% w5 @8 ^- B# U% `&amp; 06) but very limited because it's only available for Win95/98 (not NT)
( k: d8 L, M9 w7 |9 l$ _: nas it uses the VxDCall backdoor. This detection was found in Bleem Demo.. v2 j/ R7 q. p
& I: J! t0 y; Z4 A/ p' I% N, |
   push  0000004fh         ; function 4fh
8 M; |+ p# t# y. l3 i( N) a6 u   push  002a002ah         ; high word specifies which VxD (VWIN32)
7 A/ e* H$ a' d; y                           ; low word specifies which service; T! I6 k" g) q, ^: ^6 H
                             (VWIN32_Int41Dispatch)
6 p" D& V$ @% ^# B4 L: @   call  Kernel32!ORD_001  ; VxdCall
" O) W& `) q$ i+ ^. D   cmp   ax, 0f386h        ; magic number returned by system debuggers
0 b9 V: Y' G- Z' \2 n% w! G  `# a   jz    SoftICE_detected
( |2 A  N4 O; F, D" F$ q, P, W+ T8 n& U7 {8 M; A
Here again, several ways to detect it:
; P7 k$ O/ n0 y, B+ i+ b: c6 M& _% w8 ~: \8 ~0 m0 X
    BPINT 41 if ax==4f
* T# i& W( g& f2 F+ L9 {6 x& Z* Q0 ]$ J8 N& Y# h
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one9 D$ w5 Q- }9 O$ d
1 q7 P; V; ~9 D& w
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
9 x; F* d! `( v! ~" F# a
" M# M( V' A) Z4 ?! `    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
& _+ M: P3 Y! G' w( {1 s1 \& ]: p' ?/ ~8 B3 `! P+ K1 w
__________________________________________________________________________
" M* X" g& W5 J+ F, C
3 B; U  s: _* ^# [# ~4 S" K4 x! r7 sMethod 135 Z7 ~: e& `: [' }/ t5 s
=========+ k/ o/ x: m) u5 n& V. K0 P% v0 l

4 x1 n( g4 e+ ~4 Q9 O# _% oNot a real method of detection, but a good way to know if SoftICE is
9 G, a7 @+ w8 G7 L8 |( S) linstalled on a computer and to locate its installation directory.7 H7 x" b8 M5 O, e+ @# d
It is used by few softs which access the following registry keys (usually #2) :
" ?( o1 S1 {: a* S! ^0 x: S
: ~) @( U$ U0 B0 g1 B-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion- ^- a, O7 ^% n& a/ `
\Uninstall\SoftICE- h( l$ F5 [) F
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
- y: b+ p9 \0 i- g# R-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
: a: r3 o0 \$ G% ^9 k\App Paths\Loader32.Exe
: Y6 R6 f1 a- z: Y8 Z/ @! T+ E0 i" K9 w2 f) q* a) P$ ^

4 z/ p- H' F1 J- e1 kNote that some nasty apps could then erase all files from SoftICE directory1 t( S9 B" P7 f$ A) c3 Q# T
(I faced that once :-(, f" ^- v' _* m* E0 ]2 |
- c. n+ n& t0 Z
Useful breakpoint to detect it:6 W* a0 ?1 m; Z  h/ ~( d- ^

) u+ P" a! _; v3 {     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
. K: B$ ~6 S- i0 {' `* b" z9 u5 h4 X. q2 S
__________________________________________________________________________
* f. a1 t: ^' C  v4 E% ?5 x8 J4 n. Q; y# c. u( E
5 P# S: l2 _. O0 J6 t' E
Method 14
8 X8 J, ^& g, J& P9 q1 R  ~=========
2 p3 y; v1 {0 x( T6 R4 R; K
2 n& w0 m9 w9 [: E9 L; t* mA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
/ m- _  @' {8 B) E9 T( \0 H9 ^is to determines whether a debugger is running on your system (ring0 only).& H+ p% q( L9 K* l! U  H* B4 o
  i2 L' f" p1 I$ s& w
   VMMCall Test_Debug_Installed
' v' d8 b8 k/ u  `! e   je      not_installed
# o5 I/ r: E3 d) ~$ e& [3 d- L& D3 h; f- \) D' S
This service just checks a flag.# G, A& _6 w  O7 A1 P1 w6 B; Y
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2026-8-4 22:44

Powered by Discuz! X5.0

© 2001-2026 Discuz! Team.

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