Bug 1268852 - opensmtpd: Remotely triggerable buffer overflow vulnerability in filter_tx_io
Summary: opensmtpd: Remotely triggerable buffer overflow vulnerability in filter_tx_io
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Security Response
Classification: Other
Component: vulnerability
Version: unspecified
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Red Hat Product Security
QA Contact:
URL:
Whiteboard:
Depends On: 1268857 1268858
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-10-05 13:04 UTC by Adam Mariš
Modified: 2019-09-29 13:37 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-10-26 19:13:47 UTC
Embargoed:


Attachments (Terms of Use)
Proposed patch (1.02 KB, patch)
2015-10-05 13:07 UTC, Adam Mariš
no flags Details | Diff

Description Adam Mariš 2015-10-05 13:04:08 UTC
Remotely triggerable buffer overflow vulnerability was found in filter_tx_io function in filter.c.

Vulnerable piece of code: 

filter_tx_io(struct io *io, int evt)
{
    struct filter_session   *s = io->arg;
    size_t           len, n;
    char            *data;
    char            buf[65535];

    log_trace(TRACE_FILTERS, "filter: filter_tx_io(%p, %s)", s, io_strevent(evt));

    switch (evt) {
    case IO_DATAIN:
        data = iobuf_data(&s->ibuf);
        len = iobuf_len(&s->ibuf);
        memmove(buf, data, len);
        buf[len] = 0;
        log_trace(TRACE_FILTERS, "filter: filter_tx_io: datain (%zu) for req %016"PRIx64": %s",
            len, s->id, buf);
...

It's possible for `len` to be greater than 65535 in which case the memmove() overflows `buf`. This issue affects 5.7.x versions.

Reproducer for crash of the service can be found here:

http://seclists.org/oss-sec/2015/q4/25

Comment 1 Adam Mariš 2015-10-05 13:07:15 UTC
Created attachment 1079937 [details]
Proposed patch

Source: http://seclists.org/oss-sec/2015/q4/26

Comment 2 Adam Mariš 2015-10-05 13:08:37 UTC
Created opensmtpd tracking bugs for this issue:

Affects: fedora-all [bug 1268857]
Affects: epel-all [bug 1268858]

Comment 3 Denis Fateyev 2015-10-05 19:59:08 UTC
Fixed with 5.7.3 upstream release, updates will be pushed in testing soon.

Comment 4 Denis Fateyev 2015-10-26 19:13:47 UTC
Fixed in opensmtpd version 5.7.3 which is on stable.


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