Skip to content

[Bug]: CORS 信任任意来源安全漏洞 #199

@ChenJincheng-Gencent

Description

@ChenJincheng-Gencent

Bug Description

漏洞目标地址:
https://himarket.xxx.com/ https://himarket-admin.xxx.com/

Steps to Reproduce

存在问题描述:
CORS 不安全配置漏洞指的是在跨域资源共享过程中,由于资源服务器的响应头 Access-Control-Allow-Origin 配置不当导致本应该受限访问的请求网站可以绕过访问控制策略读取资源服务器的数据,造成用户隐私泄露,信息窃取甚至账户劫持的危害。

Expected Behavior

整改意见:
1、Access-Control-Allow-Origin中指定的来源只能是受信任的站点,避免使用Access-Control-Allow-Origin: *,避免使用Access-Control-Allow-Origin: null,否则攻击者可以伪造来源请求实现跨域资源窃取。 2、严格校验"Origin"值,校验的正则表达式一定要编写完善,避免出现绕过的情况。 3、减少"Access-Control-Allow-Methods"所允许的请求方法。 4、除了正确配置CORS之外,Web服务器还应继续对敏感数据进行保护,例如身份验证和会话管理等。

Actual Behavior

资源服务器的响应头 Access-Control-Allow-Origin 配置不当

Affected Component

Admin Console

Severity

Medium (Feature partially works)

Environment

吉利内部测试环境,基于himarket v0.5版本

Logs and Error Messages

Screenshots

No response

Additional Context

No response

Checklist

  • I have searched existing issues to avoid duplicates
  • I have included all necessary information above
  • I am using the latest version of HiMarket
  • I can reproduce this issue consistently

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions