Skip to content

Add checks for weak cryptography (hashes and ciphers) - #6

Merged
katafrakt merged 5 commits into
jumpfrom
crypto-checks
Oct 21, 2026
Merged

katafrakt merged 5 commits into
jumpfrom
crypto-checks

Conversation

@katafrakt

@katafrakt katafrakt commented Oct 19, 2026 •

Copy link
Copy Markdown

This adds 2 new checks related to weak cryptography:

  • Crypto.WeakHash flagging uses of old algorithms, such as MD5
  • Crypto.WeakCipher – similar for DES, Blowfish, weak modes for AES, such as CBC and others

Following https://github.com/erlef/elixir-secure-coding/blob/main/modules/2-owasp.livemd#prevention-1

It also included Crypto.WeakRandom but I dropped it, not being able to find a reliable way to distinguish between security context and non-security one. The proposed implementation was based on variable/function name guessing, which is not good. Probably a job for LLM rather than a SAST tool.

@katafrakt
katafrakt marked this pull request as ready for review October 21, 2026 12:42
@katafrakt katafrakt changed the title Add Crypto checks for weak hashes, ciphers and randomness Add checks for weak cryptography (hashes and ciphers) Oct 21, 2026

@s3cur3 s3cur3 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome!

Comment on lines +7 to +11
# Return original finding nodes alongside effective arguments (including pipes).
# Unlike variable extraction, this also retains calls with entirely literal data.
# Every pipe is considered, including chains containing `do` blocks, which
# `get_pipe_funs/1` deliberately skips.
def calls_with_args(ast, specifications) do

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

@katafrakt
katafrakt merged commit 1490676 into jump Oct 21, 2026
9 checks passed
@katafrakt
katafrakt deleted the crypto-checks branch October 21, 2026 17:18
houllette pushed a commit to sobelow/sobelow that referenced this pull request Oct 28, 2026
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.

2 participants