Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

内存马注入不生效 #25

Open
sevck opened this issue Jul 29, 2024 · 6 comments
Open

内存马注入不生效 #25

sevck opened this issue Jul 29, 2024 · 6 comments

Comments

@sevck
Copy link

sevck commented Jul 29, 2024

目标:spring-boot,内置tomcat8
生产方式:jar包
测试工具:冰鞋、哥斯拉
中间件:spring MVC 、Tomcat
组件类型:Listenter
注入方式:本地jar -jar toos.jar pid

root@36e5248b2ca4 webapps]# java -jar demo.jar
[*] Found pid 839 ——> [user--1.6.jar]
[*] Found pid 889 ——> [demo.jar]
[root@36e5248b2ca4 webapps]# java -jar demo.jar 839
[*] Current agent path: /home/webapps/demo.jar
[*] Attaching to target JVM with PID: 839
[+] Attached to target JVM and loaded agent successfully
[root@36e5248b2ca4 webapps]# java -jar demo.jar 839
[*] Current agent path: /home/webapps/demo.jar
[*] Attaching to target JVM with PID: 839
[+] Attached to target JVM and loaded agent successfully
[root@36e5248b2ca4 webapps]#

提示注入成功,
按照对应路径和请求头访问,然后再用哥斯拉和冰鞋都无法访问

@pen4uin
Copy link
Owner

pen4uin commented Jul 29, 2024

有携带 magic 参数触发内存马注入吗?
image

@sevck
Copy link
Author

sevck commented Jul 30, 2024

试了,感觉没触发,按照文档:https://github.com/pen4uin/java-memshell-generator/tree/main/jmg-docs/1.0.8
1、生成:
image
2.服务端启动spring项目
3.进行注入:提示成功:
image
4.触发内存注入:
image
5.根据生成配置
image
6.访问:
image
7.对应服务端日志:
image

@sevck
Copy link
Author

sevck commented Jul 30, 2024

和启动方式有关吗? java -jar user-xxx.jar 项目是spring cloud,服务是spring boot启动的

@pen4uin
Copy link
Owner

pen4uin commented Jul 30, 2024

user-xxx.jar 是本地起来测试的?如果初始环境,需要访问一下,因为存在懒加载问题,attach 时可能找不到对应的类。

@sevck
Copy link
Author

sevck commented Aug 1, 2024

刚刚试了下,
1、user-xxx.jar是本地起的,启动方式为java -jar user-xxx.jar (spring cloud 项目,spring-boot工程)
2、访问服务的接口
3、agent本地注入,注入方式

[root@36e5248b2ca4 webapps]# java -jar demo.jar
[*] Found pid 445 ——> [demo.jar]
[*] Found pid 397 ——> [user-xxx.jar]
[root@36e5248b2ca4 webapps]# java -jar demo.jar 397
[*] Current agent path: /home/webapps/demo.jar
[*] Attaching to target JVM with PID: 397
[+] Attached to target JVM and loaded agent successfully
[root@36e5248b2ca4 webapps]# java -jar demo.jar 397
[*] Current agent path: /home/webapps/demo.jar
[*] Attaching to target JVM with PID: 397
[+] Attached to target JVM and loaded agent successfully
[root@36e5248b2ca4 webapps]# java -jar demo.jar 397
[*] Current agent path: /home/webapps/demo.jar
[*] Attaching to target JVM with PID: 397
[+] Attached to target JVM and loaded agent successfully

4、访问magic
5、访问冰蝎shell,还是404..
不知道是不是我的姿势问题

@sevck
Copy link
Author

sevck commented Aug 1, 2024

抱歉,之前tomcat版本有误
08/01-07:09:32 INFO org.apache.catalina.core.StandardService- Starting service [Tomcat]
08/01-07:09:32 INFO org.apache.catalina.core.StandardEngine- Starting Servlet Engine: Apache Tomcat/9.0.12
会不会tomcat版本比较高的原因?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants