知识卡片

普通读书笔记卡 · 3270

入口剥离外来身份头

理解等级:中级

外部客户端能自行附带看似内部可信的身份或角色请求头。若网关原样转发、下游又把它当作已认证声明,攻击者就可能越权。入口应剥离外来内部身份头,再按已验证的身份生成受控声明;下游还需核验声明的来源和权限,不能只认头名。

这张卡片看不懂?

已有反馈 · 0 / 10 条

    还没有人提交反馈。

    在整书笔记中的位置

    原书出处 · 1 处

    • · 查看原书依据

      In our case study, for example, you will want to think about implementing an HTTP header allowlist in the API gateway and removing all invalid HTTP headers. An attacker could send through additional HTTP headers to the Attendee API like X-Assert-Role=Admin or X-Impersonate=Admin. The attacker would hope that these headers will not be removed and are used internally, which may give some extra privileges.

    参考来源

    - 位置:《Mastering API Architecture》第6章《Operational Security: Threat Modeling for APIs》之《Step 4: Identify Threats—Taking This in Your STRIDE》内《Security directive hardening》(源文件:_epub-src/OEBPS/ch06.xhtml) - 结论依据:原文用 `X-Assert-Role=Admin` 与 `X-Impersonate=Admin` 说明外部伪造内部权限头的风险,并建议网关按允许清单剔除无效头;剥离后重建受控声明及下游核验是据此信任边界作出的实践推断,不把示例头名当作标准。 - 原始内容:In our case study, for example, you will want to think about implementing an HTTP header allowlist in the API gateway and removing all invalid HTTP headers. An attacker could send through additional HTTP headers to the Attendee API like X-Assert-Role=Admin or X-Impersonate=Admin. The attacker would hope that these headers will not be removed and are used internally, which may give some extra privileges.