修复任意文件读取漏洞#25
Open
tuntun1337 wants to merge 1 commit into
Open
Conversation
/static/js|css|img|fonts/:file 处理器把 URL 解码后的文件名直接拼进 join(basePath, ...)。Oak 会将 ..%2F..%2F..%2Fetc%2Fpasswd 解码为 ../../../etc/passwd,导致可读取静态目录之外的任意文件。 新增 resolveStaticPath():对解析后的真实路径做规范化,并校验其仍位于 目标静态子目录内(采用路径边界校验而非黑名单匹配),越界或不存在统一 返回 404。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
/static/js|css|img|fonts/:file 处理器把 URL 解码后的文件名直接拼进 join(basePath, ...)。Oak 会将 ..%2F..%2F..%2Fetc%2Fpasswd 解码为 ../../../etc/passwd,导致可读取静态目录之外的任意文件。
通过/static/img/..%2F..%2F..%2Fapp%2Fdata%2Fqbin_local.db可以直接下载sqllite数据库从而获取所有文件
新增 resolveStaticPath():对解析后的真实路径做规范化,并校验其仍位于
目标静态子目录内(采用路径边界校验而非黑名单匹配),越界或不存在统一
返回 404。