apparmor: mediate the implicit connect of TCP fast open sendmsg
Linux
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
Linux
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
≥ cf60af03ca4e71134206809ea892e49b92a88896 · < 4a69b83045d3195d5b9a9b053ad840ddb2998b4e| No fix yet |
| Linux Linux |
|
|
In the Linux kernel, the following vulnerability has been resolved:
apparmor: mediate the implicit connect of TCP fast open sendmsg
sendmsg()/sendto() with MSG_FASTOPEN is a combination of connect(2) and write(2): it opens the connection in the SYN. apparmor_socket_sendmsg() only checks AA_MAY_SEND, so a profile that grants send but denies connect lets a confined task open an outbound TCP/MPTCP connection that connect(2) would have refused, bypassing connect mediation.
Mediate the implicit connect when MSG_FASTOPEN is set and a destination is supplied. Add it to apparmor_socket_sendmsg() (not the shared aa_sock_msg_perm() helper, which recvmsg also uses) and call aa_sk_perm() directly, mirroring the selinux and tomoyo fixes. sk_is_tcp() does not cover MPTCP fast open, so the SOCK_STREAM/IPPROTO_MPTCP arm is explicit.
From the CVE record · Linux
AppArmor in the Linux kernel does not check connect permission when a confined task uses sendmsg() or sendto() with MSG_FASTOPEN and a destination. A local task whose profile allows send but denies connect can open an outbound TCP or MPTCP connection that connect(2) would have refused.
Engineers running Linux with AppArmor profiles that allow send but deny connect should check whether their kernel is affected; affected versions are not specified.