MatchTheRegex

Description

How about trying to match a regular expression

Hints

1

any redirections?

Pattern Matching

We have a website with a single input field

Any incorrect input gives us an angry alert

Looking through the code, we find this interesting function which appears to validate the input

function send_request() {
	let val = document.getElementById("name").value;
	// ^p.....F!?
	fetch(`/flag?input=${val}`)
		.then(res => res.text())
		.then(res => {
			const res_json = JSON.parse(res);
			alert(res_json.flag)
			return false;
		})
	return false;
}

The regex is ^p.....F!?

  • ^p - String starts with "p"

  • ..... - 5 characters of any value

  • F - The letter "F"

  • !? - Matches 0 or 1 occurrences of "!"

Using this, we can pass in "picoCTF" or any other possible string that satisfies the regex

Flag

picoCTF{succ3ssfully_matchtheregex_8ad436ed}

Last updated