Bug 1268852 - opensmtpd: Remotely triggerable buffer overflow vulnerability in filter_tx_io
opensmtpd: Remotely triggerable buffer overflow vulnerability in filter_tx_io
Status: CLOSED CURRENTRELEASE
Product: Security Response
Classification: Other
Component: vulnerability (Show other bugs)
unspecified
All Linux
medium Severity medium
: ---
: ---
Assigned To: Red Hat Product Security
impact=moderate,public=20151005,repor...
: Security
Depends On: 1268857 1268858
Blocks:
  Show dependency treegraph
 
Reported: 2015-10-05 09:04 EDT by Adam Mariš
Modified: 2015-10-26 15:13 EDT (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2015-10-26 15:13:47 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


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

  None (edit)
Description Adam Mariš 2015-10-05 09:04:08 EDT
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 09:07 EDT
Created attachment 1079937 [details]
Proposed patch

Source: http://seclists.org/oss-sec/2015/q4/26
Comment 2 Adam Mariš 2015-10-05 09:08:37 EDT
Created opensmtpd tracking bugs for this issue:

Affects: fedora-all [bug 1268857]
Affects: epel-all [bug 1268858]
Comment 3 Denis Fateyev 2015-10-05 15:59:08 EDT
Fixed with 5.7.3 upstream release, updates will be pushed in testing soon.
Comment 4 Denis Fateyev 2015-10-26 15:13:47 EDT
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.