Blog

不安全的加密存储和安全 | Secure Code Warrior

March 7, 2019
Jaap Karan Singh

数据是企业的命脉。这是生存、赚钱和为客户提供服务所需的基础信息。在这个日益注重数字化的社会中,开发人员作为这些宝贵信息的管理者肩负着巨大的责任。当开发人员不保护机密数据时,企业就会成为不安全的加密存储的牺牲品。

让我们来看看如何安全地存储数据,以及不这样做会发生什么。

了解不安全的加密存储

当攻击者获得系统访问权限时,他们通常是在寻找有价值的数据。你知道——可用于接管某人账户或用于执行另一次攻击的数据类型。有时,这种数据只是在黑市上出售以快速获利。

不安全的加密存储不是像 SQL 注入或 XSS 这样的单一漏洞。这是由于没有按照保护所需方式保护您本应保护的数据所致。

必须保护敏感信息。当你以纯文本形式存储密码和信用卡信息时,你正在玩游戏 俄罗斯轮盘 与您的业务有关。

如果黑客入侵您的数据库并使用以下方法窃取数据 SQL 注入XML 注入 或者任何其他攻击,他们将拥有一切。但是,如果你对数据进行加密,他们将很难真正使用这些数据。

值得注意的是,漏洞并不总是局外人恶意造成的。如果数据未加密,恶意内部人员也可以轻松窃取数据。贵公司的员工无需查看数据库中的所有内容,访问控制不足或敏感数据泄露可能会导致彻底盗窃。

还要记住,并非所有加密都是平等的。使用错误的加密算法与根本不使用它们一样危险。已知的弱算法对精明的攻击者几乎没有抵抗力。

为什么不安全的加密存储很危险

许多公司都受到了损害 由于另一个漏洞(例如SQL注入),最终无法隐藏被盗的数据。这使可怕的情况变得更糟。

  • Adult Friend Finder 遭到破坏,泄露了 4.12 亿个帐户。账户的密码受弱的 SHA-1 哈希算法保护。它们在一个月内很容易被攻击者破解。
  • 优步遭到破坏,泄露了5700万条用户记录和60万条司机记录。个人信息丢失。之所以发生这种情况,是因为优步的GitHub账户有一个公开的存储库,其中包含优步的AWS账户用户名和密码... 不是一个好主意。优步的估值下降了200亿美元,这主要是由于这一违规行为。
  • 索尼的PlayStation网络遭到入侵,泄露了7700万个账户。其中1200万个账户包含未加密的信用卡信息。索尼后来就该违规行为和解了1500万美元的集体诉讼。

不正确存储敏感数据显然会带来严重的后果。

索尼被起诉,这是一笔重大的处罚。但是,即使你没有被起诉,声誉和监管方面的损害对企业来说也可能是灾难性的。

打败不安全的加密存储

开发人员如何防止发生上述数据泄露事件?

第一步是确定哪些数据首先需要加密。毕竟,并非所有数据都是平等的。 对您的数据进行分类,然后在适当时使用加密。

通常,必须保护诸如社会安全号码、密码和信用卡详细信息之类的个人信息。根据您的业务性质,您可能需要保护健康记录或其他被视为私密的信息。

一旦知道需要保护哪些数据,下一步就是使用正确的工具来确保其安全性。总的来说,坚持使用经受住时间考验并被认为很强大的加密算法是件好事。

无论如何,不要自己编写加密函数。它们可能包含攻击者可以用来破坏加密的漏洞。

要加密社会保险号或信用卡数据等数据,请使用 AES。AES 有不同的操作模式,在撰写本文时,强烈推荐的模式是 伽罗瓦/计数器模式 (GCM)。另一个提示是确保要求你选择填充类型的库不使用填充。

对于密码,使用哈希算法对密码进行哈希处理,因为哈希值无法逆转。给定一个经过高度哈希处理的值,攻击者无法检索创建该值的原始文本。 Argon2Bcrypt被认为是哈希密码的可靠选择。请记住,在进行哈希处理之前,一定要用随机值 “加盐” 密码,这样同一个密码的两个哈希值是相同的。

这些函数将实现所有主要编程语言/框架。查看您的特定语言或框架的文档,了解如何有效使用它们。

密钥生成、存储和管理是密码学的重要组成部分。管理不当的密钥可能会被泄露并用于解密您的数据。一些框架有助于密钥管理,例如 ASP.NET 的数据保护 API。有关密钥管理的一般最佳实践,请查看 OWASP 的备忘单

安全存储数据是防止代价高昂且令人尴尬的数据泄露的方式。在最坏的情况下,如果攻击者能够窃取您的数据,他们将很难查看或将其用于任何恶意目的。

将您的数据隐藏在众目之外

让我们快速回顾一下如何保护您的数据:

  • 对数据进行分类,这样您就知道哪些需要保护
  • 使用经过行业审查的强大算法加密敏感数据
  • 使用强大的单向哈希存储密码

要进一步研究该主题,请查看我们的 学习资源。当你准备好深入研究和练习时, 试试我们的平台 使用您的首选语言。我们报道了很多!

使用这些工具,您可以防止数据被盗,并防止您的公司蒙受损失和声誉受损。

准备好立即查找和修复不安全的加密存储了吗?前往竞技场测试你的技能 [从这里开始]

标语

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.