Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

修复文件路径穿越漏洞 #232

Merged
merged 2 commits into from
Dec 11, 2024
Merged

Conversation

xuewenG
Copy link
Collaborator

@xuewenG xuewenG commented Dec 11, 2024

这个 PR 做了什么?

目前实现的 /upload 接口没有正确处理 .. 路径,使用以下命令可以访问 uploadDir 之外的文件,例如:

curl --path-as-is http://127.0.0.1:37892/upload/../../../../SOME_SECRET_FILE

使用 middleware.StaticWithConfig 中间件替换自己实现的文件接口。

@xuewenG xuewenG added the bugfix Bug fix label Dec 11, 2024
@xuewenG xuewenG force-pushed the fix/file-path-traversal branch from ec03579 to 43eeb84 Compare December 11, 2024 16:32
@xuewenG xuewenG merged commit 22082ae into kingwrcy:dev Dec 11, 2024
@xuewenG xuewenG deleted the fix/file-path-traversal branch December 13, 2024 13:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugfix Bug fix
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant