Skip to content

certs: add explicit validation to SM2 SPKI test utility#10463

Open
orbisai0security wants to merge 1 commit into
wolfSSL:masterfrom
orbisai0security:fix-v-003-subprocess-injection-sm2-spki
Open

certs: add explicit validation to SM2 SPKI test utility#10463
orbisai0security wants to merge 1 commit into
wolfSSL:masterfrom
orbisai0security:fix-v-003-subprocess-injection-sm2-spki

Conversation

@orbisai0security
Copy link
Copy Markdown

@orbisai0security orbisai0security commented May 12, 2026

Summary

This is a small defensive cleanup for certs/sm2/fix_sm2_spki.py.

Changes:

  • Replace assert cert_der[0] == 0x30 with an explicit ValueError, so validation is preserved even when Python assertions are disabled.
  • Add basic CLI checks that the input certificate and signing key paths refer to regular files.
  • Use temporary files for both TBS and signature outputs.

This is not intended to claim a production security vulnerability. The original subprocess call already used an argument list and did not use shell=True; this patch is only minor hardening/cleanup for a test certificate generation utility.

Changes

  • certs/sm2/fix_sm2_spki.py

Verification

  • Build passes
  • Scanner re-scan confirms fix
  • LLM code review passed

Automated security fix by OrbisAI Security

Automated security fix generated by Orbis Security AI
@wolfSSL-Bot
Copy link
Copy Markdown

Can one of the admins verify this patch?

@dgarske
Copy link
Copy Markdown
Member

dgarske commented May 12, 2026

Hi @orbisai0security I do not see you on the approved contributor list. Can you tell us more about your project and use of wolfssl? Also more about how you found this?

This script is only used for generation of test certificates. Please reconsider the tone of your description and please take the time to only report meaningful reports. Also for real issues those should be sent to support at wolfssl dot com.

@orbisai0security orbisai0security changed the title fix: sanitize subprocess call in fix_sm2_spki.py certs: add explicit validation to SM2 SPKI test utility May 13, 2026
@orbisai0security
Copy link
Copy Markdown
Author

Hey @dgarske

I’m working on an internal AppSec research project that evaluates whether automated static-analysis + LLM-assisted review can identify real security-relevant defects in open-source C/C++ and supporting tooling. wolfSSL came up in that research because of its security-sensitive domain, not because we are currently using this specific ESP-IDF bundle-generation script in production.

For this PR specifically, the existing subprocess.run([...]) call does not use shell=True, so this is not a practical CWE-78 command-injection issue as described. The more accurate characterisation is minor defensive hardening around a test-certificate utility: explicit DER validation instead of assert, basic input-file checks, and making subprocess behaviour explicit.

I also understand this script is only used for test certificate generation, so I agree this should not have been presented as a high-severity production security issue.

More broadly, the goal of the project is to improve the signal quality of automated security contributions. This is useful feedback: future reports should include a concrete affected code path, reproducible impact, and a clear explanation of whether the change is a security fix versus defensive hardening.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants