DPDK-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: bugzilla@dpdk.org
To: dev@dpdk.org
Subject: [DPDK/cryptodev Bug 1987] OpenSSL AES-128-CBC encryption with scatter-gather buffer overflow
Date: Fri, 28 Aug 2026 09:09:43 +0000	[thread overview]
Message-ID: <bug-1987-3@https.bugs.dpdk.org/> (raw)

https://bugs.dpdk.org/show_bug.cgi?id=1987

            Bug ID: 1987
           Summary: OpenSSL AES-128-CBC encryption with scatter-gather
                    buffer overflow
           Product: DPDK
           Version: unspecified
          Hardware: All
                OS: All
            Status: UNCONFIRMED
          Severity: normal
          Priority: Normal
         Component: cryptodev
          Assignee: dev@dpdk.org
          Reporter: thomas@monjalon.net
  Target Milestone: ---
             Group: security

Report date: 2025-02-20
Reported by: Gowtham Suresh Kumar <Gowtham.SureshKumar@arm.com>

Subject: Security Vulnerability: Buffer Overflow in DPDK function
process_openssl_encryption_update() for segmented in-place operations

Dear DPDK Security Team,

I would like to report a buffer overflow vulnerability in DPDK that occurs in
AES-128-CBC Encryption with Scatter-Gather, Inplace configuration for a
particular corner case. This issue leads to out-of-bounds writes, potentially
overwriting sensitive information such as plaintext or ciphertext outside the
allocated buffer.
Issue Description:

The vulnerability can be reproduced by modifying sgl_segs parameter in
AES-128-CBC Encryption Scatter-Gather (Inplace) test case increasing the
segment count from 3 to 128, in test_cryptodev_aes_test_vectors.h. When using
small segment sizes (e.g., 4 bytes per segment), incorrect pointer handling
results in OpenSSL writing ciphertext outside the expected buffer bounds.

Key Findings:
- Incorrect Pointer Updates: The dst pointer is updated incorrectly across
consecutive EVP_EncryptUpdate() calls, even when OpenSSL buffers input instead
of producing immediate ciphertext.
- Buffer Overflow in EVP_Final(): When OpenSSL finally encrypts the accumulated
data, it writes beyond the allocated buffer, overwriting adjacent memory.
- Segment Size Dependency: The issue occurs for small segment sizes
specifically when sizes of consecutive segments together is smaller than block
size of the cipher

Root Cause Analysis:
- dst pointer is updated incorrectly even when OpenSSL does not generate output
(outl = 0).
- Small segments cause OpenSSL to delay encryption, leading to misalignment in
buffer usage.
- On final encryption (EVP_Final()), OpenSSL writes ciphertext at an incorrect
memory location, causing a buffer overflow.

Impact & Security Concerns:
This issue presents a critical security risk, as it allows OpenSSL to:
- Write sensitive plaintext or ciphertext outside the allocated buffer,
potentially exposing cryptographic data.
- Corrupt adjacent memory, leading to unpredictable behavior or crashes.
- Introduce vulnerabilities that could be exploited depending on the deployment
context.

Proposed Fix:
- Modify process_openssl_encryption_update() to ensure dst pointer is updated
only when valid ciphertext is produced.
- Introduce additional checks to prevent buffer overflows when segment sizes
are small.
- Expand test cases to include non-block-aligned segment sizes to detect
similar issues.

-- 
You are receiving this mail because:
You are the assignee for the bug.

                 reply	other threads:[~2026-08-28  9:09 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-1987-3@https.bugs.dpdk.org/ \
    --to=bugzilla@dpdk.org \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox