Step 1 · Generate
Generate a CAPTCHA
Generated ASCII-grid CAPTCHA (low noise, 5 chars) — background is ., ink is #:
#####..###...###.....#..#...#.
#.....#...#.#...#...##..#...#.
#.....#...#.#..##..#.#...x.#..
####...####.#.#.#.#..#....#...
#.........#.##..#.#####...#...
#........#..#...#....#9...#...
#####.f##....###.....#....#...
Step 2 · Solve
Try to solve it
Pure-numpy template-matching solver: column segmentation → wide-run splitting → 5×7 glyph template matching.
Step 3 · Score
Score robustness
Runs the solver 30 times per difficulty level and measures the solve rate.
Step 4 · Explain
The adversarial lesson
This project is defensive research: we build a minimal solver to understand why
naive CAPTCHAs fail, so we can design stronger ones.
- Column segmentation: any empty vertical column splits the text into characters.
As long as characters do not touch, a solver just reads left to right.
- Template matching: a fixed 5×7 ASCII glyph font is enough when characters are
undistorted — each segment is compared pixel-for-pixel and the best glyph wins.
- Low noise: sparse background clutter (the low level) adds a handful of
stray characters that simple thresholding ignores.
- What makes CAPTCHAs robust: warping/rotation of glyphs, overlapping characters,
connected background noise, variable stroke widths, random gaps (turning column segmentation into a hard
segmentation problem), and font variation that defeats fixed template matching.
- What defeats even simple solvers: deformation that breaks the glyph template (e.g. eroded
strokes), heavy overlap so segments merge, and noise that mimics strokes.
- Beyond ASCII: real-world CAPTCHAs add color, curved lines, and segmentation-resistant
design. Modern defenses are ML-based and adversarially trained — the lesson here is that
security through fixed structure is fragile.
Ethical note: research into CAPTCHA weaknesses is defensive — its purpose
is to build stronger protections. Do not use these techniques to bypass any website’s protections.