php / php/doc-en

"AES Authenticated Encryption example" is wrong and insecure

Open
#2,512 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Extension: openssl
Dominant language
XML
Stars
596
Forks
890
Avg merge
1d 15h
Merged PRs (30d)
55

Description

From manual page: https://php.net/function.openssl-encrypt

The example "Example #2 AES Authenticated Encryption example prior to PHP 7.1" is wrong and insecure, in the way that the hmac doesn't consider the IV. That means that it's possible take an encrypted and authenticated value, change its IV (the first bytes) and still pass the hmac check.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the linked openssl-encrypt manual page and locate “Example #2 AES Authenticated Encryption example prior to PHP 7.1.” Review how the HMAC relates to the IV, then update the example so the authenticated data covers the IV; the issue is done when the documented example no longer permits IV changes to pass verification.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
documentation, security
Issue type
Documentation
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.