DPDK-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: bugzilla@dpdk.org
To: dev@dpdk.org
Subject: [DPDK/cryptodev Bug 1993] CCP cipher keys overflow
Date: Fri, 28 Aug 2026 10:18:49 +0000	[thread overview]
Message-ID: <bug-1993-3@https.bugs.dpdk.org/> (raw)

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

            Bug ID: 1993
           Summary: CCP cipher keys 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: 2026-03-11
Reported by: pengpeng <pengpeng@iscas.ac.cn>

Hello DPDK maintainers,


I would like to report what appears to be a real current-head overflow in the
`ccp` crypto PMD. I rechecked current upstream head on 2026-03-10 before
writing this report.


The core problem is in `ccp_configure_session_cipher()`:


```c
sess->cipher.key_length = cipher_xform->key.length;
rte_memcpy(sess->cipher.key, cipher_xform->key.data,
           cipher_xform->key.length);
...
if (sess->cipher.key_length == 16) ...
else if (sess->cipher.key_length == 24) ...
else if (sess->cipher.key_length == 32) ...
else
    return -1;
```


The destination layout in `struct ccp_session` is:


```c
uint64_t key_length;
uint8_t  key[32];
uint8_t  key_ccp[32];
phys_addr_t key_phys;
uint8_t  nonce[32];
```


So a `40`-byte key already overwrites the adjacent `key_ccp` member before the
function reports that the length is invalid.


Why I do not think this is refuted by current-head invariants:


- the generic session setup paths still reach `ccp_set_session_parameters()`
and then `ccp_configure_session_cipher()`
- the function itself performs the copy before its algorithm-specific
accepted-length checks
- this is not a tail-allocation pattern; it is a fixed in-object array followed
by a live adjacent member
- the issue is not just "unsupported input"; the memory corruption happens
before the `-1` return


I am keeping the claim narrow: this is a PMD session-configuration bug, and the
cleanest reproducer is an oversized AES key such as 40 bytes.


The fix seems straightforward:


1. validate the supported key length before the `rte_memcpy()`
2. add a hard upper bound such as `if (cipher_xform->key.length >
sizeof(sess->cipher.key)) return -1;`

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

                 reply	other threads:[~2026-08-28 10:18 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-1993-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