CWE-472 对假设不可变Web参数的外部可控制

admin 2021年12月16日16:30:50评论101 views字数 6050阅读20分10秒阅读模式

CWE-472 对假设不可变Web参数的外部可控制

External Control of Assumed-Immutable Web Parameter

结构: Simple

Abstraction: Base

状态: Draft

被利用可能性: unkown

基本描述

The web application does not sufficiently verify inputs that are assumed to be immutable but are actually externally controllable, such as hidden form fields.

扩展描述

If a web product does not properly protect assumed-immutable values from modification in hidden form fields, parameters, cookies, or URLs, this can lead to modification of critical data. Web applications often mistakenly make the assumption that data passed to the client in hidden fields or cookies is not susceptible to tampering. Improper validation of data that are user-controllable can lead to the application processing incorrect, and often malicious, input.

For example, custom cookies commonly store session data or persistent data across sessions. This kind of session data is normally involved in security related decisions on the server side, such as user authentication and access control. Thus, the cookies might contain sensitive data such as user credentials and privileges. This is a dangerous practice, as it can often lead to improper reliance on the value of the client-provided cookie by the server side application.

相关缺陷

  • cwe_Nature: ChildOf cwe_CWE_ID: 642 cwe_View_ID: 1000 cwe_Ordinal: Primary

  • cwe_Nature: ChildOf cwe_CWE_ID: 471 cwe_View_ID: 1000

  • cwe_Nature: ChildOf cwe_CWE_ID: 471 cwe_View_ID: 699 cwe_Ordinal: Primary

适用平台

Language: {'cwe_Class': 'Language-Independent', 'cwe_Prevalence': 'Undetermined'}

常见的影响

范围 影响 注释
Integrity Modify Application Data Without appropriate protection mechanisms, the client can easily tamper with cookies and similar web data. Reliance on the cookies without detailed validation can lead to problems such as SQL injection. If you use cookie values for security related decisions on the server side, manipulating the cookies might lead to violations of security policies such as authentication bypassing, user impersonation and privilege escalation. In addition, storing sensitive data in the cookie without appropriate protection can also lead to disclosure of sensitive user data, especially data stored in persistent cookies.

可能的缓解方案

MIT-5 Implementation

策略: Input Validation

Assume all input is malicious. Use an "accept known good" input validation strategy, i.e., use a whitelist of acceptable inputs that strictly conform to specifications. Reject any input that does not strictly conform to specifications, or transform it into something that does.
When performing input validation, consider all potentially relevant properties, including length, type of input, the full range of acceptable values, missing or extra inputs, syntax, consistency across related fields, and conformance to business rules. As an example of business rule logic, "boat" may be syntactically valid because it only contains alphanumeric characters, but it is not valid if the input is only expected to contain colors such as "red" or "blue."
Do not rely exclusively on looking for malicious or malformed inputs (i.e., do not rely on a blacklist). A blacklist is likely to miss at least one undesirable input, especially if the code's environment changes. This can give attackers enough room to bypass the intended validation. However, blacklists can be useful for detecting potential attacks or determining which inputs are so malformed that they should be rejected outright.

MIT-20 Implementation

策略: Input Validation

Inputs should be decoded and canonicalized to the application's current internal representation before being validated (CWE-180). Make sure that the application does not decode the same input twice (CWE-174). Such errors could be used to bypass whitelist validation schemes by introducing dangerous inputs after they have been checked.

示例代码

In this example, a web application uses the value of a hidden form field (accountID) without having done any input validation because it was assumed to be immutable.

bad Java

String accountID = request.getParameter("accountID");
User user = getUserFromID(Long.parseLong(accountID));

Hidden fields should not be trusted as secure parameters.

An attacker can intercept and alter hidden fields in a post to the server as easily as user input fields. An attacker can simply parse the HTML for the substring:

bad HTML

or even just "hidden". Hidden field values displayed later in the session, such as on the following page, can open a site up to cross-site scripting attacks.

分析过的案例

标识 说明 链接
CVE-2002-0108 Forum product allows spoofed messages of other users via hidden form fields for name and e-mail address. https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2002-0108
CVE-2000-0253 Shopping cart allows price modification via hidden form field. https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2000-0253
CVE-2000-0254 Shopping cart allows price modification via hidden form field. https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2000-0254
CVE-2000-0926 Shopping cart allows price modification via hidden form field. https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2000-0926
CVE-2000-0101 Shopping cart allows price modification via hidden form field. https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2000-0101
CVE-2000-0102 Shopping cart allows price modification via hidden form field. https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2000-0102
CVE-2000-0758 Allows admin access by modifying value of form field. https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2000-0758
CVE-2002-1880 Read messages by modifying message ID parameter. https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2002-1880
CVE-2000-1234 Send email to arbitrary users by modifying email parameter. https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2000-1234
CVE-2005-1652 Authentication bypass by setting a parameter. https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2005-1652
CVE-2005-1784 Product does not check authorization for configuration change admin script, leading to password theft via modified e-mail address field. https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2005-1784
CVE-2005-2314 Logic error leads to password disclosure. https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2005-2314
CVE-2005-1682 Modification of message number parameter allows attackers to read other people's messages. https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2005-1682

Notes

Relationship
This is a primary weakness for many other weaknesses and functional consequences, including XSS, SQL injection, path disclosure, and file inclusion.
Theoretical
This is a technology-specific MAID problem.

分类映射

映射的分类名 ImNode ID Fit Mapped Node Name
PLOVER Web Parameter Tampering
OWASP Top Ten 2007 A4 CWE More Specific Insecure Direct Object Reference
OWASP Top Ten 2004 A1 CWE More Specific Unvalidated Input

相关攻击模式

  • CAPEC-146
  • CAPEC-226
  • CAPEC-31
  • CAPEC-39

引用

文章来源于互联网:scap中文网

  • 左青龙
  • 微信扫一扫
  • weinxin
  • 右白虎
  • 微信扫一扫
  • weinxin
admin
  • 本文由 发表于 2021年12月16日16:30:50
  • 转载请保留本文链接(CN-SEC中文网:感谢原作者辛苦付出):
                   CWE-472 对假设不可变Web参数的外部可控制http://cn-sec.com/archives/613014.html

发表评论

匿名网友 填写信息