Skip to content
Access control Write-up Advanced

Nat-Again: IRC NAT helper flaws (CVE-2022-2663)

A Linux kernel NAT helper for IRC (nf_conntrack_irc) fails to properly match DCC messages and check the external IP, allowing an attacker to trick a victim's IRC client into opening a port forward to an internal service. The attacker can also cause a denial of service by sending a DCC message with port 0.

dgl.cx

Published on dgl.cx

NAT slipstreaming was an attack where a NAT device is tricked into forwarding requests into a network that is behind a NAT router. The original attack is largely mitigated and primarily targets web browsers.

The author, on dgl.cx

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the nf_conntrack_irc helper searches for the DCC marker anywhere in the TCP stream instead of only at the start of an IRC message, and it compares the supplied IP against the IRC server's address rather than the external NAT address.

Impact

An attacker could access resources behind NAT, such as internal services, and could also disconnect a user from IRC; the attack works against standard IRC clients like Irssi and mIRC, but using TLS for IRC prevents the NAT helper from intercepting DCC requests.

What the attacker needed

Victim uses an unencrypted IRC connection; NAT helper nf_conntrack_irc is loaded; attacker can send IRC messages to victim

The fix

The kernel was patched to match on PRIVMSG and the external NAT'd IP, and users should use TLS for IRC or disable the nf_conntrack_irc helper.

How it was found

  1. The attacker sends the victim a crafted CTCP PING message containing a DCC CHAT request with the IRC server's IP encoded as a number and a chosen port.
  2. The victim's IRC client replies with a CTCP PING response that includes the DCC request, now with the victim's numeric IP address.
  3. The NAT helper sees the DCC string in the outbound stream and creates a port forward to the victim's internal machine on the specified port.
  4. The attacker connects to the victim's public IP on that port to reach the internal service.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

When you are behind a home router, a feature called NAT lets many devices share one public IP address. Some routers have special helpers that rewrite certain protocols like IRC to make them work through NAT. This report shows that the IRC helper in Linux can be fooled by a crafted message into letting an outsider connect to services on your internal network, or into disconnecting you from IRC.

What is Access control?

A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.

Similar reports

View all

Same bug class and techniques, clearest first.

Broken access control

The lesson behind this report.

A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.