网站编程漏洞清单

发布于 2024-07-04 14:08:19 字数 476 浏览 8 评论 0原文

观看 SO 上线对我来说是一种很好的教育。 我想制作一份针对网站的各种漏洞和利用的清单,以及可以使用哪些编程技术来防御它们。

  • 漏洞有哪些类别?
  • 什么样的防御性编程技术?
  • ETC...

Watching SO come online has been quite an education for me. I'd like to make a checklist of various vunerabilities and exploits used against web sites, and what programming techniques can be used to defend against them.

  • What categories of vunerabilities?
  • What kind of defensive programming techniques?
  • etc...

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(9

优雅的叶子 2024-07-11 14:08:19

显然,测试每个字段是否存在漏洞:

  • SQL - 转义字符串(例如 mysql_real_escape_string
  • XSS
  • 从输入字段打印
  • 创建字段的特定目的的内容

HTML(通常是 XSS 的好兆头) 任何其他不是为搜索 对于无限循环(唯一可能真正杀死服务器的间接事物(如果很多人意外发现它))。

Obviously test every field for vulnerabilities:

  • SQL - escape strings (e.g. mysql_real_escape_string)
  • XSS
  • HTML being printed from input fields (a good sign of XSS usually)
  • Anything else thatis not the specific purpose that field was created for

Search for infinite loops (the only indirect thing (if a lot of people found it accidentally) that could kill a server really).

別甾虛僞 2024-07-11 14:08:19

来自 开放 Web 应用程序安全项目

  1. OWASP 十大漏洞 (pdf)
  2. 如需更详尽的列表:Category:Vulnerability

排名前十的分别是:

  1. 跨站脚本(XSS)
  2. 注入缺陷(SQL注入、脚本注入)
  3. 恶意文件执行
  4. 不安全的直接对象参考
  5. 跨站点请求伪造 (XSRF)
  6. 信息泄露和错误处理
  7. 不当 身份验证和会话管理
  8. 失效 加密存储
  9. 不安全 通信
  10. 不安全 限制 URL 访问失败

From the Open Web Application Security Project:

  1. The OWASP Top Ten vulnerabilities (pdf)
  2. For a more painfully exhaustive list: Category:Vulnerability

The top ten are:

  1. Cross-site scripting (XSS)
  2. Injection flaws (SQL injection, script injection)
  3. Malicious file execution
  4. Insecure direct object reference
  5. Cross-site request forgery (XSRF)
  6. Information leakage and improper error handling
  7. Broken authentication and session management
  8. Insecure cryptographic storage
  9. Insecure communications
  10. Failure to restrict URL access
香橙ぽ 2024-07-11 14:08:19

一些预防技术:

XSS

  • 如果您从用户处获取任何参数/输入并计划输出它,无论是在日志中还是在网页中,请对其进行清理(删除/转义任何类似于 HTML、引号、javascript 的内容... ) 如果您在页面中打印当前 URI,请清理! 例如,即使打印 PHP_SELF 也是不安全的。 消毒! 反射型 XSS 主要来自未经清理的页面参数。

  • 如果您从用户那里获取任何输入并保存或打印它,则在检测到任何危险/无效内容时警告他们并让他们重新输入。 IDS 非常适合检测(例如 PHPIDS)。然后在存储/打印之前进行清理。 然后,当您从存储/数据库打印某些内容时,请再次清理!
    输入-> IDS/消毒 -> 商店-> 消毒-> 输出

  • 在开发过程中使用代码扫描器来帮助发现潜在的易受攻击的代码。

XSRF

  • 切勿使用 GET 请求
    破坏性功能,即
    删除帖子。 相反,仅
    接受 POST 请求。 GET 使得黑客攻击变得更加容易。
  • 检查
    推荐人以确保请求
    来自您的网站
    工作。 欺骗并不难
    推荐人。
  • 使用随机哈希作为令牌,该令牌在每个请求中都必须存在且有效,并且会在一段时间后过期。 在隐藏的表单字段中打印令牌,并在发布表单时在服务器端检查它。 坏人必须提供正确的令牌才能伪造请求,如果他们设法获得真正的令牌,则需要在令牌过期之前获得。

SQL 注入

  • 您的 ORM 或 db 抽象类应该具有清理方法 - 始终使用它们。 如果您没有使用 ORM 或 db 抽象类...您应该使用。

Some prevention techniques:

XSS

  • If you take any parameters/input from the user and ever plan on outputting it, whether in a log or a web page, sanitize it (strip/escape anything resembling HTML, quotes, javascript...) If you print the current URI of a page within itself, sanitize! Even printing PHP_SELF, for example, is unsafe. Sanitize! Reflective XSS comes mostly from unsanitized page parameters.

  • If you take any input from the user and save it or print it, warn them if anything dangerous/invalid is detected and have them re-input. an IDS is good for detection (such as PHPIDS.) Then sanitize before storage/printing. Then when you print something from storage/database, sanitize again!
    Input -> IDS/sanitize -> store -> sanitize -> output

  • use a code scanner during development to help spot potentially vulnerable code.

XSRF

  • Never use GET request for
    destructive functionality, i.e.
    deleting a post. Instead, only
    accept POST requests. GET makes it extra easy for hackery.
  • Checking the
    referrer to make sure the request
    came from your site does not
    work
    . It's not hard to spoof the
    referrer.
  • Use a random hash as a token that must be present and valid in every request, and that will expire after a while. Print the token in a hidden form field and check it on the server side when the form is posted. Bad guys would have to supply the correct token in order to forge a request, and if they managed to get the real token, it would need to be before it expired.

SQL injection

  • your ORM or db abstraction class should have sanitizing methods - use them, always. If you're not using an ORM or db abstraction class... you should be.
十雾 2024-07-11 14:08:19

您可以从 Security Compass 获得优秀的 Firefox 插件来测试多个缺陷和漏洞,例如 xss 和 sql 注入。 可惜它们不能在 Firefox 3.0 上运行。 我希望这些能尽快更新。

You can get good firefox addons to test multiple flaws and vulnerabilities like xss and sql injections from Security Compass. Too bad they doesn't work on firefox 3.0. I hope that those will be updated soon.

|煩躁 2024-07-11 14:08:19

SQL注入

SQL injection

原谅过去的我 2024-07-11 14:08:19

XSS(跨站脚本)攻击

XSS (Cross Site Scripting) Attacks

向日葵 2024-07-11 14:08:19

易于监督且易于修复:清理从客户端接收的数据。 检查诸如“;”之类的内容 可以帮助防止恶意代码被注入到您的应用程序中。

Easy to oversee and easy to fix: the sanitizing of data received from the client side. Checking for things such as ';' can help in preventing malicious code being injected into your application.

山色无中 2024-07-11 14:08:19

大家好,

一个很好的安全静态分析工具是 David Wheeler 编写的 FlawFinder。 它在寻找各种安全漏洞方面做得很好,

但是,它并不能取代让知识渊博的人阅读您的代码。 正如大卫在他的网页上所说,“拥有工具的傻瓜仍然是傻瓜!”

HTH。

干杯,

G'day,

A good static analysis tool for security is FlawFinder written by David Wheeler. It does a good job looking for various security exploits,

However, it doesn't replace having a knowledgable someone read through your code. As David says on his web page, "A fool with a tool is still a fool!"

HTH.

cheers,
Rob

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文