Skip to main content

splunksecrets - Encrypt and Decrypt Splunk Passwords

Build Status

splunksecrets is a tool for working with Splunk secrets offline. It currently supports encryption and decryption of passwords, but in the future will support offline recursive conversion of a Splunk installation from one splunk.secret file to another (e.g. for synchronizing splunk.secret across your entire distributed infrastructure).

Installation

You can install splunksecrets using uv:

uv tool install splunksecrets

Or with pip:

python -m pip install splunksecrets

Usage

As of version 1.0.0, splunksecrets is broken into subcommands for each operaton

Usage: splunksecrets [OPTIONS] COMMAND [ARGS]...

Options:
  --help  Show this message and exit.

Commands:
  dbconnect-decrypt           Decrypt password used for dbconnect identity
  dbconnect-decrypt-fips      Decrypt DB Connect password encrypted in FIPS mode
  dbconnect-encrypt           Encrypt password used for dbconnect identity
  dbconnect-legacy-encrypt    Encrypt password used for dbconnect identity using legacy algorithm
  phantom-decrypt             Decrypt password used for Phantom asset
  phantom-encrypt             Encrypt password used for Phantom asset
  splunk-decrypt              Decrypt password using Splunk 7.2 or 10.6 algorithm
  splunk-encrypt              Encrypt password using Splunk 7.2 or 10.6 algorithm
  splunk-hash-passwd          Generate password hash for use in...
  splunk-legacy-decrypt       Decrypt password using legacy Splunk algorithm...
  splunk-legacy-encrypt       Encrypt password using legacy Splunk algorithm...

You can find details of the usage of each subcommand by running the command followed by --help.

  • dbconnect-encrypt and dbconnect-decrypt are for interacting with credentials stored in identities.conf in splunk_app_db_connect

  • dbconnect-decrypt-fips is for the same credentials when DB Connect runs in FIPS mode

  • phantom-encrypt and phantom-decrypt are for interacting with credentials stored in the Phantom database

  • splunk-encrypt and splunk-decrypt are for interacting with credentials from Splunk 7.2 or newer. splunk-decrypt reads both $7$ and $8$ values. splunk-encrypt writes $7$ by default; pass --v8 to write $8$, which only Splunk 10.6 or newer can read

  • splunk-legacy-encrypt and splunk-legacy-decrypt are for interacting with credentials from Splunk versions below 7.2

  • splunk-hash-passwd is for generating Splunk local user password hashes for use in $SPLUNK_HOME/etc/passwd

Encryption Schemes

Splunk passwd hashes

Splunk password hashes are not, strictly speaking, encrypted. They’re hashed using the standard Unix crypt function. The $6$ indicates that SHA-512 hashing algorithm is used. Details on SHA-crypt can be found here.

Splunk pre-7.2

Splunk prior to 7.2 used RC4 encryption for secrets, indicated in configuration files by $1$ in the encrypted password. The plaintext password is XOR’ed with a static salt (DEFAULTSA) and then RC4 encrypted using the first 16-bytes of splunk.secret as the key. The resulting ciphertext is base64-encoded and prepended with $1$ to produce the encrypted password seen in the configuration files.

Splunk 7.2

Starting in Splunk 7.2, AES256-GCM is used for encryption of secrets, indicated in configuration files by $7$ in the encrypted password. The PBKDF2 algorithm is used to derive an encryption key from all 254 bytes of splunk.secret (the newline character is stripped from the end of the file), using a static salt of disk-encryption and a single iteration. This 256-bit key is then used as the encryption key for AES256-GCM, with a 16-byte randomly generated initialization vector. The encryption produces both the ciphertext as well as a “tag” that is used as part of integrity verification. The iv, ciphertext, and tag (in that order) are concatenated, base64-encoded, and prepended with $7$ to produce the encrypted password seen in the configuration files. If the key is less than 254-bytes it is padded with null bytes.

Splunk 10.6

Starting in Splunk 10.6, PBKDF2 is replaced with HKDF as the key derivation function, and these secrets are indicated in configuration files by $8$ in the encrypted password. The encryption key is still derived from all 254 bytes of splunk.secret (with the newline character still stripped), using a random 16-byte salt, and a static info string of disk-encryption-hkdf. The AES256-GCM is performed in the same manner as the 7.2 encryption. The output is created by concatenating the prefix ($8$), base64-encoded HKDF salt, $ as the field separator, and the base64-encoded AES payload (iv, ciphertext, and tag, in that order, with no separator). If the key is less than 254-bytes it is padded with null bytes.

Phantom

Phantom stores encrypted credentials in it’s internal database as part of the JSON blob in the configuration column of the asset table. These credentials are encrypted using AES256-CBC and are stored base64-encoded. A SHA256 hash is generated using the public modulus of the Phantom RSA private key (located at /opt/phantom/keystore/private_key.pem) concatenated with the Django SECRET_KEY (found in /opt/phantom/www/phantom_ui/secret_key.py) - this hash is used as the key for the AES encryption. A SHA1 hash is generated using the id of the asset from the asset table - this hash is used as the initialization vector (iv) for the AES encryption. The password to be encrypted is padded using PKCS7 padding prior to encryption.

DBConnect pre ~3.12

DBConnect used to encrypt passwords using the OpenSSL aes-256-cbc command. This changed somewhere around 3.12 though I haven’t bothered to find the exact version where the change was made. This encryption is fairly straightforward, and is documented in dbxcrypto.py included with DBConnect. The key and IV are derived from the secret (stored in $SPLUNK_HOMEetc/apps/splunk_app_db_connect/certs/identity.dat) and the salt (randomly generated by OpenSSL). The resulting ciphertext is concatenated together with the salt (Salted__ + salt + ciphertext) and encoded using Base64. The password to be encrypted is padded using PKCS7 padding prior to encryption.

DBConnect post ~3.12

DBConnect now encrypts passwords using AES GCM with no padding. A random 16-byte salt is generated as well as a random 12-byte IV. The key is derived from the salt and the secret (stored in $SPLUNK_HOMEetc/apps/splunk_app_db_connect/certs/identity.dat) using Scrypt. The final output is salt + iv + ciphertext.

DBConnect in FIPS mode

Scrypt isn’t FIPS-approved, so DBConnect running in FIPS mode derives the key with PBKDF2 (HMAC-SHA256, 32 iterations) instead. Everything else matches the post ~3.12 scheme: AES GCM, with an output of salt (16 bytes) + iv (12 bytes) + ciphertext. Use dbconnect-decrypt-fips for these passwords.

Known Issues

  • If the splunk secret and an encrypted password don’t match, $7$ and $8$ passwords fail with “wrong splunk.secret or corrupted value”. $1$ (pre-7.2) passwords have no integrity check, so a mismatched secret still produces gibberish output instead of an error.

  • DBConnect will occassionally store the ending newline from OpenSSL output in identities.conf, represented as a single \ at the end of a line. This must be removed prior to passing encrypted passwords to splunksecrets

Version History

Version 1.2.0 (2026-11-18)

  • Added support for Splunk 10.6 $8$ passwords: splunk-decrypt reads them, splunk-encrypt --v8 writes them, and encrypt_v8 writes them from the library

  • Added dbconnect-decrypt-fips for DB Connect passwords encrypted in FIPS mode. Thanks to grokdesigns for this contribution.

  • $7$ and $8$ decryption now checks the GCM tag, so a wrong splunk.secret or a corrupted value fails with a clear error instead of returning garbage

  • splunk-encrypt, splunk-decrypt, splunk-legacy-decrypt and the DB Connect decrypt commands report bad input and failed decryption as a one-line error instead of a traceback

  • Behavior change for library callers: splunksecrets.decrypt now raises ValueError for an unknown prefix (it used to return None), and for a wrong splunk.secret or a corrupted $7$/$8$ value (it used to return garbage or raise UnicodeDecodeError)

Version 1.1.0 (2025-06-05)

  • Added support for encryption/decryption of DBConnect credentials using newer algorithm

  • Bumps minimum Python version to 3.9

  • Refactored code into multiple files

  • Switched from setup.py to pyproject.toml

  • Removed six dependency used for Python 2 compatibility

Version 1.0.1

  • Short secrets are padded in the same way Splunk itself does it. Thanks to Matt Anderson for this contribution.

Version 1.0.0 (2021-06-07)

  • Updated CLI command docstrings for proper help output

  • Add initial support for encryption/decrypt of Splunk DBConnect credentials

Version 1.0.0rc1 (2021-05-19)

  • New CLI interface that breaks each operation into its own subcommand

  • CLI interface supports passing path to key files (splunk.secret, private_key.pem, and secret_key.py) via arguments, or file contents via environment variables

  • Add initial support for encryption/decryption of Phantom asset credentials (thanks swoops)

Version 0.5.1 (2022-06-29)

  • Allow passing the splunk secret itself as an environment variable

    ~ provided by chutzimir

Version 0.5.0 (2020-06-23)

  • Add support for passing a path to splunk.secret, the splunk.secret contents, and the password/password hash via environment variables (thanks hanswurscht)

  • Added error output when trying to decrypt user passwords

Version 0.4.3 (2020-02-17)

  • Correct an issue when splunk secret is too long. Splunk handles this by truncating splunk.secret to 254 bytes, so we now do the same (thanks nbertram)

  • Added error checking in case, somehow, splunk secret is too short.

Version 0.4.2 (2019-09-29)

  • Add handling for incorrectly padded (but otherwise correct) password strings as a convenience (thanks rafrey-his)

Version 0.4.1 (2019-09-11)

  • Fix an issue in Python 3 when using --splunk-secret-text (thanks Joeboyc2)

Version 0.4.0 (2019-03-25)

  • Add --hash-passwd flag for generating Splunk password hashes

Version 0.3.1 (2019-02-06)

  • Fix bug when a character in the password was the same as the salt character

  • Add --splunk-secret-text and --password arguments for non-interactive use (thanks nadidsky)

Version 0.3.0 (2019-01-26)

  • Add --nosalt flag for pre-7.2 passwords that are not salted, such as sslPassword (thanks duckfez)

Version 0.2.1 (2018-10-27)

  • Cosmetic release to update metadata on PyPI

Version 0.2.0 (2018-10-24)

  • Add support for Splunk 7.2

Version 0.1.0 (2018-10-08)

  • Initial release

  • Support Splunk < 7.2

License Info

The MIT License (MIT)

Copyright (c) 2025 Hurricane Labs LLC

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Metadata

Release files for splunksecrets 1.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for splunksecrets 1.2.0
File Size Uploaded Provenance Actions
splunksecrets-1.2.0.tar.gz 45.9 kB With provenance Details for splunksecrets-1.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for splunksecrets 1.2.0
File Interpreter ABI Platform Actions
splunksecrets-1.2.0-py3-none-any.whl Python 3 none any Details for splunksecrets-1.2.0-py3-none-any.whl

Total release size: 59.1 kB

Release files / splunksecrets-1.2.0.tar.gz

Download URL splunksecrets-1.2.0.tar.gz
Size 45.9 kB
Tags Source
SHA-256 checksum
How to use checksums
12e08676c6ad67811f5b63b2436f9b14f93b507368cbaa84bdf825ca3e453d6e
BLAKE2b-256 checksum
How to use checksums
c088aa179051ab1451d0fcfcb46b2c1591a8ae2dffcf8d6fbd8030dbe911b5e6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 18, 2026.

Transparency log

Release files / splunksecrets-1.2.0-py3-none-any.whl

Download URL splunksecrets-1.2.0-py3-none-any.whl
Size 13.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
95cf6b514ec0b7f9818e14e4a5f5a2010b345652431d018f3cdc65f03b50338d
BLAKE2b-256 checksum
How to use checksums
26d45e3a784f805910029eb408bb654a2460d8b58e5ce9927dfc9604910ced7f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 18, 2026.

Transparency log

Security for splunksecrets 1.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for splunksecrets-1.2.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 18, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page