CVE-2026–31431 \Copy Fail\: A Deep Dive into the Linux algif_aead Privilege Escalation
A logic flaw in the Linux kernel's AF_ALG AEAD interface lets an unprivileged local user write a controlled 4-byte value at a chosen offset into the page cache of any readable file. By repeating this against a setuid binary and then executing it, an attacker could gain root privileges.
Published on medium.com
Linux
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.
Context
CVE-2026-31431, which the author calls "Copy Fail", is a local privilege escalation in the Linux kernel's algif_aead interface. The target is not a web application: it is the kernel crypto API as exposed to unprivileged userspace through the AF_ALG socket family, combined with splice() and the IPsec-specific authencesn AEAD template.
AF_ALG lets any process use the kernel's own crypto primitives (AES, SHA and so on) from userspace: open the socket, bind() to an algorithm, sendmsg() the data, recvmsg() the result. No privileges are required at any step.
splice() normally avoids the copy that read() performs by handing a reference to the kernel's page cache, the in-memory cached copy of a file, directly to a pipe or socket. Whoever receives that reference holds a pointer straight into the live cache of the file.
AEAD (Authenticated Encryption with Associated Data) bundles encryption with an integrity tag. authencesn is the IPsec flavour used for Extended Sequence Numbers: a 64-bit sequence counter split into a high half (seqno_hi) and a low half (seqno_lo). To compute the HMAC correctly it temporarily rearranges these bytes, and it does so by treating the destination buffer as disposable scratch space.
The bug is not a race condition or a timing attack. It is a deterministic logic bug: call the right syscalls in the right order and it fires every time. An unprivileged local user can write a controlled 4-byte value at a controlled offset inside the kernel's page cache for any readable file, and turning that into a root shell is a matter of patience.

Setup
The preconditions are those of any local attacker on a vulnerable kernel:
- local code execution as an unprivileged user;
- the ability to bind to
authencesn(hmac(sha256),cbc(aes))throughAF_ALG; - read access to the target file, which can be any readable file, including setuid binaries such as
/usr/bin/su.
No privileges are needed to open the AF_ALG socket, bind the algorithm, send the AAD or splice the file.
Finding it
The author frames the discovery as the intersection of three kernel concepts that each look harmless in isolation.
AF_ALGexposes kernel crypto to unprivileged userspace.splice()delivers page cache pages to the crypto layer by reference rather than by copy.authencesnuses the destination buffer as scratch space for ESN byte rearrangement.
The decrypt path in algif_aead.c originally kept separate source and destination scatterlists. In 2017, commit 72548b093ee3 introduced an in-place optimisation: source and destination collapse into the same memory. On decrypt, the input scatterlist is laid out as AAD || ciphertext || auth tag. The AAD and ciphertext are genuinely copied via memcpy_sglist() into the user's receive buffer. The auth tag, the last authsize bytes, is not copied: its scatterlist entries are chained by reference onto the end of the output scatterlist with sg_chain().
Input SGL: [ AAD ] [ Ciphertext ] [ Tag ]
| | └─ sg_chain() — reference only, still page cache
v v
Output SGL: [ AAD ] [ Ciphertext ] ─────────┘
(RX buffer, real copy) (original page cache, referenced)
The kernel then sets req->src = req->dst, pointing both at the same combined chain:
req->src ─┐
v
req->dst ─→ [ AAD | Ciphertext ] → [ Tag (raw page cache) ]
└──── userspace RX buffer ────┘ └── chained from the spliced file's cache ──┘
This design silently assumes every AEAD algorithm confines its writes to the legitimate output region. Nothing in the API enforces that assumption, and one algorithm breaks it.

Exploitation
Step 1: open an AF_ALG socket and bind the algorithm
Open an AF_ALG socket and bind to authencesn(hmac(sha256),cbc(aes)). No privileges are needed.
Step 2: send a crafted AAD
sendmsg() a crafted AAD whose bytes 4 to 7 carry the 4 bytes you want written. Those bytes are the value that authencesn will later place past the output boundary.
Step 3: splice the target file into the socket
splice() the target file (for example /usr/bin/su) through a pipe into the socket, choosing the offset and length so that the tag boundary lands exactly where you want to write. The offset, the splice length and assoclen together determine where assoclen + cryptlen falls inside the file's cached pages.
Step 4: trigger decryption with recvmsg()
recvmsg() triggers decryption. authencesn's scratch write lands in the chained page cache pages. HMAC verification fails and the call returns an error, but the 4-byte write has already happened.
Step 5: repeat and execve()
Loop steps 2 to 4 to place a full payload 4 bytes at a time inside the target binary's .text section, then execve() it. Because the binary is setuid-root, the injected code runs as UID 0.

The critical detail is that the kernel never marks the corrupted page dirty. Ordinary writes go through the VFS write path and get flagged for writeback to disk; this write bypasses that entirely. The on-disk file is untouched, so checksum-based integrity tools miss it completely. But every read, mmap() or execve() of that file goes through the page cache, so the corruption is live system-wide immediately. Since the page cache is shared host-wide, the same primitive crosses container boundaries.
Root cause
The trigger is in authencesn's decrypt routine, crypto_authenc_esn_decrypt, which uses the destination buffer as scratch space for ESN byte rearrangement. Reconstructed conceptually, it looks like this:
scatterwalk_map_and_copy(tmp, dst, 0, 8, 0);
scatterwalk_map_and_copy(tmp, dst, 4, 4, 1);
scatterwalk_map_and_copy(tmp + 1, dst, assoclen + cryptlen, 4, 1);
The first two calls stay inside the AAD region and get restored, so they are harmless. The third is the problem. assoclen + cryptlen is exactly the offset where the auth tag begins, and the AEAD output contract says the destination should only ever contain AAD || plaintext. authencesn writes 4 bytes past that contract, and nothing ever restores the original bytes at that position. crypto_authenc_esn_decrypt_tail() reads seqno_lo back out, but never writes back whatever was there before. Once overwritten, it is gone.
No other AEAD algorithm in the kernel does this: GCM, CCM and plain authenc all stay inside their output region. authencesn alone reaches past the boundary. Before 2017, when source and destination were separate, this stray write landed harmlessly at the tail of the user's own receive buffer. After the in-place optimisation, the same write walks straight into the sg_chain()-linked tag pages, which are the real page cache of the spliced file.
Three things are fully attacker-controlled:
- Which file: anything readable by the current user, including setuid binaries.
- Which offset: by choosing the splice file offset, splice length and
assoclen, the attacker can makeassoclen + cryptlenland on any 4-byte position inside the file's cached pages. - Which value: the overwritten bytes come straight from bytes 4 to 7 of the attacker-supplied AAD in
sendmsg().
That is a fully controlled arbitrary 4-byte write primitive against the page cache of any readable file.
The author traces how three reasonable commits became one bug:
| Year | Commit | Change | Why it was safe at the time |
|---|---|---|---|
| 2011 | a5079d084f8b |
authencesn added; uses dst as ESN scratch space |
Only caller was the kernel's internal xfrm layer |
| 2015 | 104880a6b470 |
authencesn ported to the new AEAD interface, introducing the assoclen+cryptlen out-of-bounds write |
AF_ALG still used separate src/dst scatterlists |
| 2015 | (algif_aead introduced) | AF_ALG gains AEAD and splice support |
Page cache pages could now reach the crypto layer |
| 2017 | 72548b093ee3 |
algif_aead switches to in-place operation, req->src = req->dst |
This is where all three pieces collide |
Each commit made sense in isolation. Nobody connected authencesn's scratch-write habit, splice's page-cache-by-reference delivery and algif_aead's in-place design until they had been sitting together, silently exploitable, for almost a decade.
Impact
An unprivileged local user can write a controlled 4-byte value at a controlled offset in the page cache of any file they can read. By looping the primitive, the author describes placing a full payload inside the .text section of a setuid-root binary and executing it as UID 0.
The corruption is invisible on disk and therefore to checksum-based integrity tools, but it is live for every read, mmap() and execve() of the file. Because the page cache is shared host-wide, the primitive crosses container boundaries, which matters in containerised and multi-tenant environments.
Fix
Fix commit a664bf3d603d effectively reverts the 2017 optimisation:
aead_request_set_crypt(&areq->cra_u.aead_req,
rsgl_src,
areq->first_rsgl.sgl.sgt.sgl,
used, ctx->iv);
aead_request_set_crypt(&areq->cra_u.aead_req,
tsgl_src,
areq->first_rsgl.sgl.sgt.sgl,
used, ctx->iv);
After the patch, req->src (which may contain spliced page cache pages) and req->dst (the user's buffer) are fully separated. Only the AAD gets copied from src to dst, and the sg_chain() logic that linked tag pages into the writable destination is removed entirely. Even if authencesn writes past assoclen + cryptlen, that position only ever contains user memory, never page cache. The commit message states that there is no benefit to in-place operation in algif_aead, since source and destination come from entirely different memory mappings to begin with.
If an immediate kernel update is not possible, blocking the vulnerable module removes the attack surface:
echo "install algif_aead /bin/false" > /etc/modprobe.d/disable-algif-aead.conf
rmmod algif_aead 2>/dev/null || true
In containerised or multi-tenant environments, blocking socket(AF_ALG, ...) via a seccomp profile is a solid additional line of defence.
- Other AEAD templates that write to the destination beyond the output region. Audit each template's decrypt routine for writes at or past
assoclen + cryptlen. A positive result is a write that survives into the chained tag pages afterrecvmsg()returns an error. - Other in-place conversions of
req->src = req->dst. Look for interfaces where a reference to page cache can reach a crypto or copy path that treats the destination as scratch. A positive result is a page cache modification that leaves the on-disk file unchanged. - Other splice consumers. Any socket or pipe consumer that receives page cache references and then writes into the same buffer is a candidate. A positive result is a controlled change visible through
mmap()orexecve()but not through a checksum of the file on disk. - Container boundary checks. Run the primitive in one container against a file shared through the host page cache and observe it from another. A positive result is corruption visible outside the originating container.
- Integrity tooling coverage. Compare a checksum-based scanner's verdict with the actual behaviour of the corrupted file. A positive result is a scanner reporting the file as intact while execution uses the modified content.
What happened, in plain words
A security researcher who publishes under the name WhitGuidance wrote up a bug in the Linux kernel, the core program that sits underneath every Linux computer and server. The bug got the identifier CVE-2026-31431, and the author nicknamed it "Copy Fail".
Normally, a bug like this would be about a website. This one is not. It is about something that happens entirely inside the machine: a person who already has a small foothold on a Linux system, but only as an ordinary user with no special rights, can quietly change the contents of files that the system trusts, and from there become the all-powerful administrator account, called root.
The author describes it as a deterministic logic bug. That means it is not a lucky guess or a race against the clock. If you make the right system calls in the right order, it works every single time. The write-up is a deep dive into how three separate pieces of the kernel, each of which looks perfectly sensible on its own, combine into something dangerous.

The pieces you need to understand first
Before the bug itself, the author lays out three kernel concepts. Each one is harmless in isolation, and each one is needed for the attack to work.
What a kernel is, and what a system call is
The kernel is the part of the operating system that talks directly to the hardware and enforces the rules: which program may read which file, which user may do what. Ordinary programs cannot touch the hardware or the kernel's memory directly. Instead they ask the kernel to do things for them, using a mechanism called a system call, often shortened to syscall. Opening a file, reading it, sending data over a network connection: all of these are system calls.
A useful comparison is a hotel. You are the guest, your program. The kernel is the front desk. You cannot walk into the storage room yourself; you fill in a request slip and hand it to the desk, and the desk fetches what you asked for. A system call is that request slip.
AF_ALG: the kernel's built-in cryptography service
The Linux kernel contains implementations of cryptographic algorithms: AES, SHA and many others. These are the same kinds of mathematical routines that websites use to encrypt traffic. The kernel exposes them to ordinary programs through a socket family called AF_ALG.
A socket, in computing, is one end of a two-way channel for sending and receiving data. Most people meet sockets as network connections, but Linux also uses the socket mechanism for other kinds of channels, and AF_ALG is one of those: it is a channel to the kernel's crypto engine.
The usage pattern is simple, and the author stresses that no privileges are required at any step:
- Open the socket.
bind()it to an algorithm, which means telling the kernel which cryptographic recipe you want to use.sendmsg()your data, which hands the input to the algorithm.recvmsg()the result, which collects the output.
An everyday comparison: think of a self-service photocopier in a public library. You do not need a staff badge to use it. You put your document in, press the button, and take the copy out. AF_ALG is the same idea for cryptography: anyone can walk up and use it.
splice(): handing over a reference instead of a copy
When a program reads a file with the ordinary read() call, the kernel copies the file's contents out of its own memory and into a buffer belonging to the program. That copy costs time.
The splice() call skips the copy. Instead of duplicating the data, it hands a reference to the kernel's own page cache directly to a pipe or a socket. The page cache is the in-memory copy of a file that the kernel keeps around after reading it from disk, so that repeated reads are fast. A reference here means a pointer: not the data itself, but an address saying "the data lives over there".
The consequence the author highlights is that whoever receives that reference is now holding a pointer straight into the real, live cache of that file. To stay with the photocopier: read() is like photocopying a page and handing you the copy. splice() is like handing you the key to the room where the original is stored.
AEAD and authencesn: encryption with a tamper seal
AEAD stands for Authenticated Encryption with Associated Data. It bundles two jobs into one: encrypting the data so nobody can read it, and producing an integrity tag, a short value that acts as a tamper seal. If anyone changes even one byte of the encrypted data, the tag no longer matches and the receiver knows something is wrong.
authencesn is a specific flavour of AEAD used in IPsec, the standard suite for encrypting network traffic between machines. The "esn" part stands for Extended Sequence Numbers. Network protocols number their packets so they can be put back in order and so that replayed packets can be spotted. An extended sequence number is a 64-bit counter, split into a high half called seqno_hi and a low half called seqno_lo.
To compute its integrity check correctly, authencesn needs to temporarily rearrange these counter bytes. The author's key observation is how it does that: it treats the destination buffer, the memory where the output is being assembled, as disposable scratch space. Scratch space means a place you scribble working notes and do not expect to keep. That habit, of borrowing the output area as a notepad, is the trigger for everything that follows.
Each of the three pieces is reasonable on its own. The bug lives where they meet.
The root cause: a 2017 optimisation
The decrypt path in a kernel source file called algif_aead.c originally kept two separate memory areas: one for the source data coming in, and one for the destination data going out. In 2017, a change with the commit identifier 72548b093ee3 introduced an in-place optimisation. In-place means the source and the destination collapse into the same memory, so the kernel works on the data where it already sits instead of moving it.
A commit, in software development, is a recorded change to the source code, with an identifier and a message explaining it. An optimisation is a change made to save time or resources without changing what the program is supposed to do.
Here is what happens on decrypt, step by step:
- The input is laid out as
AAD || ciphertext || auth tag. The||symbol means "followed by". AAD is the associated data, extra information that is authenticated but not encrypted. Ciphertext is the encrypted payload. The auth tag is the tamper seal described above. - The AAD and the ciphertext are genuinely copied, using a routine called
memcpy_sglist(), into the buffer the user will receive. That part is safe, because it is a real copy. - The auth tag, the last
authsizebytes, is not copied. Instead its memory entries are chained by reference onto the end of the output list usingsg_chain(). Chained by reference means linked, not duplicated: the output now points at the original tag bytes.
The author draws the layout like this:
Input SGL: [ AAD ] [ Ciphertext ] [ Tag ]
| | └─ sg_chain() — reference only, still page cache
v v
Output SGL: [ AAD ] [ Ciphertext ] ─────────┘
(RX buffer, real copy) (original page cache, referenced)
Line by line: the top row is the input, three blocks in order. The two arrows show the AAD and ciphertext being copied down into the output. The corner symbol on the right shows the tag being linked rather than copied, so it is still the page cache. The bottom row is the output: the first two blocks are a real copy in the receive buffer, and the third block is the original page cache, merely referenced.
SGL here stands for scatterlist, which is how the kernel describes a chunk of memory that may be spread across several physical pages. RX is short for receive.
The kernel then sets req->src = req->dst, pointing both the source and the destination at the same combined chain:
req->src ─┐
v
req->dst ─→ [ AAD | Ciphertext ] → [ Tag (raw page cache) ]
└──── userspace RX buffer ────┘ └── chained from the spliced file's cache ──┘
Line by line: req->src and req->dst are the request's source and destination pointers. The diagram shows both arrows converging on the same chain. The first part of that chain is the user's receive buffer. The second part is the tag, chained from the spliced file's cache, meaning it points at the real cached bytes of the file that was spliced in.
This design silently assumes that every AEAD algorithm confines its writes to the legitimate output region. Nothing in the API enforces that assumption, and one algorithm breaks it. An API, or application programming interface, is the agreed set of calls and rules through which one piece of software uses another; here it is the set of calls through which programs use the kernel's crypto engine.

The trigger: authencesn scribbles past the edge
The decrypt routine of authencesn, called crypto_authenc_esn_decrypt, uses the destination buffer as scratch space for rearranging the sequence-number bytes. Reconstructed conceptually, the author shows it like this:
scatterwalk_map_and_copy(tmp, dst, 0, 8, 0);
scatterwalk_map_and_copy(tmp, dst, 4, 4, 1);
scatterwalk_map_and_copy(tmp + 1, dst, assoclen + cryptlen, 4, 1);
Line by line, these are three calls to a helper that walks across scattered memory and copies bytes between places:
- The first call copies 8 bytes from the start of the destination into a temporary buffer
tmp. The final0means the direction is from destination to temporary storage. This is reading the sequence number out. - The second call copies 4 bytes from offset 4 of the destination back into
tmp. The final1means the direction is from temporary storage back to the destination. This is putting part of it back. - The third call copies 4 bytes from
tmp + 1to the destination at offsetassoclen + cryptlen. Again the final1means a write into the destination.
Steps one and two stay inside the AAD region and get restored, so they are harmless. Step three is the problem. The offset assoclen + cryptlen is exactly where the auth tag begins, and the AEAD output contract says the destination should only ever contain AAD || plaintext. Plaintext is the decrypted, readable form of the data. authencesn writes 4 bytes past that contract, and nothing ever restores the original bytes at that position. A later routine, crypto_authenc_esn_decrypt_tail(), reads seqno_lo back out, but never writes back whatever was there before. Once overwritten, it is gone.
A comparison: imagine a form with boxes for name, address and signature. The rules say you may only write in the first two boxes. authencesn fills in the first two, then also scribbles four characters into the signature box, and nobody ever rubs them out.
No other AEAD algorithm in the kernel does this. GCM, CCM and plain authenc all stay inside their output region. authencesn alone reaches past the boundary. Before 2017, when source and destination were separate, this stray write landed harmlessly at the tail of the user's own receive buffer. After the in-place optimisation, the same write walks straight into the tag pages linked by sg_chain(), which are the real page cache of the spliced file.
Three things are fully under the attacker's control:
- Which file: anything the current user can read, including setuid binaries.
- Which offset: by choosing the splice file offset, the splice length and
assoclen, the attacker can makeassoclen + cryptlenland on any 4-byte position inside the file's cached pages. - Which value: the overwritten bytes come straight from bytes 4 to 7 of the AAD that the attacker supplied in
sendmsg().
A setuid binary is a program marked with a special permission bit that makes it run with the rights of its owner rather than of the person launching it. When the owner is root, the program runs as root. The report gives /usr/bin/su as an example target.
That combination gives a fully controlled arbitrary 4-byte write primitive against the page cache of any readable file. A primitive, in security writing, means a small basic capability that can be repeated and combined into something larger.
The exploit flow, step by step

The author describes five steps. The first four are repeated in a loop; the fifth turns the result into a root shell.
- Open an AF_ALG socket and bind to the algorithm. The algorithm named is
authencesn(hmac(sha256),cbc(aes)). No privileges are needed. Why this step: the whole attack runs through the kernel's crypto service, so the first job is to connect to it and select the one algorithm whose scratch-writing habit can be abused. - sendmsg() a crafted AAD. Bytes 4 to 7 of that AAD carry the 4 bytes you want written. Why this step: those bytes are the value that
authencesnwill later place past the output boundary, so this is how the attacker chooses what gets written. - splice() the target file through a pipe into the socket. The example target is
/usr/bin/su, choosing the offset and length so that the tag boundary lands exactly where you want to write. Why this step: splicing is what puts the real page cache of the target file into the destination chain, so this is how the attacker chooses which file and which position gets written. - recvmsg() triggers decryption.
authencesn's scratch write lands in the chained page cache pages. HMAC verification fails and the call returns an error, but the 4-byte write has already happened. HMAC is a keyed integrity check, a way of proving data came from someone holding the right key and was not altered. Why this matters: the error is a red herring. The operation reports failure while the damage is already done, so a program that only checks the return value sees nothing wrong. - Repeat, then execve(). Loop steps 2 to 4 to place a full payload 4 bytes at a time inside the target binary's
.textsection, thenexecve()it. Because the binary is setuid-root, the injected code runs as UID 0. The.textsection is the part of a program file that holds its executable machine code.execve()is the system call that starts running a program. UID 0 is the numeric identifier of root, the administrator account.
The critical detail is that the kernel never marks the corrupted page dirty. Dirty, in this context, means changed in memory but not yet written back to disk. Ordinary writes go through the VFS write path, the kernel's general file-writing machinery, and get flagged for writeback to disk. This write bypasses that entirely. The consequences the author lists:
- The file on disk is untouched, so checksum-based integrity tools miss it completely. A checksum is a short fingerprint computed from a file's contents; if the contents change, the fingerprint changes. Tools that compare fingerprints against a known-good value will see no difference, because the disk copy really has not changed.
- Every read,
mmap()orexecve()of that file goes through the page cache, so the corruption is live system-wide immediately.mmap()is the call that maps a file into a program's memory so it can be read or executed directly. - Because the page cache is shared across the whole host, the same primitive crosses container boundaries. A container is an isolated box on a shared machine, used to keep applications apart; sharing the host's page cache means one box can affect another.
How three reasonable changes became one bug
The author traces the history as a table. Each change made sense when it was made; nobody connected them until they had been sitting together, silently exploitable, for almost a decade.
| Year | Commit | Change | Why it was safe at the time |
|---|---|---|---|
| 2011 | a5079d084f8b |
authencesn added; uses dst as ESN scratch space |
Only caller was the kernel's internal xfrm layer |
| 2015 | 104880a6b470 |
authencesn ported to the new AEAD interface, introducing the assoclen+cryptlen out-of-bounds write |
AF_ALG still used separate src/dst scatterlists |
| 2015 | (algif_aead introduced) | AF_ALG gains AEAD and splice support |
Page cache pages could now reach the crypto layer |
| 2017 | 72548b093ee3 |
algif_aead switches to in-place operation, req->src = req->dst |
This is where all three pieces collide |
Reading the table in plain words: in 2011 the scratch-writing habit was harmless because the only thing calling that code was the kernel's own internal IPsec machinery, which never handed it a file's page cache. In 2015 the code was moved to a newer interface and the out-of-bounds write appeared, but the user-facing crypto socket still kept source and destination separate, so the stray write landed in the user's own buffer. In the same year, the user-facing interface gained the ability to receive page cache pages through splice. In 2017 the in-place change merged source and destination, and that is the moment all three pieces met.
The fix: back to separate source and destination
The fix commit is a664bf3d603d, and it effectively reverts the 2017 optimisation:
aead_request_set_crypt(&areq->cra_u.aead_req,
rsgl_src,
areq->first_rsgl.sgl.sgt.sgl,
used, ctx->iv);
aead_request_set_crypt(&areq->cra_u.aead_req,
tsgl_src,
areq->first_rsgl.sgl.sgt.sgl,
used, ctx->iv);
Line by line: both blocks call the same function, aead_request_set_crypt, which tells the crypto layer where the data comes from and where it should go. The first argument is the request structure. The second is the source: rsgl_src in the first call and tsgl_src in the second. The third is the destination, the user's buffer. The fourth is the length, used. The fifth is the initialisation vector, ctx->iv, a starting value that encryption needs so that identical inputs do not produce identical outputs. The two calls differ only in which source they pass, which reflects the two paths the code can take.
After the patch, req->src, which may contain spliced page cache pages, and req->dst, the user's buffer, are fully separated. Only the AAD gets copied from source to destination, and the sg_chain() logic that linked tag pages into the writable destination is removed entirely. Now, even if authencesn writes past assoclen + cryptlen, that position only ever contains user memory, never page cache.
The commit message states it plainly: there is no benefit to in-place operation in algif_aead, because source and destination come from entirely different memory mappings to begin with. In other words, the optimisation was saving nothing in the first place.
What to do if you cannot patch immediately
If an immediate kernel update is not possible, blocking the vulnerable module removes the attack surface entirely:
echo "install algif_aead /bin/false" > /etc/modprobe.d/disable-algif-aead.conf
rmmod algif_aead 2>/dev/null || true
Line by line:
echo "install algif_aead /bin/false"prints the text between the quotes. That text is a rule for the module loader: when something asks for thealgif_aeadmodule, run/bin/falseinstead./bin/falseis a tiny program that does nothing and always reports failure, so the module never loads. A module is a piece of kernel code that can be loaded and unloaded on demand.>redirects that printed text into a file at/etc/modprobe.d/disable-algif-aead.conf. Files in that directory are read by the module loader as configuration.rmmod algif_aeadasks the kernel to unload the module if it is currently loaded.2>/dev/nullthrows away any error message, and|| truemakes the whole line succeed even if the unload fails, for example because the module is in use. The point is to make the command safe to run regardless of the current state.
In containerised or multi-tenant environments, blocking socket(AF_ALG, ...) through a seccomp profile is a solid additional line of defence. Seccomp is a Linux feature that lets you restrict which system calls a program is allowed to make; a profile is the list of rules. Multi-tenant means several customers or teams share the same machine.
- Other AEAD templates that write to the destination beyond the output region. Audit each template's decrypt routine for writes at or past
assoclen + cryptlen. A positive result is a write that survives into the chained tag pages afterrecvmsg()returns an error. - Other in-place conversions of
req->src = req->dst. Look for interfaces where a reference to page cache can reach a crypto or copy path that treats the destination as scratch. A positive result is a page cache modification that leaves the on-disk file unchanged. - Other splice consumers. Any socket or pipe consumer that receives page cache references and then writes into the same buffer is a candidate. A positive result is a controlled change visible through
mmap()orexecve()but not through a checksum of the file on disk. - Container boundary checks. Run the primitive in one container against a file shared through the host page cache and observe it from another. A positive result is corruption visible outside the originating container.
- Integrity tooling coverage. Compare a checksum-based scanner's verdict with the actual behaviour of the corrupted file. A positive result is a scanner reporting the file as intact while execution uses the modified content.
Glossary
- AAD (Associated Data): extra information fed into an authenticated encryption operation that is checked for tampering but not encrypted.
- AEAD (Authenticated Encryption with Associated Data): a style of encryption that both hides the data and produces a tamper seal for it.
- AF_ALG: the Linux socket family that lets ordinary programs use the kernel's built-in cryptographic algorithms.
- API (Application Programming Interface): the agreed set of calls and rules through which one piece of software uses another.
- Auth tag: a short value produced by authenticated encryption that acts as a tamper seal; if the data changes, the tag no longer matches.
- authencesn: an IPsec-specific AEAD algorithm that handles extended sequence numbers and rearranges their bytes using the destination buffer as scratch space.
- bind(): the system call that attaches a socket to a particular algorithm or address.
- Checksum: a short fingerprint computed from a file's contents, used to detect changes.
- Ciphertext: data after encryption, unreadable without the key.
- Commit: a recorded change to source code, identified by a hash and accompanied by a message.
- Container: an isolated box on a shared machine used to keep applications apart.
- CVE: a public identifier assigned to a specific security vulnerability.
- Dirty page: a page of memory that has been changed but not yet written back to disk.
- ESN (Extended Sequence Number): a 64-bit counter used in IPsec, split into a high half (
seqno_hi) and a low half (seqno_lo). - execve(): the system call that starts running a program.
- GCM, CCM, authenc: other AEAD algorithms in the kernel, all of which stay inside their output region.
- HMAC: a keyed integrity check that proves data was not altered by someone without the key.
- In-place operation: working on data where it already sits, with source and destination sharing the same memory.
- Integrity tag: see auth tag.
- IPsec: the standard suite for encrypting network traffic between machines.
- Kernel: the core of the operating system that talks to hardware and enforces the rules.
- Local privilege escalation: an attack in which someone who already has a low-privilege foothold on a machine gains higher rights, such as root.
- memcpy_sglist(): the kernel routine that genuinely copies data between scatterlists.
- mmap(): the system call that maps a file into a program's memory.
- Module: a piece of kernel code that can be loaded and unloaded on demand.
- Multi-tenant: a machine or service shared by several customers or teams.
- Out-of-bounds write: a write that lands outside the memory region the code is supposed to touch.
- Page cache: the kernel's in-memory copy of file contents, kept so repeated reads are fast.
- Pipe: a one-way channel for passing data between programs or between a program and the kernel.
- Plaintext: data in readable form, before encryption or after decryption.
- Primitive: a small basic capability that can be repeated and combined into something larger.
- recvmsg(): the system call that receives data from a socket.
- Root: the administrator account on Linux, with unrestricted rights; its numeric identifier is UID 0.
- Scatterlist (SGL): the kernel's way of describing a chunk of memory that may be spread across several physical pages.
- Scratch space: memory used for temporary working notes, whose contents are not expected to be kept.
- Seccomp: a Linux feature that restricts which system calls a program may make.
- sendmsg(): the system call that sends data through a socket.
- setuid binary: a program marked to run with the rights of its owner rather than of the person launching it.
- sg_chain(): the kernel routine that links memory entries by reference instead of copying them.
- Socket: one end of a two-way channel for sending and receiving data.
- splice(): the system call that passes a reference to page cache data into a pipe or socket instead of copying it.
- System call (syscall): a request from a program asking the kernel to perform a privileged operation on its behalf.
.textsection: the part of a program file that holds its executable machine code.- UID 0: the numeric identifier of root.
- VFS: the kernel's general file-system layer, through which ordinary file writes pass.
- xfrm: the kernel's internal IPsec machinery.