hw/adc: Fix out-of-bounds write in Aspeed ADC model
PATCH 1/1 hw/adc: Fix out-of-bounds write in Aspeed ADC model
The 'regs' array has ASPEED_ADC_NR_REGS (52) elements, while the memory region covers offsets 0x00-0xFC. The aspeed_adc_engine_write() function has an out-of-bounds write vulnerability when accessing unimplemented registers.
Fix this by using 'return' instead of 'break' in the default case, which prevents execution from reaching the s->regs[reg] assignment for unimplemented registers.
--- hw/adc/aspeed_adc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
hw/adc/aspeed_adc.c +2 -1
@@ -228,7 +228,8 @@ static void aspeed_adc_engine_write(void *opaque, hwaddr addr, uint64_t value,qemu_log_mask (LOG_UNIMP ,"%s: engine[%u]: " "0x%" HWADDR_PRIx" 0x%" PRIx64"\n" , __func__, s->engine_id, addr, value); -break ; +/* Do not update the regs[] array */ +return ; } s->regs[reg] = value;
Signature · 1 line
2.52.0
Quoted 6 lines · Cédric Le Goater
The 'regs' array has
ASPEED_ADC_NR_REGS(52) elements, while the memory region covers offsets 0x00-0xFC. Theaspeed_adc_engine_write()function has an out-of-bounds write vulnerability when accessing unimplemented registers.
Quoted 7 lines
Fix this by using 'return' instead of 'break' in the default case, which prevents execution from reaching the s->regs[reg] assignment for unimplemented registers.
Reported-by Elhrj Saad <[email protected]>Fixes 5857974d5d11 ("hw/adc: Add basic Aspeed ADC model")Signed-off-by Cédric Le Goater <[email protected]>
Seems like a good candidate for Cc: [email protected] ?
thanks
-- PMM
Quoted 11 lines · Peter Maydell
Quoted 10 lines · Cédric Le Goater
The 'regs' array has
ASPEED_ADC_NR_REGS(52) elements, while the memory region covers offsets 0x00-0xFC. Theaspeed_adc_engine_write()function has an out-of-bounds write vulnerability when accessing unimplemented registers.Fix this by using 'return' instead of 'break' in the default case, which prevents execution from reaching the s->regs[reg] assignment for unimplemented registers.
Quoted 5 lines
Quoted 3 lines
Reported-by Elhrj Saad <[email protected]>Fixes 5857974d5d11 ("hw/adc: Add basic Aspeed ADC model")Signed-off-by Cédric Le Goater <[email protected]>Seems like a good candidate for Cc: [email protected] ?
Yes.
Thanks,
C.
Hello, gentlemen,
Is there any possibility of making an exception and assigning a CVE for the issue ?? (It's my first ever found vulnerability :)
Thank you in advance.
Quoted 26 lines · Cédric Le Goater
Quoted 11 lines · Peter Maydell
Quoted 10 lines · Cédric Le Goater
The 'regs' array has
ASPEED_ADC_NR_REGS(52) elements, while the memory region covers offsets 0x00-0xFC. Theaspeed_adc_engine_write()function has an out-of-bounds write vulnerability when accessing unimplemented registers.Fix this by using 'return' instead of 'break' in the default case, which prevents execution from reaching the s->regs[reg] assignment for unimplemented registers.
Quoted 5 lines
Quoted 3 lines
Reported-by Elhrj Saad <[email protected]>Fixes 5857974d5d11 ("hw/adc: Add basic Aspeed ADC model")Signed-off-by Cédric Le Goater <[email protected]>Seems like a good candidate for Cc: [email protected] ?
Yes.
Thanks,
C.
Signature · 5 lines
*Saad ELHARAJ* Cybersecurity Specialist 📞 +212 6 80 51 11 85 ✉️ [email protected] 🔗 LinkedIn <https://www.linkedin.com/in/saad-elharaj-1891371a0/>
Quoted 2 lines · Elhrj Saad
Is there any possibility of making an exception and assigning a CVE for the issue ?? (It's my first ever found vulnerability :)
Hi; this is not a security vulnerability according to QEMU's security policy, which you can find here:
https://www.qemu.org/docs/master/system/security.html
The board that uses this device is not one usable under the "virtualization" use case, and so we do not consider that bugs in it are security issues. So it's not a "vulnerability", just a normal bug, and we would not issue a CVE for it.
thanks
-- PMM
Quoted 4 lines · Elhrj Saad
Hello, gentlemen,
Is there any possibility of making an exception and assigning a CVE for the issue ?? (It's my first ever found vulnerability :)
Thank you for your contribution to improving the quality of QEMU. In many projects this would indeed qualify for assignment of a CVE, but as Peter mentions, this falls outside the scope of QEMU's security policy.
Assigning CVEs has quite a ripple effect on those consuming QEMU, due to it triggering many security response processes. As such we do not wish to issue CVEs for things that the project considers to merely be hardening bug fixes in an area of code that is not designed to be providing a security boundary.
With regards,
Daniel
Signature · 3 lines
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
Quoted 9 lines · Cédric Le Goater
The 'regs' array has
ASPEED_ADC_NR_REGS(52) elements, while the memory region covers offsets 0x00-0xFC. Theaspeed_adc_engine_write()function has an out-of-bounds write vulnerability when accessing unimplemented registers.Fix this by using 'return' instead of 'break' in the default case, which prevents execution from reaching the s->regs[reg] assignment for unimplemented registers.
Quoted 6 lines
Reported-by Elhrj Saad <[email protected]>Fixes 5857974d5d11 ("hw/adc: Add basic Aspeed ADC model")Signed-off-by Cédric Le Goater <[email protected]>--- hw/adc/aspeed_adc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
Quoted 9 lines · Cédric Le Goater
The 'regs' array has
ASPEED_ADC_NR_REGS(52) elements, while the memory region covers offsets 0x00-0xFC. Theaspeed_adc_engine_write()function has an out-of-bounds write vulnerability when accessing unimplemented registers.Fix this by using 'return' instead of 'break' in the default case, which prevents execution from reaching the s->regs[reg] assignment for unimplemented registers.
Quoted 6 lines
Reported-by Elhrj Saad <[email protected]>Fixes 5857974d5d11 ("hw/adc: Add basic Aspeed ADC model")Signed-off-by Cédric Le Goater <[email protected]>--- hw/adc/aspeed_adc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
This feels like a qemu-stable material.
Please let me know if it isn't.
Thanks,
/mjt
Quoted 14 lines
hw/adc/aspeed_adc.c +2
-1@@ -228,7 +228,8 @@ static void aspeed_adc_engine_write(void *opaque, hwaddr addr, uint64_t value,qemu_log_mask (LOG_UNIMP ,"%s: engine[%u]: " "0x%" HWADDR_PRIx" 0x%" PRIx64"\n" , __func__, s->engine_id, addr, value); -break ; +/* Do not update the regs[] array */ +return ; } s->regs[reg] = value;