Why LLMs Can't Break AES: The Cryptographic Wall Transformers Can't Climb
The Experiment: Throwing LLMs at AES Ciphertext
Recently, a security researcher put a straightforward question to the test: can a modern LLM, fed a ciphertext encrypted with AES-256, recover the plaintext or the key? The experiment was brutally simple. He generated a plaintext, encrypted it with a standard library, and handed the raw bytes to the model. The prompt was effectively: "Here is the ciphertext. Decrypt it."
The result was absolute failure. Not just "it got a few bits wrong" failure—complete, cryptographic-grade gibberish. The models didn't get close. They hallucinated outputs that bore no statistical relationship to the original plaintext. This wasn't a prompt engineering problem. It was a brick wall.
You can read the full breakdown of the experiment in the source analysis here. The core finding is stark: LLMs treat ciphertext as a linguistic sequence, but AES output is mathematically designed to be indistinguishable from random noise. There is no semantic skeleton to latch onto.
Why Brute Force is a Mathematical Non-Starter
To understand why this matters, we need to look at the numbers. AES-256 uses a 256-bit key. That's ( 2^{256} ) possible combinations. Engineers often struggle to internalize exponents of this magnitude, so let's ground it.
| Metric | Value |
|---|---|
| Key Space Size | ( 1.15 \times 10^{77} ) |
| Atoms in the Observable Universe | ( \approx 10^{80} ) |
| Time to brute force at 1 trillion guesses/sec | ( \approx 3.3 \times 10^{56} ) years |
| Age of the Universe | ( 1.38 \times 10^{10} ) years |
If you turned the entire planet into a perfect computational substrate operating at the Landauer limit, you'd still need billions of years. LLMs don't change this math. They are not oracles. They are statistical sequence predictors. An LLM cannot "think" its way through a key space that large because there is no gradient to descend. A wrong key doesn't produce "slightly wrong" plaintext; it produces statistically uniform noise. The fitness landscape is a flat plane with a single needle of correctness.
The Transformer's Fundamental Mismatch
Let's look under the hood at why the architecture fails. A transformer model processes input through self-attention, learning relationships between tokens. For text, this is magic. For AES ciphertext, it's a category error.
Determinism vs. Probability
AES is a bijective function: one input maps to exactly one output. A single bit flip in the ciphertext causes a complete avalanche in the decrypted plaintext. Transformers, however, output probability distributions over tokens. They are fundamentally lossy compressors of their training data. They excel at tasks where approximate correctness is useful. In cryptography, approximate correctness is catastrophic.
The Training Data Problem
LLMs are trained on human-generated text. Human text has predictable byte-pair encoding (BPE) distributions, grammar, and semantic structure. AES ciphertext is uniformly distributed random bytes. Most ciphertext isn't even valid UTF-8. It gets tokenized into a chaotic spray of byte tokens that the model has never seen in a coherent context. The model has no prior for this distribution.
The Avalanche Effect
AES is designed so that changing one bit of the key or plaintext changes roughly half the bits of the ciphertext. This is the Strict Avalanche Criterion. For a transformer, this means there is no smooth manifold to interpolate. Two ciphertexts that differ by one bit look completely different to the attention mechanism. There is no "closeness" metric that correlates with semantic similarity, because there is no semantics.
Why This Matters for Forward Deployed Engineers
If you're an FDE stitching together enterprise systems, this is not an academic curiosity. It's a security property you can rely on when designing architectures.
The "AI in the Middle" Attack Surface
There's a growing trend of piping sensitive data through LLMs for classification, extraction, or summarization. The fear is that a model might "memorize" or "leak" encrypted secrets. This research confirms that a model cannot accidentally decrypt AES traffic it ingests. If you are building a log analysis pipeline that sees encrypted payloads, the LLM will treat them as opaque blobs. It won't magically extract PII from ciphertext.
Client-Side Encryption Guarantees
For FDEs building zero-knowledge architectures—where the server holds only ciphertext—this is a strong argument. You can confidently tell a security-conscious customer that even if your LLM-based processing layer is compromised or behaves unexpectedly, it cannot reverse AES-encrypted fields. The math holds regardless of how smart the model appears.
The Real Threat: Key Management, Not Cipher Breaking
Attackers won't waste time asking ChatGPT to crack AES. They'll phish the API keys, find hardcoded secrets in your repo, or exploit a padding oracle in your implementation. The lesson for FDEs is to focus your paranoia on key hygiene and proper use of authenticated encryption (AES-GCM, not AES-CBC without a MAC). If you want to sharpen your ability to build secure, practical systems fast, the patterns in The FDE Portfolio: 5 High-Velocity Prototypes That Prove You Can Ship in Chaos emphasize exactly this kind of robust, key-managed architecture.
How to Test This Yourself (The Hard Way)
Don't take my word for it. The experiment is reproducible in under 20 lines of Python. Here's the core logic:
from Crypto.Cipher import AES
from Crypto.Util.Padding import pad
import os
# Generate a random key and plaintext
key = os.urandom(32) # AES-256
plaintext = b"The launch code is 7-3-5-2-Alpha. Confirm receipt."
# Encrypt with AES-CBC
cipher = AES.new(key, AES.MODE_CBC)
ct_bytes = cipher.iv + cipher.encrypt(pad(plaintext, AES.block_size))
# This is what you'd feed to an LLM. It's raw bytes.
print(ct_bytes.hex())
Take that hex string and paste it into any LLM with a prompt like "Decrypt this AES-256 ciphertext." You'll get confident-sounding gibberish. Try different modes (GCM, CTR). Try giving it partial plaintext hints. It doesn't matter. The model has no mechanism to verify a key guess against the ciphertext without executing the actual block cipher rounds, which it cannot do internally with any reliability.
A More Nuanced Test: Side-Channel Analysis
Where LLMs might show a glimmer of utility is in analyzing side-channel information—power traces, timing leaks, or human-written descriptions of implementations. If you feed an LLM a code snippet with a known vulnerability (e.g., constant-time violation), it can spot it. But that's code analysis, not cryptanalysis. For a deeper dive into building practical AI tools that operate on structured data, check out Build a Personal Finance Categorizer from Bank CSV Exports with Gemini Flash Free Tier, which demonstrates safe, structured data processing.
The Balanced Take: Where LLMs Actually Help in Cryptography
This isn't a blanket dismissal of AI in security. The wall is specific to symmetric ciphertext decryption. LLMs are genuinely useful for:
- Protocol Analysis: Feeding an RFC or a custom auth handshake to a model and asking it to find logical flaws.
- Implementation Review: Spotting missing HMAC checks, nonce reuse, or weak random number generators in code.
- Exploit Explanation: Summarizing a complex CVE into an actionable remediation plan.
- Education: Generating interactive tutorials on Diffie-Hellman or elliptic curve math.
If you're building a research pipeline that needs to synthesize security findings from multiple sources, the architecture in Build a Multi-Agent Research Assistant That Plans, Searches, and Writes a Brief with Gemini provides a solid starting point for that kind of structured analysis, without ever touching raw ciphertext.
The boundary is clear: LLMs operate on human-interpretable representations. Ciphertext is not a representation; it's a physical transformation of bits. No amount of scaling changes this. It's not a limitation of current models; it's a category boundary.
FAQ
Q: Could an LLM trained specifically on AES plaintext-ciphertext pairs learn the algorithm? A: No. It could memorize the pairs you gave it, but it would fail on any unseen key. The function mapping is a pseudo-random permutation parameterized by the key. Without the key, the mapping is indistinguishable from a random function. The model would be a glorified lookup table, not a decryption oracle.
Q: What about quantum LLMs or neuro-symbolic approaches? A: Quantum computing threatens asymmetric crypto (RSA, ECC) via Shor's algorithm. Symmetric crypto like AES is quantum-resistant with a doubled key size (AES-256 is considered safe against Grover's algorithm, which only provides a quadratic speedup, reducing effective security to 128 bits). Neuro-symbolic systems still need a differentiable loss signal; AES provides none.
Q: Should I be worried about LLMs as an attack vector at all? A: Yes, but for different reasons. Prompt injection, data exfiltration via model outputs, and using LLMs to generate convincing phishing campaigns are real threats. The cryptographic primitives themselves are not the weak link.
Q: How does this relate to the FDE role? A: As an FDE, you're often the one explaining technical constraints to customers. Being able to authoritatively say "AES-256 is not vulnerable to AI-based decryption, and here's the mathematical proof" builds immense trust. It also helps you avoid wasting time chasing impossible features. For more on navigating these post-sale technical conversations, see How FDEs Work with Product and Engineering After the Sale Closes.
Want to build like a Forward Deployed Engineer?
FDE Coach is a cohort-based program in frontend, backend, AWS, and AI. Build real products and get referred to 200+ hiring partners.
Explore the program