CWE-228 语法无效结构处理不恰当

admin 2021年12月16日16:31:34评论70 views字数 2460阅读8分12秒阅读模式

CWE-228 语法无效结构处理不恰当

Improper Handling of Syntactically Invalid Structure

结构: Simple

Abstraction: Class

状态: Incomplete

被利用可能性: unkown

基本描述

The product does not handle or incorrectly handles input that is not syntactically well-formed with respect to the associated specification.

相关缺陷

  • cwe_Nature: ChildOf cwe_CWE_ID: 703 cwe_View_ID: 1000

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

常见的影响

范围 影响 注释
['Integrity', 'Availability'] ['Unexpected State', 'DoS: Crash, Exit, or Restart', 'DoS: Resource Consumption (CPU)'] If an input is syntactically invalid, then processing the input could place the system in an unexpected state that could lead to a crash, consume available system resources or other unintended behaviors.

示例代码

This application has registered to handle a URL when sent an intent:

bad Java


...

IntentFilter filter = new IntentFilter("com.example.URLHandler.openURL");
MyReceiver receiver = new MyReceiver();
registerReceiver(receiver, filter);
...

public class UrlHandlerReceiver extends BroadcastReceiver {

@Override
public void onReceive(Context context, Intent intent) {

if("com.example.URLHandler.openURL".equals(intent.getAction())) {

String URL = intent.getStringExtra("URLToOpen");
int length = URL.length();

...

}

}

}

The application assumes the URL will always be included in the intent. When the URL is not present, the call to getStringExtra() will return null, thus causing a null pointer exception when length() is called.

Notes

Maintenance
This entry needs more investigation. Public vulnerability research generally focuses on the manipulations that generate invalid structure, instead of the weaknesses that are exploited by those manipulations. For example, a common attack involves making a request that omits a required field, which can trigger a crash in some cases. The crash could be due to a named chain such as CWE-690 (Unchecked Return Value to NULL Pointer Dereference), but public reports rarely cover this aspect of a vulnerability.
Maintenance
The validity of input could be roughly classified along "syntactic", "semantic", and "lexical" dimensions. If the specification requires that an input value should be delimited with the "[" and "]" square brackets, then any input that does not follow this specification would be syntactically invalid. If the input between the brackets is expected to be a number, but the letters "aaa" are provided, then the input is syntactically invalid. If the input is a number and enclosed in brackets, but the number is outside of the allowable range, then it is semantically invalid. The inter-relationships between these properties - and their associated weaknesses- need further exploration.

分类映射

映射的分类名 ImNode ID Fit Mapped Node Name
PLOVER Structure and Validity Problems
OWASP Top Ten 2004 A7 CWE More Specific Improper Error Handling

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

  • 左青龙
  • 微信扫一扫
  • weinxin
  • 右白虎
  • 微信扫一扫
  • weinxin
admin
  • 本文由 发表于 2021年12月16日16:31:34
  • 转载请保留本文链接(CN-SEC中文网:感谢原作者辛苦付出):
                   CWE-228 语法无效结构处理不恰当http://cn-sec.com/archives/612991.html

发表评论

匿名网友 填写信息