{"id":666,"date":"2017-10-30T17:08:13","date_gmt":"2017-10-30T22:08:13","guid":{"rendered":"http:\/\/www.webadminblog.com\/?p=666"},"modified":"2017-10-30T20:13:11","modified_gmt":"2017-10-31T01:13:11","slug":"completing-the-lascon-2017-badge-game","status":"publish","type":"post","link":"https:\/\/www.webadminblog.com\/index.php\/2017\/10\/30\/completing-the-lascon-2017-badge-game\/","title":{"rendered":"Completing the LASCON 2017 Badge Game"},"content":{"rendered":"<p>For those who don&#8217;t know, every year I put together a game that starts on the back of the LASCON badge. \u00a0It&#8217;s typically some combination of crypto challenges alongside application security vulnerabilities with the goal of having it take somewhere around 1-3 hours, depending on experience, to complete. \u00a0Those who complete the game are rewarded with one of these awesome challenge coins:<\/p>\n<p><a href=\"https:\/\/www.webadminblog.com\/wp-content\/uploads\/2017\/10\/Screen-Shot-2017-10-30-at-2.51.43-PM.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium wp-image-667\" src=\"https:\/\/www.webadminblog.com\/wp-content\/uploads\/2017\/10\/Screen-Shot-2017-10-30-at-2.51.43-PM-300x187.png\" alt=\"LASCON 2017 Challenge Coin\" width=\"300\" height=\"187\" srcset=\"https:\/\/www.webadminblog.com\/wp-content\/uploads\/2017\/10\/Screen-Shot-2017-10-30-at-2.51.43-PM-300x187.png 300w, https:\/\/www.webadminblog.com\/wp-content\/uploads\/2017\/10\/Screen-Shot-2017-10-30-at-2.51.43-PM-768x480.png 768w, https:\/\/www.webadminblog.com\/wp-content\/uploads\/2017\/10\/Screen-Shot-2017-10-30-at-2.51.43-PM-1024x640.png 1024w, https:\/\/www.webadminblog.com\/wp-content\/uploads\/2017\/10\/Screen-Shot-2017-10-30-at-2.51.43-PM.png 1066w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>Now, I know that there are people out there who look at one of these things and don&#8217;t even know where to start so, it is in the spirit of education and learning that I share with you my notes on how to complete the LASCON 2017 Badge Game.<\/p>\n<p><span style=\"text-decoration: underline;\"><strong>Stage 1<\/strong><\/span><\/p>\n<p>On the back of the LASCON badge it reads as follows:<\/p>\n<blockquote>\n<div>Another year, another game<\/div>\n<div>Solve the puzzles, write your name<\/div>\n<div>These characters aren\u2019t a work of art<\/div>\n<div>Ask a mason how to start<\/div>\n<div><\/div>\n<div><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-668 alignnone\" src=\"https:\/\/www.webadminblog.com\/wp-content\/uploads\/2017\/10\/97C5EACC-B4D6-43BE-9591-1E529285CDEE-300x174.png\" alt=\"ciphertext\" width=\"300\" height=\"174\" srcset=\"https:\/\/www.webadminblog.com\/wp-content\/uploads\/2017\/10\/97C5EACC-B4D6-43BE-9591-1E529285CDEE-300x174.png 300w, https:\/\/www.webadminblog.com\/wp-content\/uploads\/2017\/10\/97C5EACC-B4D6-43BE-9591-1E529285CDEE-768x446.png 768w, https:\/\/www.webadminblog.com\/wp-content\/uploads\/2017\/10\/97C5EACC-B4D6-43BE-9591-1E529285CDEE-1024x594.png 1024w, https:\/\/www.webadminblog.com\/wp-content\/uploads\/2017\/10\/97C5EACC-B4D6-43BE-9591-1E529285CDEE.png 1358w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/div>\n<\/blockquote>\n<div><\/div>\n<div>The key word in the text above is &#8220;mason&#8221;. \u00a0If you were to Google the term &#8220;mason cipher&#8221;, you would come across an interesting kind of cipher called a Pigpen\/Masonic\/Freemason Cipher. \u00a0The idea being that they take a geometric pattern and map the letters of the alphabet to the locations on the pattern. \u00a0Here&#8217;s an example that you could use to translate this text:<\/div>\n<div><\/div>\n<div><a href=\"https:\/\/www.webadminblog.com\/wp-content\/uploads\/2017\/10\/cipher.gif\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium wp-image-669\" src=\"https:\/\/www.webadminblog.com\/wp-content\/uploads\/2017\/10\/cipher-300x242.gif\" alt=\"Freemason Cipher\" width=\"300\" height=\"242\" \/><\/a><\/div>\n<div><\/div>\n<div>Once translated, you get the following message:<\/div>\n<blockquote>\n<div>To start the badge game go to nocsal dot lascon dot org<\/div>\n<\/blockquote>\n<div><span style=\"text-decoration: underline;\"><strong>Stage 2<\/strong><\/span><\/div>\n<div>When you go to <a href=\"http:\/\/nocsal.lascon.org\">nocsal.lascon.org<\/a>\u00a0it defaults to having a GET parameter of page=winners.php. \u00a0This is a sign that it is vulnerable to directory traversal. \u00a0There is also a comment in the page source that says \u201cGet badge game winners from \/files\/winners.php\u201d. \u00a0If you navigate to\u00a0<a href=\"http:\/\/nocsal.lascon.org\/files\/\">http:\/\/nocsal.lascon.org\/files\/<\/a>, it has directory browsing enabled and you can see a test.php page there, in addition to winners.php. \u00a0If you go to\u00a0<a href=\"http:\/\/nocsal.lascon.org\/?page=test.php\">http:\/\/nocsal.lascon.org\/?page=test.php<\/a>, you will see it grabs the test.php code and pulls it into the page source. \u00a0If you view source, you can see the text is as follows:<\/div>\n<div><\/div>\n<div>\n<table>\n<colgroup>\n<col \/>\n<col \/><\/colgroup>\n<tbody>\n<tr>\n<td>\n<div>&lt;?php<\/div>\n<\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<td>\n<div>\/\/ Test ability to grab winners table from the database<\/div>\n<\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<td>\n<div>$servername = &#8220;localhost&#8221;;<\/div>\n<\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<td>\n<div>$username = &#8220;lascon&#8221;;<\/div>\n<\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<td>\n<div>$password = &#8220;e3fmGYHDrc6MNCEMmLWj&#8221;;<\/div>\n<\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<td>\n<div>$dbname = &#8220;lascon&#8221;;<\/div>\n<\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<td>\n<div>$conn = new mysqli($servername, $username, $password, $dbname);<\/div>\n<\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<td>\n<div>$sql = &#8220;SELECT * FROM lascon_winners&#8221;;<\/div>\n<\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<td>\n<div>$result = $conn-&gt;query($sql);<\/div>\n<\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<td>\n<div>$array = $result-&gt;fetch_array();<\/div>\n<\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<td>\n<div>print_r($array);<\/div>\n<\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<td>\n<div>$conn-&gt;close();<\/div>\n<\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<td>\n<div>?&gt;<\/div>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div><\/div>\n<div>We now have a database username and password.<\/div>\n<div><\/div>\n<p><span style=\"text-decoration: underline;\"><strong>Stage 3<\/strong><\/span><\/p>\n<p>Even though the database connection that we found uses a servername of &#8220;localhost&#8221;, it turns out that mysql is open on the public IP interface of the server as well. \u00a0We can use a mysql client to connect to <a href=\"http:\/\/nocsal.lascon.org\">nocsal.lascon.org<\/a>\u00a0with username \u201clascon\u201d and password \u201ce3fmGYHDrc6MNCEMmLWj\u201d (<em>mysql -h nocsal.lascon.org -u lascon -p<\/em>). \u00a0Once in the database, the user has access to read the lascon database and will see a \u201clascon_winners\u201d, \u201cusers\u201d, and \u201cwebsites&#8221; table. \u00a0When you try to insert into the lascon_winners table, you quickly realize that you do not have insert permissions, so you cannot insert into the lascon_winners table. \u00a0In the users table, you see an entry with username \u201cadmin\u201d and password \u201cNFJXaTNuc0pyR2Y2c25iNG9Va1c=\u201c. \u00a0In the websites table, you see a bunch of sites and one hiding amongst the others is ttpcteebhz.lascon.org.<\/p>\n<div><\/div>\n<div><\/div>\n<p><span style=\"text-decoration: underline;\"><strong>Stage 4<\/strong><\/span><\/p>\n<p>When you go to\u00a0<a href=\"http:\/\/ttpcteebhz.lascon.org\">http:\/\/ttpcteebhz.lascon.org<\/a>\u00a0in your browser, you see a form with a spot for a username and password. \u00a0You can base64 decode the string you found int he database (NFJXaTNuc0pyR2Y2c25iNG9Va1c=) to get the value \u201c4RWi3nsJrGf6snb4oUkW\u201d. \u00a0Once you have that, you can log in with username \u201cadmin\u201d and password \u201c4RWi3nsJrGf6snb4oUkW\u201d.<\/p>\n<div><\/div>\n<div><\/div>\n<p><span style=\"text-decoration: underline;\"><strong>Stage 5<\/strong><\/span><\/p>\n<p>Once logged in with the username and password, you see a blank page. \u00a0Once you view the page source, however, you see that it contains a hidden form and fields:<\/p>\n<div>&lt;form name=&#8221;submission&#8221; method=&#8221;post&#8221; action=&#8221;&#8221;&gt;<\/div>\n<div>&lt;input type=&#8221;hidden&#8221; name=&#8221;first_name&#8221; value=&#8221;&#8221; readonly \/&gt;<\/div>\n<div>&lt;input type=&#8221;hidden&#8221; name=&#8221;last_name&#8221; value=&#8221;&#8221; readonly \/&gt;<\/div>\n<div>&lt;input type=&#8221;hidden&#8221; name=&#8221;phone&#8221; value=&#8221;&#8221; readonly \/&gt;<\/div>\n<div>&lt;input type=&#8221;hidden&#8221; name=&#8221;email&#8221; value=&#8221;&#8221; readonly \/&gt;<\/div>\n<div>&lt;\/form&gt;<\/div>\n<p>The last part of the challenge you could accomplish with a proxy tool, but I just used the Developer Tools in Chrome. \u00a0I changed the hidden fields to text fields, removed the readonly values, and then added a form submit button. Once submitted, the game is over and you win!<\/p>\n<div><\/div>\n<div><\/div>\n<p><span style=\"text-decoration: underline;\"><strong>A Quick Summary of Puzzles Solved \/ Vulnerabilities in the Badge Game<\/strong><\/span><\/p>\n<ul>\n<li>Freemason Cipher<\/li>\n<li>Directory Traversal<\/li>\n<li>Information Disclosure in Comments<\/li>\n<li>Directory Browsing Enabled<\/li>\n<li>Hard-Coded Database Credentials<\/li>\n<li>MySQL Service Publicly Accessible<\/li>\n<li>BASE64 Encoded Passwords<\/li>\n<li>Hidden and Read-Only Form Fields<\/li>\n<li>Missing Form Submit Button<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>For those who don&#8217;t know, every year I put together a game that starts on the back of the LASCON badge. \u00a0It&#8217;s typically some combination of crypto challenges alongside application security vulnerabilities with the goal of having it take somewhere around 1-3 hours, depending on experience, to complete. \u00a0Those who complete the game are rewarded [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[517,649,4],"tags":[76,651,654,652,650,653,12,622],"class_list":["post-666","post","type-post","status-publish","format-standard","hentry","category-capture-the-flag","category-owasp-lascon-2017","category-web-app-sec","tag-application","tag-badge","tag-conference","tag-game","tag-lascon","tag-lonestar","tag-owasp","tag-security"],"aioseo_notices":[],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/pfI0c-aK","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.webadminblog.com\/index.php\/wp-json\/wp\/v2\/posts\/666","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.webadminblog.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.webadminblog.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.webadminblog.com\/index.php\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/www.webadminblog.com\/index.php\/wp-json\/wp\/v2\/comments?post=666"}],"version-history":[{"count":5,"href":"https:\/\/www.webadminblog.com\/index.php\/wp-json\/wp\/v2\/posts\/666\/revisions"}],"predecessor-version":[{"id":674,"href":"https:\/\/www.webadminblog.com\/index.php\/wp-json\/wp\/v2\/posts\/666\/revisions\/674"}],"wp:attachment":[{"href":"https:\/\/www.webadminblog.com\/index.php\/wp-json\/wp\/v2\/media?parent=666"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.webadminblog.com\/index.php\/wp-json\/wp\/v2\/categories?post=666"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.webadminblog.com\/index.php\/wp-json\/wp\/v2\/tags?post=666"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}