techgaun / github-dorks

Find leaked secrets via github search
Apache License 2.0
2.82k stars 591 forks source link

Add Rails' master.key to dorks list #37

Closed connorshea closed 5 years ago

connorshea commented 5 years ago

Rails 5.2+ has a config/credentials.yml.enc file and a config/master.key to decrypt it.

See this article for more info: https://www.engineyard.com/blog/rails-encrypted-credentials-on-rails-5.2

This is what the decrypted credentials.yml file looks like (from a Rails app I created just now for testing):

# aws:
#   access_key_id: 123
#   secret_access_key: 345

# Used as the base secret for all MessageVerifiers in Rails, including the one protecting cookies.
secret_key_base: 111e265cc90f2ae073610628f5f0bb0ed9056beeeb502a64d4c3b05493810e2c4671eaa03e74ef786e74f2c23958f16c690812efba27e8bab8b5e1872611d6f5

There's not really a point to searching for decrypted credentials.yml files on GitHub because when you edit them with rails credentials:edit they open in a temporary file outside the Rails app's directory, so you'd have to try pretty hard to commit them.

The master.key file is ignored by default when creating an app with rails new, but Rails templates sometimes mess with the .gitignore, or users delete the default .gitignore for whatever reason.