Skip to content
KitploitKITPLOIT
工具漏洞利用博客
Log in
提交
工具漏洞利用博客
提交

黑客、渗透测试和网络安全工具,武装您的安全武器库!

Kitploit 是一个黑客、网络安全和渗透测试工具的目录。发现最新的项目更新,查找漏洞、分析系统、自动化测试并加强你的安全。

订阅源联系隐私© 2026 Kitploit

工具目录

分类

查看所有分类
Loading categories
semgrep-rules — 我收集的Semgrep规则,用于促进漏洞研究。 | Kitploit
工具/GitHubGitHub/0xdea/semgrep-rules
静态代码分析 (SAST)漏洞分析代码分析二进制分析学习与教育精选资源
GitHub0xdea/semgrep-rules

semgrep-rules

我收集的Semgrep规则,用于促进漏洞研究。

查看仓库
86689411天前Kitploit 审核通过

最受欢迎

查看全部 →

发现我们社区最常用的工具。

探索所有工具

浏览我们的工具集合

查看所有工具 →
分享
网站

semgrep-rules

validate

“攻击面就是漏洞。在那里找到漏洞只是一个细节。”

—— Mark Dowd

“有些细节比其他细节更重要。”

—— Fedor G. Pikus

我的 Semgrep 规则集,用于促进漏洞研究。

Program in C

博客文章

  • https://hnsecurity.it/blog/semgrep-ruleset-for-c-c-vulnerability-research
  • https://hnsecurity.it/blog/automating-binary-vulnerability-discovery-with-ghidra-and-semgrep
  • https://hnsecurity.it/blog/big-update-to-my-semgrep-c-cpp-ruleset
  • https://hnsecurity.it/blog/streamlining-vulnerability-research-with-the-idalib-rust-bindings-for-ida-9-2/
  • https://hnsecurity.it/blog/my-semgrep-c-cpp-ruleset-is-ready-for-prime-time-again/

参见

  • https://appsec.guide/docs/static-analysis/semgrep/
  • https://semgrep.dev/docs/writing-rules/overview
  • https://semgrep.dev/r

设置和使用说明

  1. 安装 Semgrep。
  2. 要通过 Semgrep 注册表 使用这些规则,请从目标源代码仓库的根目录运行以下命令:
# 高优先级扫描(快速见效)
semgrep --severity ERROR --config "p/0xdea"

# 高优先级和中优先级扫描(推荐)
semgrep --severity ERROR --severity WARNING --config "p/0xdea"

# 完整扫描(可能包含边缘发现和更多误报)
semgrep --config "p/0xdea"

或者,你可以克隆此 GitHub 仓库并在本地运行:

# 完整扫描
semgrep --config semgrep-rules/rules /path/to/source

# 特定规则扫描
semgrep --config semgrep-rules/rules/c/command-injection.yaml /path/to/source

[!TIP] 指定 --no-git-ignore 开关以扫描文件,无论其 git 跟踪状态或 .gitignore 规则如何。

为了获得更流畅的体验,我建议将 Semgrep 扫描输出保存为 SARIF 格式,并在 VS Code 中使用 SARIF Explorer:

semgrep --sarif --sarif-output=/path/to/source/SEMGREP.sarif --config semgrep-rules/rules /path/to/source
code /path/to/source # 然后在 VS Code 中使用 SARIF Explorer 打开 SEMGREP.sarif 文件

另请参阅附带的 SARIF 输出示例。

兼容性

已使用 Semgrep CLI 1.169.0 测试。

规则

C/C++

经过实战检验的 C(有时也包含 C++)规则集。

缓冲区溢出

  • insecure-api-gets。使用了不安全的 API 函数 gets。
  • insecure-api-strcpy-strcat。使用了可能不安全的 API 函数 strcpy、stpcpy、strcat。
  • insecure-api-sprintf-vsprintf。使用了可能不安全的 API 函数 sprintf 和 vsprintf。
  • insecure-api-scanf。使用了 scanf 系列中可能不安全的 API 函数。
  • incorrect-use-of-strncat。传递给 strncat 的大小参数错误。
  • use-of-source-size-in-copy。传递给 strncpy、memcpy、snprintf 及其变体的大小参数错误。
  • incorrect-use-of-sizeof。意外地对指针而不是其目标使用了 sizeof 运算符。
  • unterminated-string-strncpy。使用 strncpy 和 stpncpy 后未显式添加 NUL 终止符。
  • off-by-one。潜在的差一错误。
  • unsafe-ret-snprintf-vsnprintf。可能不安全地使用了 snprintf 和 vsnprintf 的返回值。
  • unsafe-ret-strlcpy-strlcat。可能不安全地使用了 strlcpy 和 strlcat 的返回值。
  • pointer-subtraction。可能使用指针减法来确定大小。
  • write-into-stack-buffer。直接写入栈上的缓冲区。

整数溢出

  • integer-wraparound。潜在的整数回绕错误。
  • unsafe-strlen。将 strlen 的返回值转换为 short 可能很危险。
  • integer-truncation。潜在的整数截断错误。
  • signed-unsigned-conversion。潜在的符号/无符号转换错误。
  • incorrect-unsigned-comparison。检查无符号变量是否为负数。

格式化字符串

  • format-string-bugs。潜在的格式化字符串漏洞。

内存管理

  • insecure-api-alloca。使用了可能不安全的 API 函数 alloca。
  • use-after-free。free 后潜在的 use-after-free。
  • double-free。潜在的 double free。
  • incorrect-use-of-free。对不在堆上的内存调用了 free。
  • unchecked-ret-malloc。未检查 malloc、calloc、realloc 等的返回值。
  • putenv-stack-var。使用栈分配变量调用了 putenv。
  • ret-stack-address。可能返回栈分配变量的地址。
  • mismatched-memory-management。可能不匹配的 C 内存管理例程。
  • mismatched-memory-management-cpp。可能不匹配的 C++ 内存管理例程。
  • memory-address-exposure。可能暴露底层内存地址。

命令注入

  • command-injection。通过 system 或 popen 潜在的 OS 命令注入。

条件竞争

  • insecure-api-access-stat。使用了不安全的 API 函数 access、stat、lstat 等。
  • insecure-api-mktemp-tmpnam-tempnam。使用了不安全的 API 函数 mktemp、tmpnam、tempnam。
  • insecure-api-signal。使用了不安全的 API 函数 signal。

权限管理

下载工具