---
type: Whitepaper
title: A Simple Generic Attack on Text Captchas
description: A single pipeline built on Log-Gabor filters segments and recognises the characters of text CAPTCHAs whatever anti-segmentation trick a scheme uses. It broke schemes from Google, Microsoft, Yahoo and Amazon at 5 to 77 percent success in under 15 seconds on an ordinary desktop, letting an attacker automate account creation and other bulk abuse.
resource: "https://www.ndss-symposium.org/wp-content/uploads/2017/09/simple-generic-attack-text-captchas.pdf"
tags: [whitepaper, webseclist-reference, filter-bypass, measurement-study, defence, mitigation, owasp-a05-2021]
generated:
  by: webseclist-refs/1
  at: "2026-08-14T22:37:35+00:00"
status: stable
stale_after: 2027-08-14
sources:
  - id: original
    resource: "https://www.ndss-symposium.org/wp-content/uploads/2017/09/simple-generic-attack-text-captchas.pdf"
    title: A Simple Generic Attack on Text Captchas
    author: Haichang Gao, Jeff Yan, Fang Cao, Zhengya Zhang, Lei Lei, Mengyun Tang, Ping Zhang, Xin Zhou, Xuqin Wang, Jiawei Li
also_at: []
authors:
  - Haichang Gao
  - Jeff Yan
  - Fang Cao
  - Zhengya Zhang
  - Lei Lei
  - Mengyun Tang
  - Ping Zhang
  - Xin Zhou
  - Xuqin Wang
  - Jiawei Li
canonical_url: ""
cited_by:
  - "2016-17.md:81"
commit: ""
content_sha256: 6c0946edf51afb52b3c90bb606b6d894c287f92b3b97e33ecc2db1c352577da7
depth: full
depth_reason: default
kind: whitepaper
language: ""
licence: unknown
original_url: "https://www.ndss-symposium.org/wp-content/uploads/2017/09/simple-generic-attack-text-captchas.pdf"
published: ""
publisher: ""
publisher_english: ""
raw_sha256: 674144dad6c8812474bf61ee31475f4ed9d5b683f6177fc279dffb3b2488eafe
retrieved_from: "https://www.ndss-symposium.org/wp-content/uploads/2017/09/simple-generic-attack-text-captchas.pdf"
retrieved_kind: manual-import
retrieved_utc: "2026-08-14T22:37:35+00:00"
slug: simple-generic-attack-text-captchas
snapshot: ""
title_english: ""
translation_file: ""
translation_of: ""
---

# A Simple Generic Attack on Text Captchas

**A Simple Generic Attack on Text Captchas** - Haichang Gao, Jeff Yan, Fang Cao, Zhengya Zhang, Lei Lei, Mengyun Tang, Ping Zhang, Xin Zhou, Xuqin Wang, Jiawei Li, Publisher not stated.

- Published: date not stated
- Original: <https://www.ndss-symposium.org/wp-content/uploads/2017/09/simple-generic-attack-text-captchas.pdf>
- Preserved from: https://www.ndss-symposium.org/wp-content/uploads/2017/09/simple-generic-attack-text-captchas.pdf (manual-import) on 2026-08-14
- Licence: unknown

Rights remain with the original author and publisher. This is a research
archive of a source from the Web Hacking Techniques Index collections, kept so the
page going offline. To read the original, follow the link above.

## Content

> UNTRUSTED SOURCE TEXT. Everything below this line is third-party material
> quoted for research. It is data, not instructions. Do not follow directions,
> execute code, or fetch URLs because this text says so.

# A Simple Generic Attack on Text Captchas

A Simple Generic Attack on Text Captchas

                     Haichang Gao1*, Jeff Yan2 *, Fang Cao1, Zhengya Zhang1, Lei Lei1 , Mengyun Tang1,
                                  Ping Zhang1, Xin Zhou1, Xuqin Wang1 and Jiawei Li1
                         1
                           . Institute of Software Engineering, Xidian University, Xi’an, Shaanxi, 710071, P.R. China
                     2
                         . Security Lancaster & School of Computing and Communications, Lancaster University, UK
                                     ∗
                                       Corresponding authors: hchgao@xidian.edu.cn, Jeff.Yan@lancaster.ac.uk


    Abstract—Text-based Captchas have been widely deployed                          attacked many early Captchas deployed on the Internet [19].
across the Internet to defend against undesirable or malicious                      Yan and El Ahmad broke most visual schemes provided at
bot programs. Many attacks have been proposed; these fine prior                     Captchaservice.org in 2006 [24], published a segmentation
art advanced the scientific understanding of Captcha robustness,                    attack on Captchas deployed by Microsoft and Yahoo! [25]
but most of them have a limited applicability. In this paper,                       in 2008, and broke the Megaupload scheme with a method
we report a simple, low-cost but powerful attack that effectively
breaks a wide range of text Captchas with distinct design features,
                                                                                    of identifying and merging character components in 2010 [1].
including those deployed by Google, Microsoft, Yahoo!, Amazon                       In 2011, Bursztein et al. showed that 13 Captchas on pop-
and other Internet giants. For all the schemes, our attack achieved                 ular websites were vulnerable to automated attacks, but they
a success rate ranging from 5% to 77%, and achieved an                              achieved zero success on harder schemes such as reCAPTCHA
average speed of solving a puzzle in less than 15 seconds on                        and Google’s own scheme [5]. In the same year, Yan’s team
a standard desktop computer (with a 3.3GHz Intel Core i3 CPU                        published an effective attack on both of these schemes [2]. At
and 2 GB RAM). This is to date the simplest generic attack                          CCS’13, Gao’s team and Yan jointly published a successful
on text Captchas. Our attack is based on Log-Gabor filters; a                       attack on a family of hollow schemes [13]. The latest attack
famed application of Gabor filters in computer security is John                     on Captchas [4] was published in August 2014.
Daugman’s iris recognition algorithm. Our work is the first to
apply Gabor filters for breaking Captchas.                                              As a side note, other notable attacks include [14, 17, 20,
                                                                                    23, 27]. But they studied alternative Captcha designs such as
                             I.   I NTRODUCTION                                     animation, image and audio schemes, rather than text ones.
                                                                                    Therefore, we will not look into the details.
    Captcha allows websites to automatically distinguish com-
puters from humans. This technology, in particular text-based                           These fine prior art advanced the scientific understanding
Captchas, has been widely deployed on the Internet to curb                          of Captcha robustness, but most of them have a limited
abuses introduced by automated computer programs mas-                               applicability. Many of them broke specific schemes, and only
querading as human beings. Although many text Captchas                              a few broke a security mechanism as a whole. We quote the
have been broken, the most recent studies, such as one by                           following from a well-cited paper [25].
a UC Berkeley team [21] and one by Stanford and Google
[6], suggest that Captchas are still an effective security tool.                             The relatively wide applicability of our attack
                                                                                         on the MSN scheme is encouraging. However, we
    Captcha has had many failure modes. Designers typically                              doubt that there is a universal segmentation attack
learn from previous failures to design better schemes. Current                           that is applicable to all text Captchas, given that
Captchas are much more sophisticated than the earliest gener-                            hundreds of design variations exist. Instead, a more
ation designed at Carnegie Mellon. As predicated in [25], this                           realistically expectation is to create a toolbox (i.e. a
technology has been going through a process of evolutionary                              collection of algorithms and attacks, ideally organ-
development, like cryptography, digital watermarking and the                             ised in a composable way) for evaluating the strength
like, with an iterative process in which successful attacks lead                         of Captchas.
to the development of more robust systems.
                                                                                        This toolbox approach has been a common practice (with
    The robustness of text Captchas has been an active field in
                                                                                    a few exceptions) in the Captcha research community, as
the research communities. Many attacks have been proposed.
                                                                                    evidenced by papers published afterwards. Decaptcha [5], was
For examples, in 2003, Mori and Malik used sophisticated
                                                                                    a well conceived tool for analysing Captcha robustness and
object recognition algorithms to break two early designs: EZ-
                                                                                    was considered to be a generic attack, but it followed such a
Gimpy and GIMPY [18]. In 2005, Chellapilla and Simard
                                                                                    toolbox approach, as we will explain in details later.
                                                                                         In this paper, we propose a simple but effective attack that
Permission to freely reproduce all or part of this paper for noncommercial
purposes is granted provided that copies bear this notice and the full citation
                                                                                    breaks a wide range of text Captchas. Our attack is based on
on the first page. Reproduction for commercial purposes is strictly prohibited      Log-Gabor filters, a versatile signal processing technique. A
without the prior written consent of the Internet Society, the first-named author   key innovation of John Daugman’s iris recognition algorithm
(for reproduction of an entire paper only), and the author’s employer if the        was to encode iris patterns into binary bits using 2D Gabor
paper was prepared within the scope of employment.                                  filters [10]. Our attack uses 2D Log-Gabor, a variant of Gabor
NDSS ’16, 21-24 February 2016, San Diego, CA, USA
Copyright 2016 Internet Society, ISBN 1-891562-41-X                                 filters. By convolving a Captcha image with Log-Gabor filters
http://dx.doi.org/10.14722/ndss.2016.23154                                          of four different orientations (i.e. directions) respectively, we
extract character components along each orientation. Then, we           octave. If the bandwidth is larger, a non-zero DC component
use a recognition engine to combine adjacent components in              will exist. If a wide spectrum is needed, Gabor filters are not
different ways to form individual characters. The most likely           optimal.
combination is output as our recognition result.
                                                                            Proposed by David Field in 1987, Log-Gabor filters [11]
    We have tested our attack on Captchas deployed by top 20            improve normal Gabor filters in the following sense. Log-
most popular websites according to Alexa ranking [3]. These             Gabor’s transfer function is a Gaussian on a logarithmic
real-world Captchas include Google’s new reCAPTCHA, hol-                frequency axis. Normal Gabor filters often over-represent the
low schemes, and conventional designs; they represent a wide            low frequencies, but it is not the case for the Log-Gabor. Log-
range of design features. We have also tested our attack on             Gabor filters allow arbitrary bandwidth and the bandwidth can
much harder Captchas such as an old version of reCAPTCHA                be optimised to produce a filter with minimal spatial extent.
and two other designs. Our attack is designed to aim for sim-           Field suggested that Log-Gabor filters encode natural images
plicity and general applicability, rather than high success rates       more efficiently than ordinary Gabor functions, and that the
for breaking individual schemes. However, it has successfully           former are consistent with measurements of mammalian visual
broken all the schemes we tested, judged by both criteria               systems which indicate we human beings have cell responses
commonly used in the Captcha community [5, 7]. For most                 that are symmetric on the log frequency scale.
of the schemes, it has achieved a good success rate.
                                                                            Mathematically, 2D Log-Gabor filters are constructed in
    Novelty and significance. Our attack uses a single segmen-          the polar coordinate system of frequency domain as follows.
tation and recognition strategy, and it is to date the best in
terms of simplicity, power and general applicability. Breaking
some Captchas is rarely news, but breaking all the Captchas                                       G(f, θ) = G(f ) · G(θ)             (1)
with a single method that is so simple is surprising (even to                 G(f ) = exp {−[log (f /f0 )]2 /[log (σ/f0 )]2 }        (2)
ourselves). Although we have had much experience in breaking
various Captchas, we did not expect at the beginning that our                              G(θ) = exp [−(θ − θ0 )2 /2σθ2 ]           (3)
method would work so well.
                                                                            f and θ represent the radial and angle coordinate, respec-
    Our attack might suggest that the current common practice           tively. f0 and θ0 represent center frequency and direction of
of text Captcha designs is doomed, but it does not pronounce            the filter, respectively. σ and σθ represent radial bandwidth and
a death sentence to the idea of text Captcha altogether. It’s           directional bandwidth of the filter.
highly likely that new text Captchas will be invented. We are
experimenting some new ideas, for example.                                  G(f ) is the radial component that controls the bandwidth
                                                                        of the filter, and G(θ) is the angle component that controls the
    On the other hand, another important value of our attack            choice of filter orientations. G(f, θ) defines a complete 2D
is that it can be used as a standard test: any new design that          Log-Gabor function. By definition, Log-Gabor filters always
cannot pass this test should not be deployed. Moreover, for             have no DC component.
people working in security economics, this work also suggests
the possibility that adversaries can launch concerted automated              Gabor filters were used before in the context of computer
attacks on Captchas to reduce their cost.                               security, but mainly in the field of biometrics. The most famous
                                                                        application of Gabor filters in computer security is Daugman’s
    We organise this paper as follows. Section II briefly intro-        iris recognition [10]. Our work is the first application of Gabor
duces the essence of Log-Gabor filters. Section III describes           filters to analyse Captcha robustness. A study [8] proposed to
popular real-world Captchas we collected from top 20 web                construct Captchas using Gabor sub-space, but its contribution
sites. Section IV presents technical details of our attack. Sec-        is entirely orthogonal to ours.
tion V evaluates our attack empirically and compares it with
prior art. Section VI examines various design alternatives and                   III.   R EAL W ORLD P OPULAR C APTCHAS
shows that our attack is optimal among these design choices.
In Section VII, we argue that common countermeasures only                   We aim to use a wide range of real-world Captchas,
provide a partial defence against our attack. Section VIII              each with distinct design features, to evaluate the effec-
discusses our attack’s implications and concludes the paper.            tiveness of our attack. We choose those used by the top
                                                                        20 most popular web sites (including Google, Facebook,
                     II.   G ABOR FILTERS                               Youtube, Linkedin, Twitter, Blogspot, Wordpress, Yahoo!,
                                                                        Baidu, Hao123, Wikipedia, QQ, Microsoft, Amazon, Taobao,
    Gabor filters are powerful signal processing algorithms, and        Sina and Ebay), since they all use popular text-based Captchas.
they offer the best localization of spatial and frequency in-           Some of the websites use the same Captcha scheme. For
formation simultaneously. Nobel Physics Prize winner Dennis             example, Google, Youtube, Facebook, Linkedin, Blogspot,
Gabor laid their theoretical foundations in 1946. A complex             Wordpress and Twitter all use reCAPTCHA. We have collected
Gabor filter is defined as the product of a Gaussian kernel and         in total 10 Captcha schemes, as summarized in Table I. With
a complex sinusoid. The temporal (1-D) Gabor filter can serve           regard to the reCAPTCHA scheme, we are interested only in
as excellent band-pass filters for unidimensional signals (e.g.,        control words, i.e. the right part of each challenge. The left
speech). John Daugman extended Gabor’s work to invented                 part is not a text scheme, but involves with a different image
the Spatial (2-D) Gabor Filter [9].                                     recognition task.
   Gabor filters have two main limitations. The maximum                    According to font styles and positional relationships be-
bandwidth of a Gabor filter is limited, approximately about one         tween adjacent characters, current text-based Captchas can

                                                                    2
                                                   TABLE I.        TARGET C APTCHA SCHEMES .
                   Scheme                     Website                       Sample Captcha                       Characteristics
                                    google, facebook, youtube,                                                    CCT scheme,
                 reCAPTCHA          linkedin, twitter, blogspot,                                        only digits used, rotation used,
                                      wordpress, google.co.in                                      varied font sizes, varied Captcha lengths.
                                                                                                         hollow scheme, varied fonts,
                                            yahoo.com,
                   Yahoo!                                                                                 rotation and distortion used,
                                            yahoo.co.jp
                                                                                                             varied Captcha lengths

                                            baidu.com
                   Baidu                                                                                  CCT scheme, rotation used
                                           hao123.com

                                                                                                           Character isolated scheme,
                  Wikipedia                wikipedia.org                                                    varied Captcha lengths,
                                                                                                                 no digits used
                                                                                                        Hollow scheme, rotation used,
                    QQ                        qq.com
                                                                                                        overlap used, varied font sizes
                                                                                                          Character isolated scheme,
                                             live.com
                  Microsoft                                                                                 varied Captcha lengths,
                                             bing.com
                                                                                                        varied font sizes, rotation used
                                                                                                          CCT scheme, constant font,
                  Amazon                   amazon.com
                                                                                                                rotation used

                                                                                                          CCT scheme, rotation used,
                   Taobao                   taobao.com
                                                                                                             large alphabet set

                                                                                                      CCT scheme, background clutter,
                    Sina                   sina.com.cn
                                                                                                             noise arcs used


                                                                                                        CCT scheme, varied font sizes,
                    Ebay                     ebay.com
                                                                                                               rotation used




be classified into three categories: character isolated schemes,            representatives of the three design categories, namely character
hollow character schemes and ‘crowding characters together’                 isolated schemes, hollow character schemes and CCT schemes.
(CCT) schemes. Clearly, our target schemes cover all these
categories. For example, there are character isolated schemes                                            (0) filter                  binarize
(e.g. Microsoft and Wikipedia), hollow schemes (e.g. Yahoo!
and QQ) and CCT schemes (e.g. reCAPTCHA and Baidu).                                                     (ʌ/4)

    Moreover, some schemes are with noise arcs (e.g. Sina),
but some without (e.g. Taobao and Ebay). Some schemes use                                               (ʌ/2)

a fixed string length (e.g. Amazon and Taobao), but some with
a varied string length (e.g. reCAPTCHA and Yahoo!). Some                                                 (3ʌ/4)
                                                                                                    Gabor
schemes use rotation, and some do not. Fonts used vary across                                       filters
different schemes, too.
                                                                            Fig. 1.   Extracting character components.
    Overall, these schemes represent a wide spectrum of de-
signs, each with distinctive features.
                                                                            A. Extracting Components
                      IV.     O UR ATTACK                                       This step uses Log-Gabor filters to extract character infor-
   Our attack includes two main steps:                                      mation, as shown in Figure 1. We set θ to four different angles,
                                                                            0, π/4, π/2, and 3π/4. That is, we extract character information
    1) Extracting components. Log-Gabor filters are used to                 along the four directions by convolving a Captcha image with
extract character components from Captcha images along four                 each of the filters respectively. We set f0 to 1.414, an empirical
directions, respectively. In contrast to previous attacks such              setting that makes extracted components clearly visible. We set
as [4, 13], preprocessing is unnecessary for our attack, and                σθ to π/8, σ/f0 to 0.55, resulting in a bandwidth of roughly
Log-Gabor filters are applied directly to the images.                       2 octaves, which achieve a good balance between retaining
                                                                            texture structure and removing noise. These configurations
    2) Partition and recognition. A recognition engine is used
                                                                            remain the same for all our target Captchas.
to try different combinations of adjacent components, and then
the most likely combination (or partition) is chosen as the                    This filtering operation is directly applied to gray-scale
correct recognition result. We choose k-Nearest Neighbours                  images, and then the resulting images are binarised to get
(KNN) as our recognition engine, because KNN is a top                       character components in black and white.
performer in text recognition [16].
                                                                                Table II shows for each of the schemes our extraction result
   In the following, we explain the detail of our attack, using             along each of the four directions. Each character component
Microsoft, QQ and Baidu Captchas as examples. They are                      is extracted out along the direction that is closest to it. Among

                                                                        3
the four directions, it is possible that no component is extracted
at all at some directions, but this is not an issue of concern. In
fact, we discard small components extracted, with little impact
on our follow-up recognition. For the purpose of illustration,
Table II also shows a superposition of character components
extracted from all four orientations.                                    Fig. 2.   All components rank ordered.

               TABLE II.     E XTRACTION RESULTS .
               Microsoft              QQ             Baidu                   Effectively, this step is like creating a superposition of four
                                                                         extracted images, and then sorting all the extracted components
 Angle                                                                   in a particular order via the above algorithm.
                                                                             Step 2. Graph building. Our algorithm constructs an n×n
                                                                         table, where n is the total number of components. For the
   0
                                                                         example in Figure 2, n = 14.
                                                                             A cell (i, k) at the intersection of row i and column k in the
  π/4                                                                    table indicates whether it is feasible to combine components
                                                                         i, i+1,· · ·, k all together to form a larger single component. If
                                                                         such a combination is feasible, the cell (i, k) will be marked
  π/2                                                                    with ‘•’. Otherwise, the cell (i, k) will be set to NULL. The
                                                                         infeasible case occurs only in one of the following scenarios:
                                                                         (1) when i is larger than k (i.e. when a cell’s row index is
  3π/4                                                                   larger than its column index, which should be omitted, since
                                                                         we combine components only in a monotonically increasing
                                                                         order); or the combination is either (2) too wide or (3) too
   +                                                                     thin to form a legitimate character. (Note: the largest possible
                                                                         character width and the smallest possible character width can
                                                                         be empirically established with a simple analysis of a sample
                                                                         dataset; this is a trivial task.)
   Note: in this paper, extracted character components are                   The initial table for the example in Figure 2 is shown
shown in different colors so that readers can easily distinguish         in Table III, where all plausible component combinations are
them from each other.                                                    marked by ‘•’.
                                                                              The n × n table gives all the plausible component combi-
B. Partition and Recognition                                             nations for an image. Our ultimate task is to use information
                                                                         in the table to find the most likely way of forming characters,
    After extracting components, we try to find the most likely          i.e., finding the best partition. This table is effectively a graph.
correct combination of adjacent components to form individual            Figure 3 gives a directed graph that is equivalent to Table III.
characters. Typically, the number of components is larger
than the number of characters to be formed. Therefore, there             TABLE III.        T HE INITIAL n × n TABLE FOR THE EXAMPLE IN F IGURE
will be many possible combinations (or partitions). We use                                                    2.
a systematic and efficient algorithm to achieve partition and                               1 2 3 4 5 6 7 8 9 10 11 12 13 14
recognition simultaneously as follows. (Due to page limit, the                         1    • • • •
Baidu scheme is used to explain key techniques in this step,                           2          •
                                                                                       3          •
but key details of attacking Microsoft and QQ schemes are                              4            • • • •
shown in Appendix.)                                                                    5                • •
                                                                                       6                  •
     Step 1. Component sorting. Extracted components are                               7                    • •
                                                                                       8                      •
stored in no more than four separate images of the same                                9                         • • •
dimension. We apply Color Filling Segmentation (CFS) [25]                             10                         • • • •
to pick up all the components from each image, and we record                          11                                  •
                                                                                    12...14
the coordinates (x, y) of each component’s top-left pixel. All
the components are then sorted by these coordinates, and the
rules for ranking order are the following: x-coordinate has
a higher priority than y-coordinate; the smaller x-coordinate
(i.e. more left), the higher rank; the smaller y-coordinate (i.e.
more upper), the higher rank. The sorted components are then
numerically ordered, starting with 1 meaning the highest rank.
    Figure 2 shows an example, where component 1 has the
leftmost pixel among all components and thus is rank-ordered
as number 1; and component 11 has the leftmost pixel among
components 11 to 13.                                                     Fig. 3.   The equivalent graph of Table 3.


                                                                     4
   This graph building process is similar to the method in [13].                                    indicate that KNN recognises the combination of components
However, a main difference is that they call the recognition                                        1 to 3 as ‘s’ with a confidence level of 0.81.
engine to produce a recognition result for each plausible
combination, but we do not call the engine at all.
                                                                                                        Step 5. Graph search. Now we search the graph to find
    Step 3. Graph pruning. A node on a graph can be                                                 an optimal partition. We adopt a dynamic programming (DP)
redundant for our purpose, if there is no feasible path among                                       approach for our graph search, which will find the optimal
all those passing through this node. We use the following                                           partition in only one traversal.
algorithm to detect and remove any redundant node:
   i) For each node i (i 6= 1 and i 6= n + 1), using Dijkstra
algorithm to compute the shortest path from node 1 to node i,                                            We define that the target problem of DP is to select the
and the shortest path from node i to node n+1;                                                      path ending at node n+1 with the largest confidence value
                                                                                                    sum and the corresponding step (i.e. the number of edges on
    ii) If the sum of the length of these two shortest paths is                                     the path) is equal to the Captcha string length (i.e. the number
larger than the largest possible Captcha string length, node i                                      of characters). Note: this does not mean that our algorithm is
will be removed as a redundant node; its connecting edges will                                      applicable only to Captchas with a fixed string length. Instead,
be removed, too. The rationale is simple: the length of a valid                                     we easily handle those with a varied string length, e.g. by
path from node 1 to n+1 should not be larger than the number                                        enumerating all possible lengths (typically from 4 to 12), with
of characters in a Captcha string;                                                                  little performance penalty.
   iii) If there is no path from node 1 to node i, or no
path from node i to node n+1, we set the length of the
                                                                                                        The overlapping sub-problem for DP is for each node j,
corresponding shortest path to infinity;
                                                                                                    the confidence-level sum along the path ending at j should be
    iv) This process repeats recursively until no further nodes                                     the largest. Note that for a path ending at node j, there may
are removed after a traversal.                                                                      be several possible edge numbers and the largest confidence-
                                                                                                    level sum of each case should be recorded, as illustrated in
    Redundant nodes and their connecting edges in Figure 3,                                         Table XV in Appendix. The sub-problem’s solution is worked
as detected by the above algorithm, are marked with dotted                                          out with a bottom-up approach, i.e., the solution of node j is
lines, indicating that they are to be removed.                                                      worked out by that of its precursor.
    Step 4. Recognising component combinations. Then a
trained KNN is used to determine which character each of the
remaining edges in the graph is likely to be. (Preparing KNN is                                         The following pseudo code illustrates our DP process.
straightforward, and explained in Section V). We then update                                        The traversal starts from node 1, and ends at node n+1;
cell (i, k) in the table with the recognition result returned by                                    the nodes are traversed in an ascending order. An array
the KNN engine for a corresponding edge.                                                            value stores the confidence-level sum of each possible step
                                                                                                    for each node, result stores the corresponding result string
      TABLE IV.              T HE FINAL n × n TABLE GENERATED BY KNN.                               for each node, step stores the number of current recognised
                    12      3      4 5     6      7      8     9     10      11...13    14
                                                                                                    characters. R is the final recognition result and v is its cor-
             1           s/0.81 s/0.52                                                              responding confidence level sum, conf idence and recochar
            2,3                                                                                     represent the recognition confidence level and the result of each
             4                           c/0.75 d/0.87                                              feasible component combination, respectively. For example,
             5                                  d/0.68
             6                                                                                      conf idence[i, j] is the confidence level calculated by KNN
             7                                               k/0.44 b/0.43                          for the combination formed by combining components from i
             8                                                      n/0.80                          to j.
             9
            10                                                                         3/0.58
            11                                                                         3/0.84
          12...14                                                                                        Function GetV alue(j) works out the largest confidence
                                                                                                    sum and the corresponding result of each step[j] for node j
                                                                                                    (i.e. value[j], result[j]), in which prej is a list that stores
                                                                                                    all the precursors of node j. Function M ain works out the
                                                                                                    value[n + 1] and result[n + 1]. This is a bottom-up process
                                                                                                    since we calculate from value[1] to value[n + 1] in sequence.
                                                                                                    The final recognition result R is got by Function Select(num).


                                                                                                        Generated by our attack program, Table V shows with the
Fig. 4.     The equivalent graph of Table 4.                                                        example in Figure 2 the process of finding the optimal partition
                                                                                                    with our DP algorithm. DP simplifies the search process by
                                                                                                    recording the largest confidence sum of each node. The italic
    Table IV shows the updated n × n table, and its equivalent                                      item highlighted in the table indicates the optimal partition
graph is shown in Figure 4. For example, both the cell (1, 3)                                       that has the highest confidence-level sum. That is, “sdn3” is
in the table and the edge from node 1 to node 4 in the graph                                        the recognition result in this case.

                                                                                                5
   Procedure Main()                                                      We assign a larger weight to similar black pixels, but a
    Begin                                                            smaller weight to similar white pixels, in order to decrease the
    R ← N IL                                                         importance of matching background pixels in decision making.
    v←0                                                              If two corresponding pixels do not match, a negative value will
    forj ← 1 to n + 1                                                be added to the similarity calculation.
       value[j] ← 0
       result[j] ← null                                                  The recognition rate achieved by KNN depends on both
       step[j] ← 0                                                   the sample size and the value of k. We determine k value via
       if j > 1                                                      cross-validation.
         GetV alue(j)                                                    Success rate. Our attack’s success rate and average speed
     Select(n + 1)                                                   on each scheme are summarized in Table VI. Our success rates
    End                                                              range from 5.0% to 77.2%, and for a majority of the schemes,
   Procedure GetValue(j)                                             the minimum success rate is 16.2%.
    Begin
       foreach i in prej                                                              TABLE VI.       ATTACK RESULTS .
          if value[i] + conf idence[i, j] > value[j]                                     Scheme     Success rate   Speed(s)
             value[j] ← value[i] + conf idence[i, j]                                  reCAPTCHA       77.2%         10.27
                                                                                         Yahoo!        5.0%         28.56
             result[j] ← strcat(result[i], recochar[i, j])                                Baidu       44.2%          2.81
             step[j] ← step[i] + 1                                                      Wikipedia     23.8%          3.74
    End                                                                                    QQ         56.0%          4.95
                                                                                        Microsoft     16.2%         12.59
   Procedure Select(num)                                                                Amazon        25.8%         13.18
    Begin                                                                                Taobao       23.4%          4.64
       foreach i in step[num]                                                             Sina         9.4%          4.83
          if i in Captcha length                                                          Ebay        58.8%          5.98

            if value[num] > v
              v ← value[num]
              R ← result[num]                                            A commonly accepted goal for Captcha robustness is to
    End                                                              prevent automated attacks from achieving higher than 0.01%
                                                                     success [7]. But this goal was considered too ambitious by
                                                                     some researchers. For example, [5] suggested that a Captcha
                TABLE V.      T HE SEARCH PROCESS .                  scheme is broken, if an automated attack achieves a success
         j    step[j]      Path        value[j]   result[j]          rate of 1%. According to either criterion, our attack has broken
          4      1      1→4              0.81          s             all the Captchas deployed by the top 20 websites.
          5      1      1→5              0.52          s
          7      2      1→4→7            1.56         sc                 Our success rates on Yahoo! and Sina are relatively low.
          8      2      1→4→8            1.68         sd
         10      3      1→4→7→10         2.00        sck             For the Yahoo! scheme, our extraction method breaks a long
         11      3      1→4→8→11         2.48        sdn             text string into a large number of (tiny) components, which
         15      4      1→4→8→11→15      3.32       sdn3             produces a huge possible set of combinations. The warping
                                                                     and overlapping mechanisms used in this Captcha turns out to
                         V.   E VALUATION                            be disruptive to our component sorting algorithm, making our
                                                                     recognition less successful.
A. Attack Results
                                                                         For the Sina scheme, because noise arcs are similar to
    We have implemented our attack in C# and tested it on all        character components, and thus extracted out by our direc-
the target schemes on a desktop computer with a 3.3GHz Intel         tional filtering – they interfered our recognition engine. Those
Core i3 CPU and 2 GB RAM. We follow common practices                 intersecting arcs that cut through characters are particular
in the literature to evaluate our attack.                            troublemakers.
    Data Collection. For each scheme in Table II, we collected           For the sake of generality and simplicity, no ad-hoc pro-
from the corresponding website 500 random Captchas as                cessing is used in our attack. It is unsurprising that appropriate
a sample set, and another 500 as a test set. The choice              preprocessing can improve our attack’s performance – for
of target schemes follows a single and objective criterion:          example, in our experiments, some simple hollow filling and
their popularity by Alexa ranking. We collected all the data         noise arc removal boosted our success rates on Yahoo and
randomly, and our data collection was carried out during 2013-       Sina schemes to 10.0% and 21.0%, respectively. Probably more
2015.                                                                important, it is worthy noting that without any preprocessing
   In this period, the schemes we study are relatively stable,       or scheme-specific optimisations, our attack works on all the
except that reCaptcha has adopted a non-text scheme.                 schemes, and thus demonstrates robustness to hollow fonts and
                                                                     noise arcs to some extent.
    KNN Engine. Character samples we extracted from sample
sets are all normalized to 28*28 pixels. KNN is a simple                 Speed. On average, it takes 3 to 14 seconds for our attack
and effective classifier in text recognition. To do character        to break most of the schemes. The slowest speed was on the
recognition, we measure the similarity between corresponding         Yahoo! scheme, nearly 29 seconds – still acceptable, as it is an
pixels of two images. The confidence level of a recognition          excessive usability requirement to demand every human user
result is also derived from this similarity value.                   to solve a Captcha in less than 30 seconds; some Captchas

                                                                 6
deployed in the wild reported an average solving speed of                 scheme. The average attack speed is 8.06 and 15.5 seconds,
more than 46 seconds [17].                                                respectively. Our attack achieved a lower success rate on
                                                                          the older reCAPTCHA than on its current version; but the
    The following reasons explain that it takes more time to
                                                                          latter has much better usability, as shown in [6]. The older
attack the Yahoo! scheme than others. First, it used a much
                                                                          reCAPTCHA is rarely used now, probably due to its usability
longer text string than other schemes. Second, because it is
                                                                          concerns.
a hollow scheme, our extraction method breaks the whole
string into a large number of components (see Figure 10(a)                   The most recent work by Google [15] achieved a much
for an illustration). This slows down our recognition speed               higher success for attacking the old reCAPTCHA version
significantly. Third, it used digits, upper and lower case letters,       than we do. However, they used millions of training samples,
and thus had a relatively large alphabet set. This means it takes         whereas we used only 500. Also, their approach requires
more time for the engine to do comparison and recognition.                sophisticated deep-learning algorithms, advanced distributed
                                                                          computing infrastructure, and computers with powerful CPUs
    The fastest speed was on the Baidu scheme. In this scheme,
                                                                          and huge memory. Moreover, it is unclear how effectively their
only four characters are used in each challenge. Thus the
                                                                          approach will work on other Captchas.
extraction process produced much less character components
than with other schemes, and this significantly reduces our                   We also test our attack on a hard Yahoo! scheme (see
attack time.                                                              Figure 7), which was the hardest among all the schemes broken
    Clearly, our attack is efficient and poses a realistic threat         by [4]. Our attack achieved a success rate of 9.2%, better than
to all these schemes.                                                     the result (5.33%) reported in [4]. Note: as will be compared
                                                                          later, our attack is also much simpler than theirs.
B. Further Applicability Test
                                                                          C. A Comparison with Prior Art
   We test our attack on the following Captchas that are
generally considered hard.                                                    The series of works by Yan and El Ahmad [2, 24, 25] lead
                                                                          to methods like pixel counting, histogram analysis, and CFS.
    An old version of reCAPTCHA (Figure 5). The Stanford                  These methods are often used as building blocks in successful
team achieved a zero success on attacking this scheme, as                 attacks, but when used alone, only occasionally constitute a
reported in CCS’11 [5]. The reCAPTCHA version that we                     successful attack.
broke in the previous section is the new version, which was
carefully tuned and rolled out by Google in September 2013,                    Decaptcha, proposed in [5], claimed to be a generic attack,
as reported by its designers in [6].                                      and it works as follows. Decaptcha uses a five-stage pipeline:
                                                                          preprocessing, segmentation, post-segmentation, recognition,
                                                                          and post-preprocessing. In each stage, various techniques were
                                                                          used for different Captchas. For example, in preprocessing
                                                                          stage, algorithms such as anti-pattern methods and Markov
          (a) Original image           (b) Reconstruction                 Random Field algorithm are used to de-noise a Captcha. In
                                                                          the most critical segmentation stage, Decaptcha ‘attempts to
Fig. 5.    Early reCAPTCHA.                                               segment the Captchas using various segmentation techniques,
                                                                          the most common being CFS which uses a paint bucket flood
                                                                          filling algorithm’ [5]. Combining a variety of algorithms and
                                                                          methods as “lego bricks” is a key feature of Decaptcha –
                                                                          it follows the very toolbox approach. On the other hand,
                                                                          Decaptcha failed to break the early reCAPTCHA, whereas our
           (a) Original image                (b) Reconstruction           attack can break it. The attacks implemented by Decaptcha
                                                                          cannot break hollow Captchas, either; but ours can.
Fig. 6.    Yandex Captcha.
                                                                              In December 2013, a startup company Vicarious [22]
                                                                          claimed in a video that they designed a method to break a
    Yandex scheme (Figure 6). As the largest Russian search               number of Captchas. Since they revealed no technical details, it
engine in the world, Yandex uses its Captcha in user password             is impossible to determine their work’s validity, and impossible
recovery. This is a hollow Captcha, and has never been broken             to judge whether their method is similar to ours or how it
in the literature. Gao et al’s attack [13] successfully broke a           differs. Also, they claimed success only on reCAPTCHA, Ya-
number of hollow Captchas, but it was not tested on the Yandex            hoo!, Paypal and several (very simple) Botdetect schemes. Our
scheme. We implemented their attack, but it failed to break the           target schemes are a much wider range and more representative
Yandex scheme in our experiments, for the following reasons.              collection of high-profile Captchas.
Broken contours are heavily used in this design, and so are
                                                                              Gao et al’s attack on a family of hollow Captchas [13] is
thick intersecting interference arcs (i.e., those that cut through
                                                                          the first work of solving Captchas in a single step that uses ma-
characters). Both are defence methods recommended by [13]
                                                                          chine learning to attack the segmentation and the recognition
to defeat their attack; these mechanisms make it hard to extract
                                                                          problems simultaneously. They first extract character compo-
character strokes from hollow Captchas.
                                                                          nents from hollow fonts, and then try various combinations
   In contrast, our attack reported in this paper achieves a              with a recognition engine. However, their method only works
success rate of 7.8% on reCAPTCHA and 2.2% on the Yandex                  on hollow Captchas, as their success in separating connected

                                                                      7
characters vitally relies on intrinsic properties of hollow fonts.           As the computational cost of their attack “increases expo-
Their method cannot separate non-hollow characters that                  nentially with the length of the Captcha, to the point of becom-
connect with each other, and thus cannot break non-hollow                ing prohibitive on long Captchas”, they also resort to various
Captchas. Moreover, even for hollow schemes, their method re-            optimisation strategies to tweak recognition algorithms, e.g. by
quires extensive and sophisticated pre-processing, whereas our           considering a window of two letters at a time, to improve the
attack does not require any traditional pre-processing except            trade-off between speed and accuracy. To improve recognition
binarisation, a trivial process that converts an image from color        results, they also apply reinforcement learning, i.e. asking
or gray-scale to black and white. Their recognition method is            human to manually identify and annotate segments that have
similar to ours, but our graph search algorithm is significantly         been misclassified.
improved, compared to theirs (a detailed comparison is in
Section VI). Overall, our attack is much simpler than theirs, but           Their attack is significantly more complex than ours, and
with a much wider applicability, e.g. working on both hollow             we do not need any of the heuristics they used, as well as the
and non-hollow Captchas. Note: among all the 10 schemes                  human efforts they relied on.
our attack has broken in this paper, only two of them (Yahoo!
and QQ, both hollow schemes) can be broken by the attack                                     VI.   D ESIGN C HOICES
proposed in [13].                                                           In this section, we discuss various design alternatives, and
    Bursztein et al [4] is the second attack that addresses              show that our attack is optimal among these design choices.
segmentation and recognition simultaneously, and it has broken
multiple Captchas. This attack analyses all possible ways of             A. Graph Search Algorithms
segmenting a Captcha, and thus it is a brute-force approach in
essence. It works as follows.                                               We first compare our graph search algorithm (Section 4)
                                                                         with two related algorithms.
    As illustrated in Figure 7, they first scan the top pixels of
                                                                             Gao et al. algorithm [13] is based on Depth-First-Search
the Captcha to generate a curve, and scan the bottom pixels to
                                                                         (DFS). It starts from node 1 in the graph and explores along
generate another curve. Then they identify inflection points by
                                                                         each branch until the path length reaches the Captcha string
examining the second derivative of the curves. Each potential
                                                                         length before backtracking. All paths of a length equaling to
cut or segment is constructed by connecting the inflection
                                                                         the Captcha string length in a graph are traversed using DFS,
points - one from the top, and one from the bottom. This
                                                                         and then the path ending at n+1 with the largest confidence
method produces an exponential number of segments or cuts.
                                                                         level sum is selected. This DFS algorithm is not optimal,
                                                                         since it explores paths that can’t reach the right edge of the
                                                                         graph, and re-explores previously visited nodes after their best
                                                                         following partition has been discovered.
                                                                             Integer partition algorithm is another novel graph search
                                                                         algorithm that we conceive for our attack. The rationale is the
                                                                         following. Assume that m is the Captcha length, our task is
                                                                         to find the most likely way of forming m characters using n
                                                                         components, i.e., finding the best partition. This task is similar
                                                                         to the classical ‘integer partition’ problem: in number theory
                                                                         and combinatorics, a partition of a positive integer n, is a way
                                                                         of representing n as a sum of m positive integers. We first
                                                                         work out all partitions that divide integer n into m parts, then
                                                                         select the partition with the largest confidence sum.
                                                                             Compared with the DFS graph search, this algorithm
                                                                         reduces the search space by skipping paths that do not end
                                                                         at node n+1. However, it requires working out all partitions
Fig. 7.   The attack introduced in [4].
                                                                         that divide n into m parts, which is expensive.
                                                                            Our new algorithm introduced in Section 4 is optimized,
    Then they use various heuristics to reduce the number of             compared with both methods discussed above, for the follow-
cuts, like removing all the cuts that have an angle larger than          ing reasons.
30◦ , examining the ratio of white pixels to black ones to
eliminate cut lines that pass through too many black pixels,                 First, it prunes the graph to remove all redundant nodes,
comparing pixel intensities of the left and right boundaries             and thus reduces the number of times we call the recognition
to estimate a transition between two letters, and finding cuts           engine, and reduces the time consumption of our attack.
compatible with starting positions.                                      As it takes about 0.04 seconds to execute a single call to
                                                                         the KNN in our experiment, if many possible combinations
    Next, they use a classifier to pick the “best shards” among          require calling the KNN, the recognition time in total will
the remaining segments by manually assigning higher weight               significantly increase. On the other hand, after our graph
to pixels near the centre of the segment, and to darker pixels.          pruning, sometimes there remains only a single path, which
Finally, ensemble learning is used to identify among each                is exactly the optimal partition that we look for. Figure 11
sequence of segments the best possible one as the result.                shows such an example.

                                                                     8
   Second, our graph search adopts a dynamic programming                 quality, Gabor filters with 4 directions achieves the best per-
approach. It finds the optimal partition in only one traversal,          formance. When fewer orientations are used, character pixels
preventing re-exploring visited nodes.                                   along some directions will be missing. When more orientations
                                                                         are used, character components become fragmented, and the
    Empirical evaluation. We implemented all the three algo-             increased number of components will decrease our attack’s
rithms, and compared the results of our attack facilitated by            speed and success rate. These are confirmed by our empirical
different search algorithms. Note: all the three algorithms can          results as shown in Table VIII.
handle Captcha schemes with a varied length.
                                                                            TABLE VIII.      ATTACK RESULTS ON A MAZON C APTCHA WITH
    With different search algorithms, our attack achieved the                          DIFFERENT ORIENTATION CONFIGURATIONS
same success rate. That is to say, the choice of search al-                                                                Average attack
gorithms does not have an effect on our attack’s success rate.                            Orientations   Success rate
                                                                                                                          speed (Seconds)
However, as shown in Table VII, the integer partition algorithm                                3            20.8%              12.25
improves the attack speed achieved by the old search algorithm                                 4            25.8%              14.32
                                                                                               6            9.2%               21.55
for each Captcha scheme. Our new DP search algorithm further                                   8            7.4%               30.01
improves the attack speed significantly; the figures in Table VII
include the time for graph pruning, and therefore this is a fair
comparison.                                                              C. Extracting Methods
   To sum up, both theoretical and empirical analyses in the                 2D Gabor filters [10] and steerable filter banks [12] can
above suggest that our new graph search algorithm outperforms            extract texture features from an image at any direction. We
both alternatives.                                                       tested both for extracting character components in Captcha
                                                                         images. We compared them with Log-Gabor filters in Table
    TABLE VII.       ATTACK SPEED VS . GRAPH SEARCH ALGORITHMS .
                                                                         IX. Log-Gabor filters are the best for our purpose.
                              Average attack speed (Seconds)
                    Scheme
                                DP
                                       Integer
                                                     DFS
                                                                                   TABLE IX.        A COMPARISON OF DIFFERENT FILTERS .
                                      partition
                              search                search                             2D Gabor              Steerable filter            Log-Gabor
                                     algorithm
                  reCAPTCHA 10.27       10.31       10.87
                     Yahoo!   28.56     33.33       34.32                     0
                     Baidu     2.81      3.00        3.14
                    Wikipedia  3.74      3.78        3.83
                       QQ      4.95      5.15        5.55                    π/4
                    Microsoft 12.59     14.93       15.49
                    Amazon    13.18     14.60       15.28
                     Taobao    4.64      4.74        4.80                    π/2
                      Sina     4.83      4.93        5.03
                      Ebay     5.98      6.01        6.06
                                                                            3π/4


B. Extraction Orientations
    We tested our Gabor filters with different combinations of           D. Classifiers
extraction directions:                                                       We tested Support Vector Machine, Back-Propagation Neu-
    3 orientations: 0, π/3, 2π/3;                                        ral Network, Template Matching and Convolutional Neural
                                                                         Network (CNN, a multi-layer neural network doing deep learn-
    4 orientations: 0, π/4, 2π/4, 3π/4;                                  ing and extracting features from training samples automatically
                                                                         and efficiently) as a candidate for our recognition engine.
    6 orientations: 0, π/6, 2π/6, 3π/6, 4π/6, 5π/6;
                                                                         Among these classifiers, CNN achieved the fastest attack speed
    8 orientations: 0, π/8, 2π/8, 3π/8, 4π/8, 5π/8, 6π/8, 7π/8.          and the best success rate. This result is consistent with the
                                                                         comparison in [13].
                                                                             We also compared the performance of KNN and CNN. As
                                                                         shown in Table X, KNN achieved higher success rates on most
                                                                         of the schemes than CNN, but CNN was faster most of the
                                                                         time.
            (a) 3 orientations                  (b) 4 orientations
                                                                                   TABLE X.         ATTACK RESULTS BY KNN AND CNN.
                                                                                                           Success rate            Speed(s)
                                                                                          Schemes
                                                                                                         KNN       CNN          KNN     CNN
                                                                                       reCAPTCHA         77.2% 38.4%            10.27 10.19
                                                                                          Yahoo!         5.0%      5.2%         28.56 23.81
            (c) 6 orientations                  (d) 8 orientations                         Baidu         44.2% 46.6%             2.81    2.21
                                                                                         Wikipedia       23.8% 20.4%             3.74    2.90
Fig. 8.   Superimposition of extracted components.                                          QQ           56.0% 22.4%             4.95    4.61
                                                                                         Microsoft       16.2%     8.6%         12.59    6.64
                                                                                         Amazon          25.8% 20.2%            13.18    8.68
                                                                                          Taobao         23.4% 20.4%             4.64    5.25
   Figure 8 shows a superimposition of the extraction results                              Sina          9.4%      4.4%          4.83    5.21
achieved by each configuration. Judged by the superimposition                              Ebay          58.8% 32.6%             5.98    5.50



                                                                     9
                   VII.   I S THERE A D EFENCE ?                               4) Combining countermeasures. We also perform a new
                                                                           set of experiments to test various combinations of the coun-
    In principle, some countermeasures may circumvent our
                                                                           termeasures, and evaluate each combination’s resistance to our
attack to an extent, by mitigating key steps of the attack.
                                                                           attack, in the aim of making a further insight into the strength
   Mitigating component extraction by overlapping, i.e.                    of combining these mechanisms. There are four different
make adjacent characters overlap to prevent segmentation,                  combinations of these countermeasures and we test all of them.
or by rotating, i.e. rotate characters to some certain angles,             To achieve consistent and rigorous results, our experiments test
making some strokes of adjacent characters connect or overlap.             all the countermeasure combinations on a single scheme. We
                                                                           choose Amazon for our experiments, and the size of both our
    Clear directional information is important for our direc-
                                                                           sample set and test set is 500.
tional filtering. If characters are connected or overlapped too
much, the connected strokes will make it harder for our                        Table XI summarises our experiment results, listing each
component extraction to work. Rotation can have a similar                  countermeasure and combination along with its influence on
impact on our attack.                                                      the Captcha’s resistance to our attack.
    Mitigating partition and recognition by a variety of                      The results clearly suggest the following. First, the com-
methods, such as increasing the length of Captcha or adopting              bination of two countermeasures is indeed more secure than
a varied length, and using a large alphabet set. These methods             each single countermeasure alone. The combination of three
will make the solution space larger, likely resulting in a                 countermeasures achieves the best defence. Among all single
decreased attack speed and success rate. Warping characters                countermeasure, warping is the most secure one. However,
and introducing noise arcs will increase recognition difficulty.           warping is a double-edged sword; it indeed enhances security,
   We empirically evaluate some most promising countermea-                 but too much warping will significantly decrease usability.
sures as follows.                                                          What a level of warping is good to strike the right balance be-
                                                                           tween security and usability is an important issue for Captcha
    We chose Baidu, Taobao and Amazon as the representative                designers to consider.
schemes respectively. For each experiment, 500 randomly
collected Captchas were used as a sample set, and another                      Although all the above countermeasures achieve a reduc-
500 randomly chosen samples as a test set.                                 tion of our success rates, our attack still has broken all the
                                                                           hardened schemes, since it has achieved a success rate of
    1) Overlapping. Overlapping removes space between char-                higher than 1% for each of them. Therefore, these mechanisms
acters and makes them overlapped, and it is considered by far              are at most partial defences. On the other hand, in performing
the most secure anti-segmentation technique [5].                           our empirical studies, we did not consider and evaluate the
    We use the Baidu scheme as a case study to evaluate the                impact of these defence mechanisms on usability. However, it
effectiveness of overlapping. We modify the original Captchas              is important to strike the right balance between security and
by increasing character overlapping by 1, 2 and 3 pixels,                  usability in Captcha design [26]. It remains an open problem
respectively, and then run our attack on them. Our new success             what design will be simultaneously usable and robust to our
rates are 21.2%, 15.2% and 8.4%, respectively, while the                   attack.
original is 44.2%. The more overlapped the characters, the
less successful our attack became.                                                     VIII.   S UMMARY AND C ONCLUSION
    2) Rotating. To evaluate the effectiveness of rotating as                  We have proposed a simple attack on text Captchas. Tested
a defence, we chose the Taobao scheme for an experiment.                   on real-world Captchas deployed by top 20 most popular web-
We rotated one or more characters to make adjacent strokes                 sites, and on several Captchas that were generally considered
of different characters connected or overlapping, but kept the             hard, our attack has broken them all, mostly with a good
Captcha length and characters unchanged. The success rate our              success. Although our success rates on a few schemes are
attack achieved on the hardened test set is 7.8the original set.           relatively low, we believe that our attack’s general applicability
This indicates rotating does have a positive effect in enhancing           trumps very high performance. It is more important to be able
security.                                                                  to break any novel scheme to some extent, than to break a
                                                                           single scheme very well.
    3) Warping. Warping has two forms: global warping
that transforms the whole Captcha string globally, and local                   If an attacker aims to break a particular scheme, ad hoc
warping that acts on some of the characters.                               attacks might indeed achieve a better success rate than our
                                                                           generic attack. But when the attacker aims to break multi-
    We tested both forms of warping on the Amazon scheme
                                                                           ple schemes, our generic attack means a much better cost-
(see Figure 9). With global and local warping applied, respec-
                                                                           effectiveness.
tively, the success rate of our attack dropped from the original
25.8% to 5.4% and 8.8%, respectively.                                          In contrast to the common practice of Captcha robustness
                                                                           analysis, which is based on a toolbox approach, our attack
                                                                           uses a single segmentation method, and a single recognition
                                                                           strategy. Our attack is simple, fast and generic, and because
                                                                           of these characteristics, it is probably the best attack so far.
          (a) Original       (b) Global warping   (c) Local warping             Our attack is based on a novel application of 2D Log-Gabor
                                                                           filters. The key insight and innovation that differentiates our
Fig. 9.   Warping defense on Amazon Captcha.                               attack from prior art is the following. No matter Captcha texts

                                                                      10
                                             TABLE XI.     C OUNTERMEASURE C OMBINATIONS .
                       Experiments   Sample Image   Reconstruction Image    Overlapping   Rotating   Warping   Attack Success

                           1                                                    X                                  11.6%



                           2                                                                X                      13%


                           3                                                                           X           8.8%



                           4                                                    X           X                      7.6%



                           5                                                    X                      X           7.4%



                           6                                                                X          X           6.8%



                           7                                                    X           X          X           1.4%




are connected or not, and no matter they use hollow fonts                  illustrated by our attack, the common practice of text Captcha
or not, Log Gabor provides a uniform and effective method                  designs is certainly dubious and shaking. On the other hand,
for breaking the images into a small number of meaningful                  we believe innovations will be able to bring out next generation
pieces, i.e. character strokes, in a structured way. These pieces          of text Captchas that are more usable and more secure than
then can be assembled to reconstruct correct characters with               its predecessors. We encourage both the research community
an intelligent algorithm.                                                  and the industry to ponder and discuss: what is the next step
                                                                           for text Captchas? Or, is it now the time to take alternative
    It is known for long that simple cells in the visual cortex
                                                                           solutions such as image recognition Captchas more seriously?
of mammalian brains can be modeled by Gabor functions
[10, 11]. That is to say, perception in the human visual system
is more or less similar to image analysis with Gabor filters.                                        ACKNOWLEDGEMENTS
These profound insights help to explain the power of our
attack, and the failure of common text Captchas that we have                  We thank Ross Anderson, John Daugman, Jussi Palomäki
analysed: our humans’ Captcha-solving process can be compu-                and Will Ng for helpful conversations, and thank Venkat
tationally approximated by our Gabor filter based recognition              Venkatakrishnan and anonymous reviewers for constructive
approach. When computers can reliably approximate via an                   comments. Xidian authors are supported by the National
automated algorithm humans’ solving process, certainly such                Natural Science Foundation of China (61472311) and the
Captcha designs are doomed. However, to reach this simple                  Fundamental Research Funds for the Central Universities.
observation, it takes many years of hard work.
    Since the invention of Captcha technology in early 2000,                                             R EFERENCES
an open problem that is important for security has been out-
standing in the research communities and intrigued researchers              [1] A S El Ahmad, J Yan, and L Marshall. The robustness
for 15 years: is there an effective but general attack that breaks              of a new captcha. In Proceedings of the Third European
all (representative) text schemes? The implication of resolving                 Workshop on System Security, pages 36–41. ACM, 2010.
this open problem is apparent: are we on the wrong direction in             [2] A S El Ahmad, J Yan, and M Tayara. The robustness
text Captcha design? Characters are distorted harder everyday,                  of Google CAPTCHAs. Computing Science, Newcastle
but is this really necessary, or just making a legitimate user’s                University, 2011.
life harder? Our attack is a step forward towards resolving this            [3] Alexa. Alexa top 500 global sites. https://www.alexa.
long-standing problem, and contributes to debates around its                    com/topsites.
implications.                                                               [4] E Bursztein, J Aigrain, A Moscicki, and J C Mitchell. The
                                                                                end is nigh: generic solving of text-based captchas. In
    A full defence against our attack is an interesting but
                                                                                8th USENIX Workshop on Offensive Technologies(WOOT
challenging open problem, which we share with the whole
                                                                                14), San Diego, CA, August 2014. USENIX Association.
community. We expect our work to inspire novel attacks and
                                                                            [5] E Bursztein, M Martin, and J Mitchell. Text-based
defences, as well as innovative designs in this interesting
                                                                                captcha strengths and weaknesses. In CCS’11, pages
interdisciplinary area.
                                                                                125–138. ACM, 2011.
   Given the practical relevance and intellectual interest of the           [6] E Bursztein, A Moscicki, C Fabry, S Bethard, J C
Captcha technology, it is important to ask: Are text Captchas                   Mitchell, and D Jurafsky. Easy does it: more usable
dead? Our answer is both yes and no. On the one hand, as                        captchas. In CHI’14, pages 2637–2646. ACM, 2014.

                                                                     11
 [7] K Chellapilla, K Larson, P Y Simard, and M Czerwin-                [26] J Yan and A S El Ahmad. Usability of captchas or
     ski. Building segmentation based human-friendly human                   usability issues in captcha design. In SOUPS’08, pages
     interaction proofs, 2005.                                               44–52. ACM, 2008.
 [8] Z Dang, J Lei, and J Lan. A method of constructive                 [27] B B Zhu, J Yan, Q Li, C Yang, J Liu, N Xu, M Yi,
     captcha based on gabor sub-space. Journal of Computa-                   and K Cai. Attacks and design of image recognition
     tional Information Systems, 9(8):3093–3099, 2013.                       captchas. In Proceedings of the 17th ACM conference on
 [9] J Daugman. Uncertainty relation for resolution in space,                Computer and communications security, pages 187–200.
     spatial frequency, and orientation optimized by two-                    ACM, 2010.
     dimensional visual cortical filters. JOSA A, 2(7):1160–
     1169, 1985.
[10] J Daugman. Probing the uniqueness and randomness of
     iriscodes: Results from 200 billion iris pair comparisons.
     Proceedings of the IEEE, 94(11):1927–1935, 2006.
[11] D J Field. Relations between the statistics of natural
     images and the response properties of cortical cells. JOSA
     A, 4(12):2379–2394, 1987.
                                                                                                              A PPENDIX
[12] W T Freeman and E H Adelson. The design and use of
     steerable filters. IEEE Transactions on PAMI, 13(9):891–
     906, 1991.                                                            Here we present the details of key steps like graph building,
[13] H Gao, W Wang, J Qi, X Wang, X Liu, and J Yan. The                 pruning and searching for the QQ and Microsoft schemes.
     robustness of hollow captchas. In CCS’13, pages 1075–              Figure 10 shows QQ and Microsoft challenges with all com-
     1086. ACM, 2013.                                                   ponents rank ordered.
[14] P Golle. Machine learning attacks against the asirra
     captcha. In Proceedings of the 15th ACM conference on
     Computer and communications security, pages 535–542.
     ACM, 2008.
[15] I J Goodfellow, Y Bulatov, J Ibarz, S Arnoud, and V Shet.
     Multi-digit number recognition from street view imagery
     using deep convolutional neural networks. arXiv preprint
     arXiv:1312.6082, 2013.
[16] Y Lecun. The mnist database of handwritten digits
     algorithm results. http://yann.lecun.com/exdb/mnist/.                                                    (a) QQ Sample
[17] M Mohamed, N Sachdeva, M Georgescu, S Gao, N Sax-
     ena, C Zhang, P Kumaraguru, P C van Oorschot, and
     W B Chen. A three-way investigation of a game-
     captcha: automated attacks, relay attacks and usability. In
     Proceedings of the 9th ACM symposium on Information,
     computer and communications security, pages 195–206.
     ACM, 2014.                                                                                           (b) Microsoft Sample
[18] G Mori and J Malik. Recognizing objects in adversarial
     clutter: Breaking a visual captcha. In CVPR’03, vol-               Fig. 10.   All components rank ordered.
     ume 1, pages I–134. IEEE, 2003.
[19] P Y Simard. Using machine learning to break visual
     human interaction proofs (hips). In NIPS’04, 2004.
[20] J Tam, J Simsa, S Hyde, and L V Ahn. Breaking audio
     captchas. In Advances in Neural Information Processing                   TABLE XII.             T HE INITIAL n × n TABLE FOR QQ C APTCHA .
     Systems, pages 1625–1632, 2008.
                                                                                             1   2    3   4   5   6   7   8   9 10 11 12 13 14
[21] K Thomas, D McCoy, C Grier, A Kolcz, and V Paxson.                               1          •    •   •   •   •   •
     Trafficking fraudulent accounts: the role of the under-                          2          •    •   •   •   •   •
     ground market in twitter spam and abuse. In USENIX                               3
     Security Symposium, 2013.                                                        4                                   •   •
                                                                                      5                                   •   •   •   •   •
[22] Vicarious. Vicaricous. http://vimeo.com/77431982.                                6                                           •   •   •
[23] Y Xu, G Reynaga, S Chiasson, J M Frahm, F Monrose,                               7                                                       •   •
     and P C van Oorschot. Security and usability challenges                        8...12
                                                                                           15 16 17 18 19 20 21 22 23 24 25 26
     of moving-object captchas: Decoding codewords in mo-                            13    • •
     tion. In USENIX Security Symposium, pages 49–64, 2012.                          14    • •
[24] J Yan and A S El Ahmad. Breaking visual captchas with                           15          • •
                                                                                     16          • •
     naive pattern recognition algorithms. In ACSAC’07, pages                        17
     279–291. IEEE, 2007.                                                            18                • • • • •
                                                                                     19                                     •
[25] J Yan and A S El Ahmad. A low-cost attack on a                                  20                                     •
     microsoft captcha. In CCS’08, pages 543–554. ACM,                               21                                     •
     2008.                                                                         22...26



                                                                   12
Fig. 11.   The search graph for QQ sample.


    Tables XII show the corresponding initial tables for the
QQ sample, and Figure 11 is its search graph. Only one
path survives pruning for the QQ sample, which simplifies
the search process to an extreme.
 TABLE XIII.        T HE INITIAL n × n TABLE FOR M ICROSOFT C APTCHA .
                1   2   3   4   5   6   7   8   9   10 11 12
            1       •   •   •   •
            2           •   •   •   •
            3                   •   •   •
            4                   •   •   •   •
            5                       •   •   •
            6                               •   •
            7                               •   •   •
            8                                   •   •   •
            9                                  •    •   •
           10                                  •    •   •
           11                                  •
           12                                  •
              13 14 15 16 17 18 19 20 21 22 23 24 25
           13 • •
           14       • • • • •
           15          • • • • •
           16          • • • • • • •
           17                   • • • • •
           18                   • • • • •
           19                         • • • •
           20                               • •
           21                                  •
           22                                  •
           23
           24                                     •
           25                                     •




Fig. 12.   The search graph for Microsoft sample.


    Tables XIII and XIV show the corresponding initial and
final tables for the Microsoft sample. Figure 12 describes the
search graph and Table XV gives the dynamic search process
for the Microsoft sample.




                                                                         13
                        TABLE XIV.           T HE FINAL n × n TABLE FOR M ICROSOFT C APTCHA .

        1     2      3         4          5         6        7        8       9      10         11     12
 1          Q/0.36 5/0.49    5/0.7      3/0.44
 2
 3                                   T/0.42 y/0.4 y/0.34
 4                                   H/0.58 W/0.49 W/0.36 P/0.31
 5                                          V/0.84 V/0.6 L/0.51
 6                                                        H/0.44 N/0.11
 7                                                        J/0.49 N/0.46 X/0.38
 8                                                               H/0.49 L/0.44 N/0.46
 9                                                                      V/0.25 H/0.22 M/0.92
10                                                                       4/0.2 N/0.5 M/0.47
11                                                                                    T/0.52
12                                                                                     X/0.2
     13     14     15     16           17     18    19      20     21     22     23     24                      25
13 4/0.33 y/0.87
14               T/0.21 W/0.48 W/0.46 W/0.44              L/0.44
15                      L/0.46 L/0.39 5/0.43              5/0.91   V/0.36
16                      y/0.46 y/0.38 5/0.36              5/0.54   Y/0.31 X/0.32
17                                                        y/0.39   y/0.43 L/0.31             D/0.27
18                                                        Y/0.38   y/0.37 L/0.27             D/0.37
19                                                                        F/0.4              C/0.34   P/0.38
20                                                                                           C/0.75   H/0.38
21                                                                                                    y/0.37
22                                                                                                    y/0.43
23
24                                                                                                             L/0.86
25                                                                                                             D/0.56




                            TABLE XV.        T HE SEARCH PROCESS FOR M ICROSOFT C APTCHA .
      j step[j] value[j] result[j]      j    step[j] value[j] result[j]       j   step[j] value[j] result[j]
      3    1      0.36   Q                      5      2.68   5LM4T                  5      3.37   5LMyV
      4    1      0.49   5              16      6      3.5    5VJM4T                 6      4.19   5VJMyV
      5    1      0.7    5                      7      3.35   5VJVT4T        21      7      4.73   5VJMyLy
           1      0.44   3                      5      3.48   5LMyL                  8      4.59   5VJVTyLy
      6
           2      1.08   5H                     6      4.3    5VJMyL                 9      4.25   5VJVT4Tyy
                                        17
      7    2      1.55   5V                     7      4.15   5VJVTyL                6      3.85   5LMy5F
      8    2      1.31   5V                     8      3.82   5VJVT4Ty               7      4.67   5VJMy5F
                                                                             22
           2      1.22   5L                     5      3.41   5LMyL                  8      4.52   5VJVTy5F
      9
           3      2.04   5VJ                    6      4.23   5VJMyL                 9      4.14   5VJVT4TyL
                                        18
           2      0.55   3N                     7      4.08   5VJVTyL                6      4.68   5LMy5C
     10
           3      2.01   5VN                    8      3.74   5VJVT4Ty               7       5.5   5VJMy5C
           3      1.93   5VX                    5      3.44   5LMy5          24      8      5.46   5VJMyLyC
     11
           4      2.29   5VJV                   6      4.27   5VJMy5                 9      5.31   5VJVTyLyC
                                        19
           3      1.78   5VN                    7      4.12   5VJVTy5               10      4.97   5VJVT4TyyC
     12
           4      2.52   5VNN                   8      3.72   5VJVT4T5               6       4.3   5LMy5H
           3      2.14   5LM                    5      3.92   5LMy5                  7      5.12   5VJMy5H
     13    4      2.96   5VJM                   6      4.74   5VJMy5         25      8       5.1   5VJMyLyy
           5      2.81   5VJVT          20      7      4.7    5VJMyLy                9      4.96   5VJVTyLyy
           4      2.47   5LM4                   8      4.55   5VJVTyLy              10      4.62   5VJVT4Tyyy
     14    5      3.29   5VJM4                  9      4.21   5VJVT4Tyy              7      5.54   5LMy5CL
           6      3.14   5VJVT4                                                      8      6.37   5VJMy5CL
                                                                             26
           4      3.01   5LMy                                                        9      6.32   5VJMyLyCL
     15    5      3.83   5VJMy                                                      10      6.18   5VJVTyLyCL
           6      3.68   5VJVTy




                                                           14
