nginx / nginx/docker-nginx

Anomalous 'enc' parameter (value 2) passed to Libcrypto EVP_CipherInit_ex in 1.27.4 image

Open
#1,050 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Shell
Stars
3.5k
Forks
1.8k
Avg merge
42m
Merged PRs (30d)
2

Description

Bug Overview

Description:
Dynamic tracing reveals that the official Nginx docker image is passing an anomalous parameter to the OpenSSL EVP_CipherInit_ex function. The enc parameter is being set to 2.

Expected Behavior

According to the official OpenSSL manual, the enc parameter should only accept 1 (encrypt), 0 (decrypt), or -1 (leave unchanged). While OpenSSL currently tolerates this due to permissive internal checks, this is undocumented behavior and could break in future cryptographic updates.

Steps to Reproduce the Bug

Reproduction Environment:

  • Nginx Docker Tag: 1.27.4
  • Image ID: 97662d24417b
Environment Details
> uname -a
Linux x1-c 6.8.0-111-generic #111~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Tue Apr 14 17:13:45 UTC  x86_64 x86_64 x86_64 GNU/Linux
> docker compose version
Docker Compose version v5.1.3
Additional Context

Additional Context:
This behavior appears specifically in pre-built configurations like the Docker image mentioned above. When OpenSSL and Nginx are built manually from source, this anomalous parameter passing disappears. This suggests the issue might be tied to how the libraries are compiled or linked in the official image environment.

Could the maintainers investigate what is causing Nginx (or its included modules) to pass 2 to the cipher initialization context in this specific build?

Related Issue

https://github.com/openssl/openssl/issues/31357

Contributor guide

Open the contributing guide

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 by reproducing the trace against the official Nginx Docker tag 1.27.4 and image ID 97662d24417b, then inspect the Nginx/OpenSSL build and linking used by that image. Compare the behavior with a manual source build and read the related OpenSSL issue 31357. Done means identifying the component or build condition producing enc=2 and documenting or fixing the responsible project boundary.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, nginx
Domain
devops, infrastructure, security
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.