joernio/joern

GitHub: joernio/joern

基于代码属性图的多语言静态分析平台,用于深度漏洞挖掘与安全代码审计。

Stars: 2971 | Forks: 391

# Joern - 漏洞挖掘工作台 [![release](https://static.pigsec.cn/wp-content/uploads/repos/2026/03/bd9c6043e3125703.svg)](https://github.com/joernio/joern/actions/workflows/release.yml) [![Joern SBT](https://index.scala-lang.org/joernio/joern/latest.svg)](https://index.scala-lang.org/joernio/joern) [![Github All Releases](https://img.shields.io/github/downloads/joernio/joern/total.svg)](https://github.com/joernio/joern/releases/) [![Gitter](https://img.shields.io/badge/-Discord-lime?style=for-the-badge&logo=discord&logoColor=white&color=black)](https://discord.com/invite/vv4MH284Hc) Joern 是一个用于分析源代码、字节码和二进制可执行文件的平台。它生成代码属性图,这是一种用于跨语言代码分析的代码图形表示。代码属性图存储在自定义图数据库中。这允许使用基于 Scala 的领域特定查询语言制定的搜索查询来挖掘代码。Joern 的开发目标是为静态程序分析中的漏洞发现和研究提供一个有用的工具。 网站:https://joern.io 文档:https://docs.joern.io/ 规范:https://cpg.joern.io ## 新闻 / 更新日志 - Joern v4.0.0 [从 overflowdb 迁移到 flatgraph](changelog/4.0.0-flatgraph.md) - Joern v2.0.0 [从 Scala2 升级到 Scala3](changelog/2.0.0-scala3.md) - Joern v1.2.0 移除了 `overflowdb.traversal.Traversal` 类。此更改不完全向后兼容。请参阅[此处](changelog/traversal_removal.md)了解详细说明。 ## 系统要求 - JDK 21(其他版本*可能*可行,但尚未经过充分测试) - *可选*:gcc 和 g++(如果您的 C/C++ 代码中包含/使用了 C/C++ 系统头文件,则用于自动发现) ## 快速安装 ``` wget https://github.com/joernio/joern/releases/latest/download/joern-install.sh chmod +x ./joern-install.sh sudo ./joern-install.sh joern ██╗ ██████╗ ███████╗██████╗ ███╗ ██╗ ██║██╔═══██╗██╔════╝██╔══██╗████╗ ██║ ██║██║ ██║█████╗ ██████╔╝██╔██╗ ██║ ██ ██║██║ ██║██╔══╝ ██╔══██╗██║╚██╗██║ ╚█████╔╝╚██████╔╝███████╗██║ ██║██║ ╚████║ ╚════╝ ╚═════╝ ╚══════╝╚═╝ ╚═╝╚═╝ ╚═══╝ Version: 2.0.1 Type `help` to begin joern> ``` 如果安装脚本因任何原因失败,请尝试 ``` ./joern-install --interactive ``` ## 开发环境要求 - [java](https://jdk.java.net/) - [sbt](https://www.scala-sbt.org) ## 本地运行单元测试和集成测试 单元测试: ``` sbt test ``` 集成测试: ``` sbt joerncli/stage querydb/createDistribution python -m pip install requests pexpect # wexpect on Windows python -u ./testDistro.py ``` ## 基于 Docker 的执行 ``` docker run --rm -it -v /tmp:/tmp -v $(pwd):/app:rw -w /app -t ghcr.io/joernio/joern joern ``` 要在服务器模式下运行 joern: ``` docker run --rm -it -v /tmp:/tmp -v $(pwd):/app:rw -w /app -t ghcr.io/joernio/joern joern --server ``` Almalinux 9 需要 CPU 支持 SSE4.2。对于 kvm64 虚拟机,请改用 Almalinux 8 版本。 ``` docker run --rm -it -v /tmp:/tmp -v $(pwd):/app:rw -w /app -t ghcr.io/joernio/joern-alma8 joern ``` ## 发布 新版本每天自动[创建](.github/workflows/release.yml)一次。如果贡献者需要更早发布,也可以手动运行[发布工作流](https://github.com/joernio/joern/actions/workflows/release.yml)。 ## 开发者 ### 贡献指南 感谢您抽出时间为 Joern 做出贡献!以下是一些指南,以确保您的 pull request 尽快被合并: * 尽量使用模板,尽管它们可能并不适合所有需求。我们希望看到的最低要求是: - 一个简短描述 PR 更改和目的的标题,最好在方括号中注明受影响的模块,例如 `[javasrc2cpg] Addition Operator Fix`。 - PR 正文中的简短更改说明。可以是项目符号或段落形式。 - 相关 issue 的链接或引用(如果存在)。 * 不要: - 立即通过 CC/@/电子邮件骚扰其他贡献者,团队会审查 PR 并指派最合适的贡献者来审查 PR。Joern 由行业合作伙伴和研究人员共同维护,大部分工作基于他们自己的目标和优先级,额外的帮助主要是志愿工作。如果您的 PR 陷入停滞,请在后续评论中通过 @ 提及我们,询问优先级或何时可能被解决的计划(如果质量允许的话)。 - 将描述正文留空,这会使审查 PR 的目的变得困难。 * 记得: - 记得格式化您的代码,即运行 `sbt scalafmt Test/scalafmt` - 添加单元测试以验证您的更改。 ### IDE 设置 #### Intellij IDEA * [下载 Intellij Community](https://www.jetbrains.com/idea/download) * 安装并运行它 * 安装 [Scala Plugin](https://plugins.jetbrains.com/plugin/1347-scala) - 直接在 Intellij 中搜索并安装即可。 * 重要提示:在您的本地 joern 仓库中打开 `sbt`,运行 `compile` 并保持开启 - 这将允许我们在下一步中使用 BSP 构建 * 回到 Intellij:打开项目:选择您本地的 joern 克隆:选择作为 `BSP project` 打开(即_不是_ `sbt project`!) * 等待导入和索引完成,然后您就可以开始了,例如 `Build -> build project` 或运行测试 #### VSCode - 安装 VSCode 和 Docker - 安装插件 `ms-vscode-remote.remote-containers` - 在 VSCode 中打开 Joern 项目文件夹 - [选项 1](https://docs.microsoft.com/en-us/azure-sphere/app-development/container-build-vscode#build-and-debug-the-project):Visual Studio Code 检测到新文件并打开一个消息框提示:`Folder contains a Dev Container configuration file. Reopen to folder to develop in a container.`。选择 `Reopen in Container` 按钮以在由 `.devcontainer/Dockerfile` 文件创建的容器中重新打开文件夹。 - 选项 2:按 `Ctrl + Shift + P` 然后选择 `Dev Containers: Reopen in Container` - 按 `Ctrl + Shift + P` 然后选择 `Metals: Import build` - 在 `Metals: Import build` 成功后,您就可以开始为 Joern 编写代码了 ## QueryDB (queries plugin) 开发和测试 QueryDB 的快速方法: ``` sbt stage ./querydb-install.sh ./joern-scan --list-query-names ``` 最后一条命令会打印所有可用的查询 - 在 querydb 中添加您自己的查询,再次运行上述命令以查看您的查询是否已部署。 更多详情请参阅[单独的 querydb readme](querydb/README.md)
标签:ASN解析, C/C++, CFG, CMS安全, CPG, DDG, DevSecOps, JavaScript, Joern, Kotlin, Python, Scala, TLS抓取, 上游代理, 事务性I/O, 二进制分析, 云安全运维, 代码属性图, 安全专业人员, 无后门, 服务器监控, 查询语言, 系统运维工具, 请求拦截, 跨语言分析, 软件安全, 错误基检测, 静态代码分析