CWE-301 认证协议中的反射攻击

Reflection Attack in an Authentication Protocol

结构: Simple

Abstraction: Variant

状态: Draft

被利用可能性: Medium

基本描述

Simple authentication protocols are subject to reflection attacks if a malicious user can use the target machine to impersonate a trusted user.

扩展描述

A mutual authentication protocol requires each party to respond to a random challenge by the other party by encrypting it with a pre-shared key. Often, however, such protocols employ the same pre-shared key for communication with a number of different entities. A malicious user or an attacker can easily compromise this protocol without possessing the correct key by employing a reflection attack on the protocol.

相关缺陷

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

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

  • cwe_Nature: PeerOf cwe_CWE_ID: 327 cwe_View_ID: 1000

适用平台

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

常见的影响

范围 影响 注释
Access Control Gain Privileges or Assume Identity The primary result of reflection attacks is successful authentication with a target machine -- as an impersonated user.

可能的缓解方案

Architecture and Design

策略:

Use different keys for the initiator and responder or of a different type of challenge for the initiator and responder.

Architecture and Design

策略:

Let the initiator prove its identity before proceeding.

示例代码

The following example demonstrates the weakness.

bad C

unsigned char simple_digest(char alg,char buf,unsigned int len, int olen) {
const EVP_MD m;
EVP_MD_CTX ctx;
unsigned char
ret;
OpenSSL_add_all_digests();
if (!(m = EVP_get_digestbyname(alg))) return NULL;
if (!(ret = (unsigned char)malloc(EVP_MAX_MD_SIZE))) return NULL;
EVP_DigestInit(&ctx, m);
EVP_DigestUpdate(&ctx,buf,len);
EVP_DigestFinal(&ctx,ret,olen);
return ret;
}
unsigned char
generate_password_and_cmd(char *password_and_cmd) {
simple_digest("sha1",password,strlen(password_and_cmd)
...
);
}

bad Java

String command = new String("some cmd to execute & the password") MessageDigest encer = MessageDigest.getInstance("SHA");
encer.update(command.getBytes("UTF-8"));
byte[] digest = encer.digest();

分析过的案例

标识 说明 链接

Notes

Maintenance The term "reflection" is used in multiple ways within CWE and the community, so its usage should be reviewed. Other Reflection attacks capitalize on mutual authentication schemes in order to trick the target into revealing the secret shared between it and another valid user. In a basic mutual-authentication scheme, a secret is known to both the valid user and the server; this allows them to authenticate. In order that they may verify this shared secret without sending it plainly over the wire, they utilize a Diffie-Hellman-style scheme in which they each pick a value, then request the hash of that value as keyed by the shared secret. In a reflection attack, the attacker claims to be a valid user and requests the hash of a random value from the server. When the server returns this value and requests its own value to be hashed, the attacker opens another connection to the server. This time, the hash requested by the attacker is the value which the server requested in the first connection. When the server returns this hashed value, it is used in the first connection, authenticating the attacker successfully as the impersonated valid user.

分类映射

映射的分类名 ImNode ID Fit Mapped Node Name
CLASP Reflection attack in an auth protocol
OWASP Top Ten 2007 A7 CWE More Specific Broken Authentication and Session Management

相关攻击模式

  • CAPEC-90

引用