github / github/codeql

Add new state: Unicode compatibility normalization

未關閉
#19,706 2 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
主要語言
CodeQL
星號
10.1k
分支
2.1k
平均合併
2 天 15 小時
30 天內合併 PR
141

描述

Hey ,

I noticed that you are considering only two states:
1. One regarding the path normalization if it is done or not before the safe check
2. Second concerns the safe check.

as shown next:

https://github.com/github/codeql/blob/c1c0a705b9f14c0f577a9ae56a9d699e8b6e67d6/python/ql/lib/semmle/python/security/dataflow/PathInjectionQuery.qll#L20-L28

However, there is a third state that is a required one: `Unicode normalized`. If ever a Unicode normalization is performed with a compatibility algorithm (NFKC or NFKD), the query would miss some cases precisely those ones where the Unicode normalization is not performed before the path normalization and the safe check. I draw a little chart to depict my saying:

Image

The previous chart shows that when you consider a potential Unicode compatibility normalization, it is a required step before path normalization and safe check. If ever placed between the first two steps or after the last one, that would yield a vulnerable case that got missed due to the fact that the Unicode normalization may reintroduce unexpected special characters such as `..` and `/`.

Regards
@Sim4n6

貢獻指南

開啟貢獻指南

研究方向

Start in python/ql/lib/semmle/python/security/dataflow/PathInjectionQuery.qll, especially lines 20-28, and compare the existing path-normalization and safe-check states with the reported Unicode compatibility-normalization state. Use the issue’s chart to trace the required ordering; done means the query models compatibility normalization in the relevant position without missing cases.

由索引模型根據 Issue 內容生成。

評估

技術堆疊
python
領域
security
Issue 類型
功能
難度
4/5
預估耗時
3-5 天
活躍度
停滯
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。