
पुनरुत्पादनीय CVE-2026-36834 प्रूफ-ऑफ-कॉन्सेप्ट जो LibRaw के Panasonic RW2 डिकोडर में सीमा से बाहर ऐरे रीड दर्शाता है, म्यूटेशन स्क्रिप्ट और सैनिटाइज़र-आधारित क्रैश पुनरुत्पादन के साथ।
src/decoders/pana8.cpp में एक आउट-ऑफ-बाउंड्स एरे रीड मौजूद है। जब कोई हफ़मैन तालिका मिलान नहीं मिलता है, तो फ़ंक्शन GetDBit() मान 17 लौटा सकता है, लेकिन huff_coeff[] केवल 17 तत्वों (मान्य सूचकांक 0-16) के साथ घोषित किया गया है। इसके परिणामस्वरूप huff_coeff[17] तक पहुँचा जाता है, जो UBSan और AddressSanitizer द्वारा पुष्टि की गई अपरिभाषित व्यवहार को ट्रिगर करता है।
उपयोगकर्ता-प्रदत्त RW2 फ़ाइलों को संसाधित करने वाले एप्लिकेशन, जैसे कि LibRaw का उपयोग करने वाले इमेज एडिटर या फोटो प्रबंधन उपकरण, एक दुर्भावनापूर्ण फ़ाइल खोलने से क्रैश हो सकते हैं या संभावित रूप से प्रक्रिया मेमोरी लीक कर सकते हैं।
CWE: CWE-125 (आउट-ऑफ-बाउंड्स रीड), CWE-129 (एरे इंडेक्स का अनुचित मान्यकरण) CVSS v3.1: AV:L/AC:L/PR:N/UI:R/S:U/C:L/I:N/A:H (~6.5 मध्यम)
Git commit: 777f20ae21c611a78021bd051fbbf1e71eae78f2
फ़ाइल: src/decoders/pana8.cpp फ़ंक्शन: pana8_param_t::DecodeC8()
मूल कारण GetDBit() में है:
uint32_t pana8_param_t::GetDBit(uint64_t a2)
{
for (int i = 0; i < 16; i++)
if ((a2 & hufftable2[i]) == hufftable1[i])
return i;
return uint32_t((hufftable2[16] & a2) == hufftable1[16]) ^ 0x11u;
// When comparison is false: returns 0 ^ 17 = 17
}
फिर रिटर्न वैल्यू को बिना बाउंड्स जांच के सीधे एरे इंडेक्स के रूप में उपयोग किया जाता है:
huff_index = int(GetDBit(pixbits)); // can be 17
int32_t v37 = (huff_coeff[huff_index] >> 24) // line 250: OOB
uint32_t hc = huff_coeff[huff_index]; // line 251: OOB
// ... and lines 254, 273
पुष्टि की गई कॉल श्रृंखला (UBSan आउटपुट) LibRaw::unpack() -> panasonicC8_load_raw() pana8.cpp:125 -> pana8_decode_loop() pana8.cpp:132 -> pana8_decode_strip() pana8.cpp:155 -> DecodeC8() pana8.cpp:250 <-- OOB triggered
UBSan errors triggered: pana8.cpp:250 index 17 out of bounds for type 'unsigned int [17]' pana8.cpp:251 index 17 out of bounds for type 'unsigned int [17]' pana8.cpp:254 index 17 out of bounds for type 'unsigned int [17]' pana8.cpp:254 shift exponent -17 is negative pana8.cpp:273 index 17 out of bounds for type 'unsigned int [17]' pana8.cpp:303 left shift of negative value -1
LibRaw को सैनिटाइज़र्स के साथ बनाएं:
./configure CXXFLAGS="-fsanitize=address,undefined -g -O1" \
LDFLAGS="-fsanitize=address,undefined"
make -j$(nproc)
किसी भी Panasonic RW2 फ़ाइल के विरुद्ध उत्परिवर्तक स्क्रिप्ट चलाएं:
python3 mutate_rw2.py input.rw2 mutated_pana8.rw2
ASAN_OPTIONS=halt_on_error=0:print_stats=1 ./bin/dcraw_emu -v mutated_pana8.rw2
https://github.com/LibRaw/LibRaw/commit/02da167e0f819a37dbb7d714e87c5b40df6c5917