Post

PicoCTF - MatchTheRegex

Description: How about trying to match a regular expression?

  1. The homepage consists of an input box where we can try putting our regular expression, aka regex, to try and match the flag:

  2. When trying test as a test to see how this works we get a wrong match! Try again! message:

  3. We could try a site like regex101 and build a regex that match the general picoCTF flag structure, such as the following:

  4. Unfortunately, that did not work. We can take a look at the page’s source code:

  5. As it seems it only needs a string sequence that matches the pattern in the comment, i.e., ^p.....F!?:

    1. We need a sequence starting with the letter p (^p).
    2. Followed by any 5 characters (.....).
    3. Followed by the letter F (F).
    4. And we can have an exclamation mark (or not) at the end (!?). The ? signifies that the preceded character is optional.

    So any string sequence that matches the above pattern will give us the flag:

This post is licensed under CC BY 4.0 by the author.