Alternative format for threat lib for better readability and editing

未关闭
#237 6 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 3 天内回复

还没有人认领这个 Issue。

评估

难度
5/5
预计耗时
一周以上
新手友好度
32/100
Issue 类型
功能
描述清晰度
需要澄清
活跃度
冷清
技术栈
markdown, python
领域
content, security

调研方向

首先定位 threatlib.json,并追踪 pytm 如何加载威胁定义。定义所提议的 Markdown 元数据和内容结构,然后确定仅使用 Python 标准库的生成器如何生成等效的 threatlib.json 数据;当格式和转换方案达成一致,并保留现有威胁信息时,即视为完成。

由索引模型根据 Issue 内容生成。

描述

So I looked through the threats recently and again and again I find it difficult to read through the JSON document.

What bothers me the most is the combination of text in details, mitigation, and example with the metadata like id condtion severity and target.

It makes the text hard to read and the metadata difficult to find.

Now I had the idea to have a markdown file for each threat in the style of pandoc with the yaml_metadata_extension.

The result could look similar to this

---
id: INP01
condition: target.usesEnvironmentVariables is True and target.controls.sanitizesInput is False and target.controls.checksInputBounds is False
severity: High
target: (<class 'pytm.pytm.Lambda'>, <class 'pytm.pytm.Process'>)
---

# Buffer Overflow via Environment Variables

This attack pattern involves causing a buffer overflow through manipulation of environment variables. Once the attacker finds that they can modify an environment variable, they may try to overflow associated buffers. This attack leverages implicit trust often placed in environment variables.

## Example

Attack Example: Buffer Overflow in `$HOME` A buffer overflow in sccw allows local users to gain root access via the `$HOME` environmental variable. Attack Example: Buffer Overflow in TERM A buffer overflow in the rlogin program involves its consumption of the TERM environmental variable.

## Mitigations

Do not expose environment variable to the user.Do not use untrusted data in your environment variables. Use a language or compiler that performs automatic bounds checking. There are tools such as Sharefuzz [R.10.3] which is an environment variable fuzzer for Unix that support loading a shared library. You can use Sharefuzz to determine if you are exposing an environment variable vulnerable to buffer overflow.

## References

-  https://capec.mitre.org/data/definitions/10.html
-  CVE-1999-0906
-  CVE-1999-0046
-  http://cwe.mitre.org/data/definitions/120.html
-  http://cwe.mitre.org/data/definitions/119.html
-  http://cwe.mitre.org/data/definitions/680.html

Of course this file would not be parseable by pytm with the restriction that it should only depend on python stdlib.
But what could be done is that the threats are stored in markdown files from which the threatlib.json could be generated.

What do you think about this idea?

主要语言
Python
星标
1.2k
派生
237
平均合并
4 天 2 小时
30 天内合并 PR
9

环境准备

在 Codespaces 中打开

在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。

  • 提供 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

OWASP/pytm 的其他 Issue

查看 OWASP/pytm 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。