Blog

程序员征服安全 OWASP 十大 API 系列-数据泄露过多

September 23, 2020
Matias Madou, Ph.D.

过度数据泄露漏洞与OWASP清单上的其他API问题不同,因为它涉及一种非常特殊的数据。漏洞背后的实际机制与其他漏洞相似,但在这种情况下,过度数据泄露被定义为涉及受法律保护或高度敏感的数据。这可能包括任何个人身份信息,通常被称为 PII。或者它可能涉及支付卡行业信息或PCI。最后,过度的数据泄露可能包括受隐私法约束的任何信息,例如欧洲的《通用数据保护条例》(GDPR)或美国的《健康保险流通与责任法案》(HIPAA)。

正如你可能想象的那样,这令人深感担忧,精明的开发人员必须学会如何尽可能地消除这些错误。如果你已经准备好对抗数据暴露巨龙,那就去参加我们的游戏化挑战赛吧:

你的分数是多少?继续阅读并了解更多:

有哪些过度数据泄露的例子?

发生过度数据泄露的主要原因之一是开发人员和程序员对他们的应用程序将使用的数据类型没有足够的洞察力。因此,开发人员倾向于使用通用流程,将所有对象属性暴露给最终用户。

开发人员有时还会假设前端组件会在向用户显示任何信息之前执行数据过滤。对于大多数通用数据来说,这很少成为问题。但是,例如,将受法律保护或敏感的数据作为会话ID的一部分暴露给用户,从安全和法律的角度来看,可能会导致重大问题。

OWASP报告设想了一个场景,即保安人员有权访问设施中基于物联网的特定摄像机,以此举例说明敏感数据很容易被意外共享。也许这些摄像机正在监视封闭和安全的区域,而其他监视人员的摄像机本应仅限于具有更高权限的警卫或监督人员。

为了向警卫提供访问授权摄像机的权限,开发人员可以使用如下所示的 API 调用。

/api/sites/111/相机

作为回应,该应用程序将以以下格式发送警卫能够看到的摄像机的详细信息:

{“id”: “xxx”,“live_access_token”: “xxxxbbbb”,“building_id”: “yyy”}

从表面上看,这似乎效果很好。警卫在应用程序上使用图形用户界面,只能看到他们有权查看的摄像机画面。问题在于,由于使用的通用代码,实际的API响应将包含整个设施中所有摄像机的完整列表。任何在网络中窃取数据或泄露警卫账户的人都能够发现网络中每台摄像机的位置和命名法。然后,他们可以不受限制地访问这些数据。

消除过多的数据泄露

防止过度数据泄露的最大关键是了解数据及其周围的保护措施。创建通用 API 并让客户端在向用户显示数据之前对数据进行排序是一个危险的选择,它会导致许多可预防的安全漏洞。

除了了解相关的数据保护外,停止使用通用 API 向用户发送所有内容的过程也很重要。例如,必须避免使用诸如 to_json () 和 to_string () 之类的代码。取而代之的是,该代码应专门选择需要归还给授权用户的属性,并专门发送这些信息。

为了确保没有意外过度共享受保护的数据,组织应考虑实施基于架构的响应验证机制作为额外的安全层。它应该定义和强制所有API方法返回的数据,包括错误报告规则。

最后,所有归类为包含 PII 或 PCI 的数据,或受 GDPR 或 HIPAA 等法规保护的信息,都应使用高度加密进行保护。这样,即使这些数据的位置作为过度数据泄露漏洞的一部分泄露了,也有一道良好的次要防线,即使数据落入恶意用户或威胁行为者手中,也应该保护数据。

来看看 安全代码勇士 博客页面,详细了解此漏洞以及如何保护您的组织和客户免受其他安全漏洞的破坏。你也可以 试试演示 Secure Code Warrior 培训平台可让您的所有网络安全技能不断磨练并保持最新状态。

标语

Govern AI-driven development before it ships

Measure AI-assisted risk, enforce secure coding policy at commit, and accelerate secure delivery across your SDLC.

book a demo
标语

Explore more blogs

Lorem Issum diam quis eim leboutis ein selerisque lobortis sepitis beelrisque lobortis sepitis celerisque lobortis celeriskue filmentis celeriskue filmentis celeriskue diam

browse all
Case Study
Filter Label
This is some text inside of a div block.

Supercharged Security Awareness: How Tournaments are Inspiring Developers at Erste Group

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse varius enim in eros elementum tristique. Duis cursus, mi quis viverra ornare, eros dolor interdum nulla, ut commodo diam libero vitae erat. Aenean faucibus nibh et justo cursus id rutrum lorem imperdiet. Nunc ut sem vitae risus tristique posuere.

Learn More
Case Study
Filter Label
This is some text inside of a div block.

Security as culture: How Blue Prism cultivates world-class secure developers

Learn how Blue Prism, the global leader in intelligent automation for the enterprise, used Secure Code Warrior's agile learning platform to create a security-first culture with their developers, achieve their business goals, and ship secure code at speed

Learn More
Case Study
Filter Label
This is some text inside of a div block.

One Culture of Security: How Sage built their security champions program with agile secure code learning

Discover how Sage enhanced security with a flexible, relationship-focused approach, creating 200+ security champions and achieving measurable risk reduction.

Learn More
Blog
Filter Label
This is some text inside of a div block.

Enabler 7: Developer Recognition

Recognition fuels participation. Enabler 7 celebrates developer achievement loudly, with rewards and exclusive swag that mark real, earned secure coding wins.

Learn More
Blog
Filter Label
This is some text inside of a div block.

Named in the Gartner® Hype Cycle™ for Application Security 2026

Secure Code Warrior is named in the Gartner® Hype Cycle™ for Application Security, 2026 for Agentic Coding Security and Secure Coding Training. Here's why.

Learn More
Blog
Filter Label
This is some text inside of a div block.

Are you a CISO or Engineering Leader worried about the Security and Cost of LLM code generation?

Review the SCW AI Trust Index, our proprietary LLM benchmarking data, before going all-in on an AI model.

Learn More

Secure AI-driven development before it ships

See developer risk, enforce policy, and prevent vulnerabilities across your software development lifecycle.

预约演示
No items found.