Bug 2045572 - CVE-2022-0367 libmodbus: Heap-based Buffer Overflow in modbus_reply [fedora-all]
Summary: CVE-2022-0367 libmodbus: Heap-based Buffer Overflow in modbus_reply [fedora-all]
Alias: None
Product: Fedora
Classification: Fedora
Component: libmodbus
Version: 35
Hardware: Unspecified
OS: Unspecified
Target Milestone: ---
Assignee: Eric Sandeen
QA Contact: Fedora Extras Quality Assurance
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:25 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: No Doc Update
Doc Text:
Clone Of:
Last Closed: 2022-02-04 18:25:11 UTC
Type: ---

Attachments (Terms of Use)

Description Pedro Sampaio 2022-01-25 17:32:47 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 fedora-all.

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:

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.

NOTE: this issue affects multiple supported versions of Fedora. While only
one tracking bug has been filed, please correct all affected versions at
the same time.  If you need to fix the versions independent of each other,
you may clone this bug as appropriate.

Comment 1 Pedro Sampaio 2022-01-25 17:32:49 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)

# low, medium, high, urgent (required)

# testing, stable

# Bug numbers: 1234,9876

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

# Enable request automation based on the stable/unstable karma thresholds

# Automatically close bugs when this marked as stable

# Suggest that users restart after update


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


Comment 2 Eric Sandeen 2022-02-04 18:25:11 UTC
Only rawhide is affected; all released versions are prior to the introduction of this bug.

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).

which did: 

@@ -1041,15 +1050,15 @@ int modbus_reply(modbus_t *ctx, const uint8_t *req,
             rsp_length = response_exception(
                 ctx, &sft,
-        } 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) {

(note the 2nd "address_write" turned into "mapping_address" instead of "mapping_address" write) went into v3.1.3.

Older versions (i.e. anything older than rawhide) are not affected.

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