Security Vulnerabilities in Smallstep PKI Software
Smallstep's certificate templates used unescaped JSON templating, allowing an attacker who can inject into a template to override fields and obtain a certificate with arbitrary properties. Additionally, the AWS provisioner relied on client-side enforcement of a one-certificate-per-instance rule, so a malicious client could bypass it and obtain multiple certificates.
agwa.name
Published on agwa.name
I recently did a partial security review of Smallstep, a commercially-backed open source private certificate authority written in Go. I found that Smallstep is vulnerable to JSON injection, misuses JWTs, and relies on client-side enforcement of server-side security.
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the use of raw text templating for JSON without context-aware escaping, and reliance on client-side enforcement for server-side security checks.
Impact
An attacker could obtain certificates with arbitrary or no extended key usages, and could bypass the one-certificate-per-instance limit to obtain multiple certificates.
What the attacker needed
Access to a template that includes unescaped user input; ability to submit a CSR with a crafted common name; AWS provisioner enabled (for the second issue)
The fix
The JSON injection was fixed by escaping JSON in the default X.509 template, but the report notes that a proper fix requires a context-aware JSON templating system; the client-side enforcement issue was not fully addressed in the text.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
Smallstep is a tool that issues digital certificates, like ID cards for computers. It let users define templates for these certificates using a simple text format, but didn't properly escape values, so someone could sneak in extra settings. Also, a rule meant to limit each cloud server to one certificate was checked on the user's side, not the server's, so it could be bypassed.
What is Access control?
A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.