{"id":20482166,"url":"https://github.com/uk0/cve-2022-42889-intercept","last_synced_at":"2026-02-13T13:47:03.474Z","repository":{"id":103059904,"uuid":"554822047","full_name":"uk0/cve-2022-42889-intercept","owner":"uk0","description":"通过 jvm 启动参数 以及 jps pid进行拦截非法参数","archived":false,"fork":false,"pushed_at":"2022-10-21T03:46:50.000Z","size":4720,"stargazers_count":4,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-09-13T11:31:09.825Z","etag":null,"topics":["cve-2022-42889"],"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/uk0.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-10-20T13:05:24.000Z","updated_at":"2024-12-12T14:31:34.000Z","dependencies_parsed_at":null,"dependency_job_id":"e38488ce-5c57-4e68-bd9c-7d04b4c3489d","html_url":"https://github.com/uk0/cve-2022-42889-intercept","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/uk0/cve-2022-42889-intercept","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uk0%2Fcve-2022-42889-intercept","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uk0%2Fcve-2022-42889-intercept/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uk0%2Fcve-2022-42889-intercept/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uk0%2Fcve-2022-42889-intercept/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/uk0","download_url":"https://codeload.github.com/uk0/cve-2022-42889-intercept/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uk0%2Fcve-2022-42889-intercept/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278840393,"owners_count":26055116,"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","status":"online","status_checked_at":"2025-10-07T02:00:06.786Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["cve-2022-42889"],"created_at":"2024-11-15T16:11:51.693Z","updated_at":"2025-10-07T20:31:02.630Z","avatar_url":"https://github.com/uk0.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"### cve-2022-42889-intercept\n\n* 低于 Java11版本的需要注意，更高的版本已经取消了`Javascript`解释器\n* 本次方案针对 Java8\n\n\n通过 jvm 启动参数 以及 jps pid进行拦截非法参数\n\n\n![rce_demo.png](rce_demo.png)\n\n\n\n\n\n#### quick start\n\n\n```bash\n\n-----------------------load......\ncve-2022-42889 check start\ncve-2022-42889 is_deep_match  org.apache.commons.text.StringSubstitutor\nmd.getReturnType().getActualName() java.lang.String\n[cve-2022-42899] class found!: class org.apache.commons.text.StringSubstitutor\n(StringSubstitutor replace disabled)\n[CVE 2022-42889] StringSubstitutorclass org.apache.commons.text.StringSubstitutor: (sanitized) PoC Output: %_script:javascript:195 + 324_\nby arksec.cn\n```\n\n\n\n### 打开方式\n\n\n\u003e使用 Attach API 远程加载的 Java agent 不会再先于main方法执行，这取决于另一虚拟机调用 Attach API 的时机。并且，它运行的也不再是premain方法，而是名为agentmain的方法。\n Java 虚拟机并不限制 Java agent 的数量。你可以在 java 命令后附上多个-javaagent参数，或者远程 attach 多个 Java agent，Java 虚拟机会按照定义顺序，或者 attach 的顺序逐个执行这些 Java agent。\n\n\n* premain\n* java 启动参数\n\n\n```bash\n\n-javaagent:/path/to/dir/CVE-2022-42889-Agent-1.0-SNAPSHOT-jar-with-dependencies.jar\n\n```\n\n\n* agentmain\n* jps （pid注入）\n* 执行 `Attach` 的main方法 (先引入 `tools.jar`)\n\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fuk0%2Fcve-2022-42889-intercept","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fuk0%2Fcve-2022-42889-intercept","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fuk0%2Fcve-2022-42889-intercept/lists"}