Description
This attack-focused weakness is caused by incorrectly implemented authentication schemes that are subject to spoofing attacks.
Potential Impact
Access Control
Bypass Protection Mechanism, Gain Privileges or Assume Identity
Demonstrative Examples
String sourceIP = request.getRemoteAddr();if (sourceIP != null && sourceIP.equals(APPROVED_IP)) {authenticated = true;}sd = socket(AF_INET, SOCK_DGRAM, 0);serv.sin_family = AF_INET;serv.sin_addr.s_addr = htonl(INADDR_ANY);servr.sin_port = htons(1008);bind(sd, (struct sockaddr *) & serv, sizeof(serv));
while (1) {memset(msg, 0x0, MAX_MSG);clilen = sizeof(cli);if (inet_ntoa(cli.sin_addr)==getTrustedAddress()) {n = recvfrom(sd, msg, MAX_MSG, 0, (struct sockaddr *) & cli, &clilen);}}while(true) {
DatagramPacket rp=new DatagramPacket(rData,rData.length);outSock.receive(rp);String in = new String(p.getData(),0, rp.getLength());InetAddress clientIPAddress = rp.getAddress();int port = rp.getPort();
if (isTrustedAddress(clientIPAddress) & secretKey.equals(in)) {out = secret.getBytes();DatagramPacket sp =new DatagramPacket(out,out.length, IPAddress, port); outSock.send(sp);}
}struct hostent *hp;struct in_addr myaddr;char* tHost = "trustme.example.com";myaddr.s_addr=inet_addr(ip_addr_string);
hp = gethostbyaddr((char *) &myaddr, sizeof(struct in_addr), AF_INET);if (hp && !strncmp(hp->h_name, tHost, sizeof(tHost))) {trusted = true;} else {trusted = false;}String ip = request.getRemoteAddr();InetAddress addr = InetAddress.getByName(ip);if (addr.getCanonicalHostName().endsWith("trustme.com")) {trusted = true;}IPAddress hostIPAddress = IPAddress.Parse(RemoteIpAddress);IPHostEntry hostInfo = Dns.GetHostByAddress(hostIPAddress);if (hostInfo.HostName.EndsWith("trustme.com")) {trusted = true;}Real-World CVE Examples
| CVE ID | Description |
|---|---|
| CVE-2022-30319 | S-bus functionality in a home automation product performs access control using an IP allowlist, which can be bypassed by a forged IP address. |
| CVE-2009-1048 | VOIP product allows authentication bypass using 127.0.0.1 in the Host header. |
Related Weaknesses
Taxonomy Mappings
- PLOVER: — Authentication bypass by spoofing
Frequently Asked Questions
What is CWE-290?
CWE-290 (Authentication Bypass by Spoofing) is a software weakness identified by MITRE's Common Weakness Enumeration. It is classified as a Base-level weakness. This attack-focused weakness is caused by incorrectly implemented authentication schemes that are subject to spoofing attacks.
How can CWE-290 be exploited?
Attackers can exploit CWE-290 (Authentication Bypass by Spoofing) to bypass protection mechanism, gain privileges or assume identity. This weakness is typically introduced during the Implementation, Architecture and Design phase of software development.
How do I prevent CWE-290?
Follow secure coding practices, conduct code reviews, and use automated security testing tools (SAST/DAST) to detect this weakness early in the development lifecycle.
What is the severity of CWE-290?
CWE-290 is classified as a Base-level weakness (Medium abstraction). It has been observed in 2 real-world CVEs.