Bug 2045573 - CVE-2022-0367 libmodbus: Heap-based Buffer Overflow in modbus_reply [epel-7]
Summary: CVE-2022-0367 libmodbus: Heap-based Buffer Overflow in modbus_reply [epel-7]
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora EPEL
Classification: Fedora
Component: libmodbus
Version: epel7
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: ---
Assignee: Eric Sandeen
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: CVE-2022-0367
TreeView+ depends on / blocked
 
Reported: 2022-01-25 17:32 UTC by Pedro Sampaio
Modified: 2022-02-04 18:23 UTC (History)
3 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2022-02-04 18:23:23 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Pedro Sampaio 2022-01-25 17:32:51 UTC
This is an automatically created tracking bug!  It was created to ensure
that one or more security vulnerabilities are fixed in affected versions
of epel-7.

For comments that are specific to the vulnerability please use bugs filed
against the "Security Response" product referenced in the "Blocks" field.

For more information see:
http://fedoraproject.org/wiki/Security/TrackingBugs

When submitting as an update, use the fedpkg template provided in the next
comment(s).  This will include the bug IDs of this tracking bug as well as
the relevant top-level CVE bugs.

Please also mention the CVE IDs being fixed in the RPM changelog and the
fedpkg commit message.

Comment 1 Pedro Sampaio 2022-01-25 17:32:53 UTC
Use the following template to for the 'fedpkg update' request to submit an
update for this issue as it contains the top-level parent bug(s) as well as
this tracking bug.  This will ensure that all associated bugs get updated
when new packages are pushed to stable.

=====

# bugfix, security, enhancement, newpackage (required)
type=security

# low, medium, high, urgent (required)
severity=medium

# testing, stable
request=testing

# Bug numbers: 1234,9876
bugs=2045571,2045573

# Description of your update
notes=Security fix for [PUT CVEs HERE]

# Enable request automation based on the stable/unstable karma thresholds
autokarma=True
stable_karma=3
unstable_karma=-3

# Automatically close bugs when this marked as stable
close_bugs=True

# Suggest that users restart after update
suggest_reboot=False

======

Additionally, you may opt to use the bodhi web interface to submit updates:

https://bodhi.fedoraproject.org/updates/new

Comment 2 Eric Sandeen 2022-02-04 18:23:23 UTC
Not affected.

The commit which introduced the cut and paste error was 

commit 933ed4d3e9f226a21274ff33ebc735d50d5f0be9
Author: Stéphane Raimbault <stephane.raimbault>
Date:   Tue May 10 13:34:22 2016 +0200

    Change API modbus_mapping_(offsets_new) to (new_start_address)
    
    Related to 52ab1bbea760ed8eaca184f7d875a2f52a116d0f.
    The arguments have been changed (see documentation).
    
    https://groups.google.com/d/msg/libmodbus/aXO8nBzW4Ew/uVGTDmvvBAAJ

which did: 

@@ -1041,15 +1050,15 @@ int modbus_reply(modbus_t *ctx, const uint8_t *req,
             rsp_length = response_exception(
                 ctx, &sft,
                 MODBUS_EXCEPTION_ILLEGAL_DATA_VALUE, rsp);
-        } else if (address < mb_mapping->offset_registers ||
-                   (addr + nb) > mb_mapping->nb_registers ||
-                   address_write < mb_mapping->offset_registers ||
-                   (addr_write + nb_write) > mb_mapping->nb_registers) {
+        } else if (mapping_address < 0 ||
+                   (mapping_address + nb) > mb_mapping->nb_registers ||
+                   mapping_address < 0 ||
+                   (mapping_address_write + nb_write) > mb_mapping->nb_registers) {
             if (ctx->debug) {
                 fprintf(stderr,

(note the 2nd "address_write" turned into "mapping_address" instead of "mapping_address" write) went into v3.1.3. Older versions are not affected.


Note You need to log in before you can comment on or make changes to this bug.