udf: don't let the extent type hide an exhausted free-space table extent
NIST has received this entry but not started reviewing it.
In the Linux kernel, the following vulnerability has been resolved: udf: don't let the extent type hide an exhausted free-space table extent udf_table_new_block() takes the first block of the free-space table extent closest to the goal. It keeps that extent's type and length together in goal_elen, subtracts one block, and deletes the extent only if goal_elen then reaches zero. UDF 2.60 section 2.3.7.1 requires the free-space extents of an Unallocated Space Entry to be of type 1 (allocated but not recorded), and mkudffs writes them that way. For such an extent the type bits keep goal_elen non-zero, so taking its last block leaves a type-1 extent of length zero behind, starting at the block after the extent, which is in use. The next allocation that picks this empty extent returns that in-use block. Subtracting a block from 0x40000000 then borrows from the type bits, and the extent becomes type 0 with a length of 2^30 - blocksize: about a gigabyte of "free" space overlapping live metadata, the other table extents and whatever lies behind the partition. From then on blocks are handed out twice, or past the end of the partition. Extents that udf_table_free_blocks() adds are type 0, where the check works, so only tables written by mkudffs or by another implementation are affected. Nothing more than filling such a filesystem is needed: on a fresh 1 MiB "mkudffs --space=unalloctable" image, creating empty files until the partition is full writes file entries over the reserve volume descriptor sequence and the backup anchor, and df then reports a negative amount of used space. On syzbot's images the same double allocation is what the two reports below trip over. In the first, ftruncate() extends a new file with enough hole extents to need a chain of allocation extent descriptors; one AED is placed on another inode's file entry, and a later one is placed on the block of the AED currently being filled, which udf_setup_indirect_aext() zeroes, so __udf_add_aext() finds lengthAllocDescs out of step with its cursor. In the second, an AED is placed past the end of the device, sb_getblk() fails, and the error path of udf_do_extend_file() calls udf_truncate_extents() on an extent list that no longer covers i_size. Keep the type separately from the length, as udf_table_prealloc_blocks() already does.
New to this? Read how to keep your software updated.
The products and versions NIST lists as vulnerable, 2 products in all. If what you run is not listed it is probably not affected, but ask your provider if you are unsure.
| Product | Type | Vulnerable versions | Fixed in |
|---|---|---|---|
| Linux Linux | Software | from 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2, before 816a6df00e9637a438668da849ee00bf0cf7efe0; from 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2, before 762315609f9695d983c43a6031a487693b5cb780; from 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2, before 30aac8fc4f24b1b065b59a7b07e26030b22c4c69; from 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2, before ed79c0538e1e42c706409f4799c6145bf2d02365; from 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2, before a40b887f4b67cf969c23e19c28b650d6b5e8afeb; from 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2, before 78885b05188d3df733a9697d67bfcbb6d8330f76; and 2 more | 816a6df00e9637a438668da849ee00bf0cf7efe0; 762315609f9695d983c43a6031a487693b5cb780; 30aac8fc4f24b1b065b59a7b07e26030b22c4c69; ed79c0538e1e42c706409f4799c6145bf2d02365 |
| Linux Linux | Software | 2.6.12 | not recorded |
The 7.1 severity score (high) from the company that reported it, broken into what it means in practice. Red means it makes the flaw easier or worse.
| How it is reached | On the machine | The attacker needs access to the computer itself, for example a login or a file they can get you to open. |
| How hard it is | Low | Easy to carry out. No special conditions have to line up. |
| Login needed | None | The attacker does not need an account or password. |
| Someone has to act | Required | A person has to do something first, such as open a file or visit a page. |
| Reaches beyond the program | Unchanged | The damage stays inside the vulnerable program. |
| Data exposed | None | No data can be read. |
| Data changed | High | The attacker can change or delete anything the program can reach. |
| Service disrupted | High | The attacker can take the service down completely. |
| Ease of attack | 1.8 | A score for how easy it is to use the flaw. Higher is easier. |
| Damage | 5.2 | A score for how bad the harm is if it works. Higher is worse. |
NIST lists 8 sources for this flaw, none tagged as a vendor patch.