CVE-2021-44142: Details on a Samba Code Execution Bug Demonstrated at Pwn2Own Austin
Samba's fruit module fails to validate AppleDouble metadata entries, leading to out-of-bounds heap read and write. An unauthenticated remote attacker could exploit this to execute code as root.
Published on zerodayinitiative.com
Recently, Samba released a patch to address an Out-of-Bounds (OOB) Heap Read/Write vulnerability found in Samba versions prior to 4.13.17. This vulnerability was disclosed at Pwn2Own Austin 2021 by Nguy� n Hoàng Thạch (@hiimd4rkn3ss) and Billy Jheng Bing-Jhong (@st424204) of STAR Labs.
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
This write-up covers CVE-2021-44142, an out-of-bounds (OOB) heap read/write vulnerability in Samba versions prior to 4.13.17. The bug was demonstrated at Pwn2Own Austin 2021 by Nguy�
n Hoàng Thạch (@hi_im_d4rkn3ss) and Billy Jheng Bing-Jhong (@st424204) of STAR Labs. After the event, Lucas Leong of Trend Micro Zero Day Initiative discovered additional variants of the vulnerability, which were disclosed to Samba as part of the same fix. The bug was also independently reported to Samba by Orange Tsai of DEVCORE.
The affected component is `smbd`, the Samba server daemon that provides the file sharing service. The specific flaw exists within the parsing of EA (extended attribute) metadata when opening a file. According to the report, the vulnerability allows remote attackers to execute arbitrary code on affected installations of Samba, and authentication is not required to exploit it. An attacker can leverage the vulnerability to execute code in the context of root.
The bugs reside in the `fruit` VFS module, which provides enhanced compatibility with Apple SMB clients. The module is designed to provide interoperability between Samba and Netatalk, an open-source implementation of the Apple Filing Protocol (AFP) that allows Unix-like systems to serve as file servers for Apple devices.
## Setup
The analysis was conducted on `smbd` version 4.9.5. The report notes that while this is not the latest version of Samba, there are still quite a few vendors that incorporate this version or prior versions in their products, and this was the case during Pwn2Own Austin 2021. Because Samba provides file sharing between devices, it is often enabled by default. The configuration of `smbd` is found in `/etc/samba/smb.conf`.
The report shows a portion of an `smb.conf` file illustrating how Samba would be configured to support a Time Machine share for Apple devices. In that section, `guest ok = yes` is declared, which allows guest authentication. The `vfs objects` list contains three modules: `catia`, `fruit`, and `streams_xattr`.
As stated by the vendor advisory, the problem in `vfs_fruit` exists in the default configuration of the fruit VFS module using `fruit:metadata=netatalk` or `fruit:resource=file`. If both options are set to different settings than the default values, the system is not affected by the security issue.
## Finding it
The `fruit` module handles requests that access a file with the stream name `:AFP_AfpInfo` or `:AFP_Resource`. If using the stream name `:AFP_AfpInfo`, an attacker can open, read, and write Netatalk metadata of a file. Netatalk metadata is stored in an `adouble` structure, which is initialised by the `ad_get`/`ad_fget` functions.
The Netatalk metadata of a file is stored in the value of the extended attribute identified by the name `org.netatalk.Metadata`. The metadata will be parsed to fill the `adouble` (AppleDouble) structure. Since `org.netatalk.Metadata` is not in the private Samba attribute name list, an attacker can set an arbitrary value for this attribute. It is therefore possible for an attacker to inject malformed metadata values, which can lead to multiple out-of-bounds memory accesses when the `adouble` structure is later used.
Once a session is established, `smbd` allows an unauthenticated user to set extended file attributes of a file via `SMB2_SET_INFO`. This is done by the `set_ea` function found in `source3/smbd/trans2.c`. The name of the attribute must not be within the private Samba attribute name list, which includes `user.SAMBA_PAI`, `user.DOSATTRIB`, `user.SAMBA_STREAMS`, and `security.NACL`. With the exception of these attributes, an attacker can set arbitrary extended attributes.
The report describes three distinct bugs: ZDI-22-245 (heap OOB read), ZDI-22-246 (heap OOB write), and ZDI-22-244 (heap-based buffer overflow). The first two were the bugs used during Pwn2Own; the third is the variant found by Lucas Leong during analysis of those bugs.
## Exploitation
### Step 1: Set a malformed extended attribute
Because `org.netatalk.Metadata` is not in the private attribute name list, an unauthenticated user can set an arbitrary value for it via `SMB2_SET_INFO` (through the `set_ea` function in `source3/smbd/trans2.c`). This is the entry point for the attack: the attacker injects malformed metadata that will later be parsed into the `adouble` structure.
### Step 2: Trigger the heap OOB read (ZDI-22-245)
The `fruit_pread` function reads metadata of a file. Since the file stream is named `:AFP_AfpInfo` and the file type is `ADOUBLE_META`, the function chain `fruit_pread_meta` -> `fruit_pread_meta_adouble` will be executed.
At line 4279, the `ad_fget` function creates an `adouble` structure containing attacker-controlled data. At line 4285, the call to `ad_get_entry` returns the pointer to the `ADEID_FINDERI` entry. Since this is controllable by the attacker, they can make `p` point to the last byte of the `ad->data` buffer. This causes the `memcpy` call at line 4300 to read past the end of the allocated buffer and dump up to thirty-one bytes of memory from the heap.
### Step 3: Trigger the heap OOB write (ZDI-22-246)
The `fruit_pwrite` function is used to write metadata to a file. Since the attacker can already control an `ADEID_FINDERI` entry, they can leverage that to control a `memcpy` call, which allows writing up to thirty-one bytes of data to the heap.
At line 4657, the `ad_fget` function creates the `ad` `adouble` structure from metadata. As mentioned before, an attacker could inject malformed metadata here and control the values within. Later at line 4664, the `ad_get_entry` returns the pointer to the `ADEID_FINDERI` entry. Since this is controllable by the attacker, they can set `p` to point to the last byte of the `ad->data` buffer. This allows the `memcpy` call at line 4671 to write past the end of the `ad->ad_data` buffer. Since `ad->ad_data` is allocated from heap memory, the attacker can leverage this vulnerability to write up to 31 bytes of data past the end of the heap buffer.
### Step 4: The variant (ZDI-22-244)
When analysing the bugs used during Pwn2Own, ZDI Vulnerability Researcher Lucas Leong noticed a variant of the vulnerability used at the contest. In the case of the bugs used during Pwn2Own, Samba fails to validate the `ADEID_FINDERI` function, which leads to an OOB read and OOB write. Further analysis from Lucas found that Samba does not validate the `ADEID_FILEDATESI` entry either. This leads to an OOB read in `ad_getdate` and an OOB write in `ad_setdate`. This leads to an overflow of three bytes. An attacker can possibly leverage this vulnerability to execute code in the context of the `smbd` daemon.
## Root cause
The root cause is that the `fruit` module parses attacker-controlled Netatalk metadata from the `org.netatalk.Metadata` extended attribute into an `adouble` structure without validating the size of the entries it contains. Because `org.netatalk.Metadata` is not on the private Samba attribute name list, an unauthenticated user can set it to an arbitrary value via `SMB2_SET_INFO`. The `ad_get_entry` function then returns a pointer to an `ADEID_FINDERI` entry whose position the attacker controls, so the subsequent `memcpy` in `fruit_pread` (line 4300) and `fruit_pwrite` (line 4671) reads or writes past the end of the heap buffer. The same lack of validation applies to the `ADEID_FILEDATESI` entry, leading to the OOB read in `ad_getdate` and the OOB write in `ad_setdate`.
The existing defence that should have stopped this is the private attribute name list, which blocks setting attributes such as `user.SAMBA_PAI`, `user.DOSATTRIB`, `user.SAMBA_STREAMS`, and `security.NACL`. The Netatalk metadata attribute was simply not included in that list, so the attacker could set it.
## Impact
According to the report, the vulnerability allows remote attackers to execute arbitrary code on affected installations of Samba, and authentication is not required. The variant found by Lucas Leong could possibly be leveraged to execute code in the context of the `smbd` daemon.
The bugs affect Samba versions prior to 4.13.17, and the report notes that many vendors ship this version or prior versions in their products. The default configuration of the fruit VFS module using `fruit:metadata=netatalk` or `fruit:resource=file` is affected; if both options are set to different settings than the default values, the system is not affected by the security issue.
## Fix
The source code of the patch for CVE-2021-44142 can be found at the Samba attachment referenced in the report. The primary change from the vendor was an update to two areas to mitigate this vulnerability.
1. Samba added the function `ad_entry_check_size()`, which validates the size of each entry when parsing the AppleDouble format.
2. Samba added the Netatalk extended attribute `AFPINFO_EA_NETATALK` to the list of the private attribute name list. Since an attacker needs to set the malformed extended attribute on a file at the beginning stage of this exploit, this change effectively blocks any user attempting to set any Netatalk extended attribute. The report describes this as a generic mitigation for this attack vector.
Samba patched this and other bugs on January 31, 2022. In addition to 4.13.17, Samba 4.14.12 and 4.15.5 were released to address this vulnerability. The vendor lists removing the fruit VFS module from the list of configured VFS in `smb.conf` as a workaround, but the report notes this will severely impact the functionality of any macOS systems attempting to access the Samba server. Because of this, the report recommends focusing on testing and deploying the patch to remediate the vulnerability, and reaching out to any third-party vendors with devices on your enterprise to ensure they have consumed the patch and provided updates to their devices as well. The report expects that many different vendors will need to update the version of Samba they ship with their devices.
## Variants to test
1. **Other AppleDouble entry types.** The report states that Samba fails to validate both the `ADEID_FINDERI` and `ADEID_FILEDATESI` entries. Try injecting metadata with other entry identifiers and observe whether `ad_get_entry` returns a pointer that can be positioned at the end of the `ad->data` buffer. A positive result is an OOB read or write in the corresponding `ad_getdate`/`ad_setdate`-style handler.
2. **Other Netatalk extended attributes.** The fix added `AFPINFO_EA_NETATALK` to the private attribute name list. Check whether other Netatalk-related attributes that are still settable can reach the same parsing code. A positive result is a settable attribute whose value is parsed into an `adouble` structure.
3. **Other VFS modules that parse extended attributes.** The `fruit` module is one consumer of `org.netatalk.Metadata`. Look for other modules that read extended attributes and parse them into fixed-size structures without size checks. A positive result is a crash or memory corruption when a malformed attribute is set and the file is opened.
4. **Non-default fruit settings.** The report states that if both `fruit:metadata` and `fruit:resource` are set to different settings than the default values, the system is not affected. Test configurations that mix one default and one non-default setting to confirm which combinations remain vulnerable.
{{media:1}}
## What happened, in plain words
Imagine a shared office filing cabinet. Anyone in the building can walk up to it, drop a folder in, and take one out. That is roughly what a file server does: it lets many computers store and fetch files over a network. Samba is one of the most common pieces of software that turns a Linux or Unix machine into such a file server, so that Windows, macOS and other machines can share files with it.
In late 2021, two security researchers, Nguy�
n Hoàng Thạch (@hi_im_d4rkn3ss) and Billy Jheng Bing-Jhong (@st424204) of STAR Labs, found a serious flaw in Samba. They demonstrated it at a hacking contest called Pwn2Own Austin 2021, where companies put up their products and researchers try to break them. The flaw was given the identifier CVE-2021-44142. A CVE is simply a public catalogue number for a known security bug, so people can talk about the same bug without confusion.
The bug lets someone who can reach the file server, without logging in at all, send a specially crafted request that makes the server read or write memory it should not touch. Memory mistakes like this can, in the worst case, let the attacker run their own commands on the server with the highest level of permission (the `root` account, which on Linux can do anything).
After the contest, Lucas Leong of Trend Micro's Zero Day Initiative (ZDI) looked more closely and found a related variant of the same bug. The bug was also independently reported to Samba by Orange Tsai of DEVCORE. Samba fixed it on 31 January 2022 and released new versions.
This article walks through the original technical write-up step by step, explaining every term from scratch. It follows the same order as the technical version: context, setup, how the bug was found, how it is exploited, the root cause, the impact, the fix, and ideas for further testing.
## Context
### What Samba and `smbd` are
Samba is software that lets a Unix-like computer act like a Windows file server. The part of Samba that actually serves files is a program called `smbd`, short for Samba daemon. A daemon is just a program that runs quietly in the background, waiting for requests, like a receptionist sitting at a desk all day.
The bug lives in `smbd`, specifically in the code that reads extra information attached to files when a file is opened. The report calls this EA metadata. EA stands for extended attribute: a small labelled note attached to a file, separate from its contents. Think of a sticky note on a folder saying "this belongs to the design team". The operating system stores these notes alongside the file.
### What the vulnerability class means
The bug is an out-of-bounds (OOB) heap read/write. To unpack that:
- **Heap** is the area of a computer's memory where a program keeps things it creates while running, such as buffers holding data it is working on. Picture a long shelf with numbered slots; the program asks for a slot, gets it, and is supposed to use only that slot.
- **Out-of-bounds** means the program reaches past the end of the slot it was given, into the neighbouring slot. Reading past the end leaks whatever is in the next slot. Writing past the end overwrites whatever is there, which can corrupt the program's own data or instructions.
- **Read** means copying data out of memory. **Write** means putting data into memory.
A useful everyday comparison: you rent a storage locker that is one metre wide, but the lock on the door is broken so you can reach into the locker next door. Reading is peeking at your neighbour's boxes; writing is swapping their boxes for yours.
### What the report says about impact
According to the report, the vulnerability allows remote attackers to execute arbitrary code on affected installations of Samba. "Remote" means over the network, not sitting at the machine. "Execute arbitrary code" means run any command the attacker chooses. The report states that authentication is not required to exploit it, so no username or password is needed. The attacker can leverage the vulnerability to execute code in the context of `root`, the all-powerful account.
### The `fruit` module and Netatalk
The bugs reside in the `fruit` VFS module. A VFS module (virtual file system module) is a plug-in that changes how Samba handles files, a bit like an add-on in a browser that changes how pages are displayed. The `fruit` module exists to provide enhanced compatibility with Apple SMB clients, meaning Macs.
The module is designed to provide interoperability between Samba and Netatalk. Netatalk is an open-source implementation of the Apple Filing Protocol (AFP), the older way Apple devices talked to file servers. In other words, Netatalk lets a Unix-like machine serve files to Apple devices, and the `fruit` module lets Samba understand the extra bookkeeping information Netatalk uses, so Macs feel at home.
## Setup
### The version studied
The analysis was conducted on `smbd` version 4.9.5. The report notes that while this is not the latest version of Samba, there are still quite a few vendors that incorporate this version or prior versions in their products, and this was the case during Pwn2Own Austin 2021. A vendor here means a company that ships Samba inside its own product, such as a network storage box. Because Samba provides file sharing between devices, it is often enabled by default, so many devices have it running without anyone thinking about it.
### The configuration file
The configuration of `smbd` is found in `/etc/samba/smb.conf`. A configuration file is a plain text file of settings, like the preferences screen of an app but written out as text. The report shows a portion of an `smb.conf` file illustrating how Samba would be configured to support a Time Machine share for Apple devices. Time Machine is Apple's backup feature; a Time Machine share is a network folder where Macs store their backups.
The report describes that section as follows: `guest ok = yes` is declared, which allows guest authentication. In plain terms, guests (people without an account) are allowed in. The `vfs objects` list contains three modules: `catia`, `fruit`, and `streams_xattr`. This is the list of plug-ins Samba loads for that share, and `fruit` is one of them.
### When the system is affected
As stated by the vendor advisory, the problem in `vfs_fruit` exists in the default configuration of the fruit VFS module using `fruit:metadata=netatalk` or `fruit:resource=file`. If both options are set to different settings than the default values, the system is not affected by the security issue. In other words, the bug is present in the out-of-the-box setup, and only a deliberate change to both settings avoids it.
## Finding it
### Streams and the `adouble` structure
The `fruit` module handles requests that access a file with the stream name `:AFP_AfpInfo` or `:AFP_Resource`. A stream here is a named side-channel of a file, like a second pocket in a folder for related paperwork. If using the stream name `:AFP_AfpInfo`, an attacker can open, read, and write Netatalk metadata of a file.
Netatalk metadata is stored in an `adouble` structure. A structure is a fixed layout of fields in memory, like a paper form with boxes to fill in. The `adouble` structure is initialised by the `ad_get`/`ad_fget` functions. "Initialised" means filled in with starting values; these functions read the stored metadata and lay it out in the form.
### Where the metadata lives
The Netatalk metadata of a file is stored in the value of the extended attribute identified by the name `org.netatalk.Metadata`. So the sticky note called `org.netatalk.Metadata` holds the data that will be parsed to fill the `adouble` (AppleDouble) structure. "Parsed" means read according to a format and turned into usable fields, the way a postal worker reads an address line by line.
### The missing guard
Since `org.netatalk.Metadata` is not in the private Samba attribute name list, an attacker can set an arbitrary value for this attribute. The private list is a blocklist of attribute names that ordinary users are not allowed to touch. It is therefore possible for an attacker to inject malformed metadata values, which can lead to multiple out-of-bounds memory accesses when the `adouble` structure is later used. "Malformed" means the data does not follow the expected format, for example claiming a field is longer than it really is.
### How attributes are set
Once a session is established, `smbd` allows an unauthenticated user to set extended file attributes of a file via `SMB2_SET_INFO`. SMB2 is the protocol Samba speaks, the shared language between client and server; `SET_INFO` is the request that sets information such as attributes. This is done by the `set_ea` function found in `source3/smbd/trans2.c`, which is simply the file in the Samba source code where that function lives.
The name of the attribute must not be within the private Samba attribute name list, which includes `user.SAMBA_PAI`, `user.DOSATTRIB`, `user.SAMBA_STREAMS`, and `security.NACL`. With the exception of these attributes, an attacker can set arbitrary extended attributes. So the blocklist is the only gate, and the Netatalk attribute is not on it.
### The three bugs
The report describes three distinct bugs: ZDI-22-245 (heap OOB read), ZDI-22-246 (heap OOB write), and ZDI-22-244 (heap-based buffer overflow). The first two were the bugs used during Pwn2Own; the third is the variant found by Lucas Leong during analysis of those bugs. The ZDI numbers are advisory identifiers, like ticket numbers for each individual bug.
## Exploitation
### Step 1: Set a malformed extended attribute
Because `org.netatalk.Metadata` is not in the private attribute name list, an unauthenticated user can set an arbitrary value for it via `SMB2_SET_INFO` (through the `set_ea` function in `source3/smbd/trans2.c`). This is the entry point for the attack: the attacker injects malformed metadata that will later be parsed into the `adouble` structure.
Why this step matters: the attacker needs to plant the bad data first. The server will only trip over it later, when it reads the attribute back and tries to interpret it. Planting it is like leaving a booby-trapped parcel in the mailroom; the harm happens when someone opens it.
### Step 2: Trigger the heap OOB read (ZDI-22-245)
The `fruit_pread` function reads metadata of a file. Since the file stream is named `:AFP_AfpInfo` and the file type is `ADOUBLE_META`, the function chain `fruit_pread_meta` -> `fruit_pread_meta_adouble` will be executed. A function chain just means one function calls the next, like a series of assistants passing a request along.
At line 4279, the `ad_fget` function creates an `adouble` structure containing attacker-controlled data. At line 4285, the call to `ad_get_entry` returns the pointer to the `ADEID_FINDERI` entry. A pointer is a memory address, like a house number telling the program where to look. Since this is controllable by the attacker, they can make `p` point to the last byte of the `ad->data` buffer. This causes the `memcpy` call at line 4300 to read past the end of the allocated buffer and dump up to thirty-one bytes of memory from the heap.
`memcpy` is a standard function that copies a block of bytes from one place to another. If the starting point is at the very last byte of the buffer but the copy length is longer than one, it keeps going into the next memory slot. That is the out-of-bounds read: up to thirty-one bytes of neighbouring memory are copied out.
### Step 3: Trigger the heap OOB write (ZDI-22-246)
The `fruit_pwrite` function is used to write metadata to a file. Since the attacker can already control an `ADEID_FINDERI` entry, they can leverage that to control a `memcpy` call, which allows writing up to thirty-one bytes of data to the heap.
At line 4657, the `ad_fget` function creates the `ad` `adouble` structure from metadata. As mentioned before, an attacker could inject malformed metadata here and control the values within. Later at line 4664, the `ad_get_entry` returns the pointer to the `ADEID_FINDERI` entry. Since this is controllable by the attacker, they can set `p` to point to the last byte of the `ad->data` buffer. This allows the `memcpy` call at line 4671 to write past the end of the `ad->ad_data` buffer. Since `ad->ad_data` is allocated from heap memory, the attacker can leverage this vulnerability to write up to 31 bytes of data past the end of the heap buffer.
The difference from Step 2 is direction: reading copies data out of the buffer, writing puts attacker-chosen data into the neighbouring memory. Writing is generally the more dangerous of the two, because it lets the attacker change values the program relies on.
### Step 4: The variant (ZDI-22-244)
When analysing the bugs used during Pwn2Own, ZDI Vulnerability Researcher Lucas Leong noticed a variant of the vulnerability used at the contest. In the case of the bugs used during Pwn2Own, Samba fails to validate the `ADEID_FINDERI` function, which leads to an OOB read and OOB write. "Validate" means check that the data makes sense before using it, for example checking that a claimed length fits inside the buffer.
Further analysis from Lucas found that Samba does not validate the `ADEID_FILEDATESI` entry either. This leads to an OOB read in `ad_getdate` and an OOB write in `ad_setdate`. This leads to an overflow of three bytes. An attacker can possibly leverage this vulnerability to execute code in the context of the `smbd` daemon. Three bytes is a very small overrun, but even a small overwrite can matter if it lands on something important.
## Root cause
The root cause is that the `fruit` module parses attacker-controlled Netatalk metadata from the `org.netatalk.Metadata` extended attribute into an `adouble` structure without validating the size of the entries it contains. Because `org.netatalk.Metadata` is not on the private Samba attribute name list, an unauthenticated user can set it to an arbitrary value via `SMB2_SET_INFO`. The `ad_get_entry` function then returns a pointer to an `ADEID_FINDERI` entry whose position the attacker controls, so the subsequent `memcpy` in `fruit_pread` (line 4300) and `fruit_pwrite` (line 4671) reads or writes past the end of the heap buffer. The same lack of validation applies to the `ADEID_FILEDATESI` entry, leading to the OOB read in `ad_getdate` and the OOB write in `ad_setdate`.
The existing defence that should have stopped this is the private attribute name list, which blocks setting attributes such as `user.SAMBA_PAI`, `user.DOSATTRIB`, `user.SAMBA_STREAMS`, and `security.NACL`. The Netatalk metadata attribute was simply not included in that list, so the attacker could set it.
A simple comparison: a nightclub has a banned list at the door. The list is a good idea, but if the troublemaker's name is not on it, they walk straight in. The fix is to add the name, and also to check bags inside.
## Impact
According to the report, the vulnerability allows remote attackers to execute arbitrary code on affected installations of Samba, and authentication is not required. An attacker can leverage the vulnerability to execute code in the context of root. The variant found by Lucas Leong could possibly be leveraged to execute code in the context of the `smbd` daemon.
The bugs affect Samba versions prior to 4.13.17, and the report notes that many vendors ship this version or prior versions in their products. The default configuration of the fruit VFS module using `fruit:metadata=netatalk` or `fruit:resource=file` is affected; if both options are set to different settings than the default values, the system is not affected by the security issue.
## Fix
The source code of the patch for CVE-2021-44142 can be found at the Samba attachment referenced in the report. A patch is a small change to source code that closes a hole, like a repair kit for one specific part. The primary change from the vendor was an update to two areas to mitigate this vulnerability.
1. Samba added the function `ad_entry_check_size()`, which validates the size of each entry when parsing the AppleDouble format. In plain terms, before using a field, the code now checks that the field actually fits where it claims to be. This is the bag check at the door.
2. Samba added the Netatalk extended attribute `AFPINFO_EA_NETATALK` to the list of the private attribute name list. Since an attacker needs to set the malformed extended attribute on a file at the beginning stage of this exploit, this change effectively blocks any user attempting to set any Netatalk extended attribute. The report describes this as a generic mitigation for this attack vector. This is the banned list being updated.
Samba patched this and other bugs on January 31, 2022. In addition to 4.13.17, Samba 4.14.12 and 4.15.5 were released to address this vulnerability. The vendor lists removing the fruit VFS module from the list of configured VFS in `smb.conf` as a workaround, but the report notes this will severely impact the functionality of any macOS systems attempting to access the Samba server. A workaround is a temporary way to avoid the bug without installing the real fix, like closing a room off instead of repairing the lock. Because of this, the report recommends focusing on testing and deploying the patch to remediate the vulnerability, and reaching out to any third-party vendors with devices on your enterprise to ensure they have consumed the patch and provided updates to their devices as well. The report expects that many different vendors will need to update the version of Samba they ship with their devices.
## Variants to test
1. **Other AppleDouble entry types.** The report states that Samba fails to validate both the `ADEID_FINDERI` and `ADEID_FILEDATESI` entries. Try injecting metadata with other entry identifiers and observe whether `ad_get_entry` returns a pointer that can be positioned at the end of the `ad->data` buffer. A positive result is an OOB read or write in the corresponding `ad_getdate`/`ad_setdate`-style handler. In plain terms: if two kinds of field were unchecked, maybe others are too.
2. **Other Netatalk extended attributes.** The fix added `AFPINFO_EA_NETATALK` to the private attribute name list. Check whether other Netatalk-related attributes that are still settable can reach the same parsing code. A positive result is a settable attribute whose value is parsed into an `adouble` structure. In plain terms: the banned list may still be missing names.
3. **Other VFS modules that parse extended attributes.** The `fruit` module is one consumer of `org.netatalk.Metadata`. Look for other modules that read extended attributes and parse them into fixed-size structures without size checks. A positive result is a crash or memory corruption when a malformed attribute is set and the file is opened. In plain terms: other plug-ins may make the same mistake.
4. **Non-default fruit settings.** The report states that if both `fruit:metadata` and `fruit:resource` are set to different settings than the default values, the system is not affected. Test configurations that mix one default and one non-default setting to confirm which combinations remain vulnerable. In plain terms: the report says both settings must change to escape the bug, so check the in-between cases.
{{media:1}}
The image is the page's hero background; the report does not describe it further. The report does not describe anything further about it.
## Glossary
- **Adouble (AppleDouble)**: A data structure used by Netatalk to store extra metadata about a file, laid out as a form with fixed fields.
- **AFP (Apple Filing Protocol)**: An older Apple protocol for file sharing over a network.
- **Authentication**: Proving who you are, usually with a username and password. "Unauthenticated" means no proof is required.
- **Buffer**: A reserved block of memory used to hold data temporarily.
- **CVE**: A public catalogue number for a known security vulnerability, so people can refer to the same bug unambiguously.
- **Daemon**: A program that runs in the background waiting for requests, such as `smbd`.
- **EA (extended attribute)**: A small labelled note attached to a file, stored separately from the file's contents.
- **Exploit**: A technique or piece of code that turns a vulnerability into an actual effect, such as running commands.
- **Fruit (VFS module)**: A Samba plug-in that adds compatibility with Apple clients and Netatalk metadata.
- **Function**: A named block of code that performs a task and can be called by other code.
- **Heap**: The area of memory where a running program keeps data it creates dynamically.
- **Initialise**: To fill a structure or variable with its starting values.
- **Malformed**: Data that does not follow the expected format.
- **memcpy**: A standard function that copies a block of bytes from one memory location to another.
- **Metadata**: Data about data, such as notes describing a file rather than the file's contents.
- **Mitigation**: A change that reduces or removes the risk from a vulnerability.
- **Netatalk**: An open-source implementation of AFP that lets Unix-like systems serve files to Apple devices.
- **OOB (out-of-bounds)**: Accessing memory outside the region a program was given, either reading or writing past its end.
- **Parse**: To read data according to a format and turn it into usable fields.
- **Patch**: A code change that fixes a bug.
- **Pointer**: A memory address that tells a program where to look.
- **Private attribute name list**: A blocklist of extended attribute names that ordinary users are not allowed to set in Samba.
- **Protocol**: An agreed language for computers to exchange messages, such as SMB2.
- **Pwn2Own**: A hacking contest where researchers demonstrate exploits against real products.
- **Root**: The all-powerful administrator account on Unix-like systems.
- **Samba**: Software that lets Unix-like computers share files with Windows, macOS and other systems.
- **smbd**: The Samba server daemon that provides the file sharing service.
- **SMB2**: The protocol Samba uses to talk to clients; `SMB2_SET_INFO` is the request that sets file information such as attributes.
- **Stream**: A named side-channel of a file, such as `:AFP_AfpInfo`, holding related data separately from the main contents.
- **Structure**: A fixed layout of fields in memory, like a form with boxes.
- **Time Machine**: Apple's backup feature; a Time Machine share is a network folder where Macs store backups.
- **Validate**: To check that data makes sense and is safe before using it.
- **Vendor**: A company that makes or ships a product, including products that contain Samba.
- **VFS (virtual file system) module**: A Samba plug-in that changes how files are handled.
- **Vulnerability**: A weakness in software that can be abused to cause harm.
- **Workaround**: A temporary way to avoid a vulnerability without applying the real fix.
- **ZDI**: Trend Micro's Zero Day Initiative, which buys and discloses vulnerability research and assigns advisory numbers such as ZDI-22-245.