{"id":13843008,"url":"https://github.com/safe6Sec/MemoryShell","last_synced_at":"2025-07-11T17:32:56.281Z","repository":{"id":54334727,"uuid":"474862357","full_name":"safe6Sec/MemoryShell","owner":"safe6Sec","description":"内存马学习","archived":false,"fork":false,"pushed_at":"2022-05-29T06:34:07.000Z","size":1121,"stargazers_count":168,"open_issues_count":0,"forks_count":22,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-11-15T02:42:28.693Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/safe6Sec.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-03-28T05:46:38.000Z","updated_at":"2024-08-30T05:53:21.000Z","dependencies_parsed_at":"2022-08-13T12:20:37.199Z","dependency_job_id":null,"html_url":"https://github.com/safe6Sec/MemoryShell","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/safe6Sec%2FMemoryShell","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/safe6Sec%2FMemoryShell/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/safe6Sec%2FMemoryShell/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/safe6Sec%2FMemoryShell/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/safe6Sec","download_url":"https://codeload.github.com/safe6Sec/MemoryShell/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225745404,"owners_count":17517633,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-04T17:01:53.174Z","updated_at":"2024-11-21T14:30:36.027Z","avatar_url":"https://github.com/safe6Sec.png","language":"Java","funding_links":[],"categories":["Java"],"sub_categories":[],"readme":"# MemoryShell\n内存马学习，持续更新。\n\n\n# 目录\n\n## 文章\n- [java内存马分析(一) 环境搭建](https://mp.weixin.qq.com/s/4Bz6UQzC6SEnjSPC4W5fyQ)\n- [java内存马分析(二) Servlet内存马](https://mp.weixin.qq.com/s/VLc5TmTAuCttS_DhUSdBuw)\n- [java内存马分析(三) Filter内存马](https://mp.weixin.qq.com/s/OWH42PojsFGO4fHSsUJhnw)\n- [java内存马分析(四) Listener内存马](https://mp.weixin.qq.com/s/wNa8kR1t1KmyhItC_GmGQA)\n- [java内存马分析(五) weblogic注入内存马](https://mp.weixin.qq.com/s/2sxsJKwhzxJsYrcEQRZ6Yg)\n- [java内存马分析(六) Controller内存马](https://www.freebuf.com/articles/web/327633.html)\n- interceptor内存马已完成，文章待更新\n- agent内存马已完成，文章待更新\n\n## servlet内存马\n原理：\n创建servlet马封装成wrapper，获取StandardContext使用addChild添加内存马，最后配置映射关系。\n详细步骤见代码。\n![](img/servlet.png)\n\n## filter内存马\n原理： \n三个关键对象\n- filterMaps变量：包含所有过滤器的URL映射关系\n- filterDefs变量：包含所有过滤器包括实例内部等变量\n- filterConfigs变量：包含所有与过滤器对应的filterDef信息及过滤器实例，进行过滤器进行管理   \n \n步骤:创建filter马，然后filterDef包装，standardContext利用addFilterDef添加filterDefs，然后配置filterMap映射关系，最后filterDef加到filterConfig\n详细步骤见代码。\n![](img/filter.png)\n\n## listener内存马\n原理：\n创建listener马，获取StandardContext使用addApplicationEventListener添加内存马。\n详细步骤见代码。\n\n# 挖掘思路\n- 通过正向添加，然后从分析上下文。找对应存储的变量，分析对象构成。然后结合反射进行动态注册。\n- 分析正向添加底层实现原理，然后结合反射实现动态注册。\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsafe6Sec%2FMemoryShell","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsafe6Sec%2FMemoryShell","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsafe6Sec%2FMemoryShell/lists"}