{
  "id": 344594,
  "title": "WAF Challenge",
  "url": "/competitions/ai-village-ctf/discussion/344594",
  "author_name": "",
  "post_date": "2022-08-15T20:18:01.964259300Z",
  "votes": 3,
  "comment_count": 3,
  "views": 0,
  "content": "<p>I'm trying to understand the WAF \"pipeline\".<br>\nIn the example of the \"Getting Started\" notebook, I see the output:<br>\n{\"waf\": \"MALICIOUS REQUEST CAUGHT BY WAF\", \"output\": [[\"mFzaC\", 0.00952]]}</p>\n<p>for the input = \"mFzaC==\".<br>\nMy question is about the JSON output above.<br>\nThe value of the key \"waf\" means what the WAF layer says, and \"output\" is what the ML model says?<br>\nOr, depending on the input, sometimes the JSON output represents the ML model answer solely, and other times the WAF answer solely?</p>\n<p>I'm thinking that the WAF \"pipeline\" has two layers: the ML model (which doesn't know how to distinguish base64 strings) that evaluates the string, and a WAF layer that evaluates if the string has the correct base64 format. This lead me to re-interpret the JSON output I mention.</p>",
  "messages": [
    {
      "id": "1900239",
      "postDate": "08/15/2022 20:18:01",
      "content": "<p>I'm trying to understand the WAF \"pipeline\".<br>\nIn the example of the \"Getting Started\" notebook, I see the output:<br>\n{\"waf\": \"MALICIOUS REQUEST CAUGHT BY WAF\", \"output\": [[\"mFzaC\", 0.00952]]}</p>\n<p>for the input = \"mFzaC==\".<br>\nMy question is about the JSON output above.<br>\nThe value of the key \"waf\" means what the WAF layer says, and \"output\" is what the ML model says?<br>\nOr, depending on the input, sometimes the JSON output represents the ML model answer solely, and other times the WAF answer solely?</p>\n<p>I'm thinking that the WAF \"pipeline\" has two layers: the ML model (which doesn't know how to distinguish base64 strings) that evaluates the string, and a WAF layer that evaluates if the string has the correct base64 format. This lead me to re-interpret the JSON output I mention.</p>",
      "rawMarkdown": "I'm trying to understand the WAF \"pipeline\".\nIn the example of the \"Getting Started\" notebook, I see the output:\n{\"waf\": \"MALICIOUS REQUEST CAUGHT BY WAF\", \"output\": [[\"mFzaC\", 0.00952]]}\n\nfor the input = \"mFzaC==\".\nMy question is about the JSON output above.\nThe value of the key \"waf\" means what the WAF layer says, and \"output\" is what the ML model says?\nOr, depending on the input, sometimes the JSON output represents the ML model answer solely, and other times the WAF answer solely?\n\nI'm thinking that the WAF \"pipeline\" has two layers: the ML model (which doesn't know how to distinguish base64 strings) that evaluates the string, and a WAF layer that evaluates if the string has the correct base64 format. This lead me to re-interpret the JSON output I mention.",
      "votes": null
    },
    {
      "id": "1905881",
      "postDate": "08/19/2022 11:50:04",
      "content": "<p>Which example are you writing about ?<br>\nIn the notebook I download, there is only this:</p>\n<pre><code>import base64\n\ninput = base64.b64encode(b\"This was a test of your emergency systems\").decode()\ndata = json.dumps(\n    {\"input\": input}\n)\n\ntry:\n    r = requests.post(\"https://waf.fly.dev/score\", data=data)\n    print(r.text)\nexcept requests.exceptions.ConnectionError:\n    print(\"Connection problems. Contact the CTF organizers.\")\n</code></pre>\n<p>No mention of any \"mFzaC==\"…</p>",
      "rawMarkdown": "Which example are you writing about ?\nIn the notebook I download, there is only this:\n```\nimport base64\n\ninput = base64.b64encode(b\"This was a test of your emergency systems\").decode()\ndata = json.dumps(\n    {\"input\": input}\n)\n\ntry:\n    r = requests.post(\"https://waf.fly.dev/score\", data=data)\n    print(r.text)\nexcept requests.exceptions.ConnectionError:\n    print(\"Connection problems. Contact the CTF organizers.\")\n```\nNo mention of any \"mFzaC==\"...",
      "votes": null
    },
    {
      "id": "1905891",
      "postDate": "08/19/2022 12:04:18",
      "content": "<p>Your code is an old version of the starter notebook. The latest starter notebook is version 8 <a href=\"https://www.kaggle.com/code/lucasjt/getting-started?scriptVersionId=103445167\" target=\"_blank\">here</a></p>",
      "rawMarkdown": "Your code is an old version of the starter notebook. The latest starter notebook is version 8 [here][1]\n\n[1]: https://www.kaggle.com/code/lucasjt/getting-started?scriptVersionId=103445167",
      "votes": null
    },
    {
      "id": "1925842",
      "postDate": "09/04/2022 11:21:46",
      "content": "<p>I make the original \"mFzaC==\" to be correct b64. Then got the rest of the payload. Made it pass waf by adjusting it. I do not know enough about malicious exploits. Do I need to replace the sample payload with some other exploits to get the flag?</p>",
      "rawMarkdown": "I make the original \"mFzaC==\" to be correct b64. Then got the rest of the payload. Made it pass waf by adjusting it. I do not know enough about malicious exploits. Do I need to replace the sample payload with some other exploits to get the flag?",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 1905881,
      "author_name": "irmo322",
      "author_url": "",
      "post_date": "08/19/2022 11:50:04",
      "content": "<p>Which example are you writing about ?<br>\nIn the notebook I download, there is only this:</p>\n<pre><code>import base64\n\ninput = base64.b64encode(b\"This was a test of your emergency systems\").decode()\ndata = json.dumps(\n    {\"input\": input}\n)\n\ntry:\n    r = requests.post(\"https://waf.fly.dev/score\", data=data)\n    print(r.text)\nexcept requests.exceptions.ConnectionError:\n    print(\"Connection problems. Contact the CTF organizers.\")\n</code></pre>\n<p>No mention of any \"mFzaC==\"…</p>",
      "votes": null,
      "replies": [
        {
          "id": 1905891,
          "author_name": "cdeotte",
          "author_url": "",
          "post_date": "08/19/2022 12:04:18",
          "content": "<p>Your code is an old version of the starter notebook. The latest starter notebook is version 8 <a href=\"https://www.kaggle.com/code/lucasjt/getting-started?scriptVersionId=103445167\" target=\"_blank\">here</a></p>",
          "votes": null,
          "replies": []
        }
      ]
    },
    {
      "id": 1925842,
      "author_name": "dmitrykonovalov",
      "author_url": "",
      "post_date": "09/04/2022 11:21:46",
      "content": "<p>I make the original \"mFzaC==\" to be correct b64. Then got the rest of the payload. Made it pass waf by adjusting it. I do not know enough about malicious exploits. Do I need to replace the sample payload with some other exploits to get the flag?</p>",
      "votes": null,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "1900239": "I'm trying to understand the WAF \"pipeline\".\nIn the example of the \"Getting Started\" notebook, I see the output:\n{\"waf\": \"MALICIOUS REQUEST CAUGHT BY WAF\", \"output\": [[\"mFzaC\", 0.00952]]}\n\nfor the input = \"mFzaC==\".\nMy question is about the JSON output above.\nThe value of the key \"waf\" means what the WAF layer says, and \"output\" is what the ML model says?\nOr, depending on the input, sometimes the JSON output represents the ML model answer solely, and other times the WAF answer solely?\n\nI'm thinking that the WAF \"pipeline\" has two layers: the ML model (which doesn't know how to distinguish base64 strings) that evaluates the string, and a WAF layer that evaluates if the string has the correct base64 format. This lead me to re-interpret the JSON output I mention.",
    "1905881": "Which example are you writing about ?\nIn the notebook I download, there is only this:\n```\nimport base64\n\ninput = base64.b64encode(b\"This was a test of your emergency systems\").decode()\ndata = json.dumps(\n    {\"input\": input}\n)\n\ntry:\n    r = requests.post(\"https://waf.fly.dev/score\", data=data)\n    print(r.text)\nexcept requests.exceptions.ConnectionError:\n    print(\"Connection problems. Contact the CTF organizers.\")\n```\nNo mention of any \"mFzaC==\"...",
    "1905891": "Your code is an old version of the starter notebook. The latest starter notebook is version 8 [here][1]\n\n[1]: https://www.kaggle.com/code/lucasjt/getting-started?scriptVersionId=103445167",
    "1925842": "I make the original \"mFzaC==\" to be correct b64. Then got the rest of the payload. Made it pass waf by adjusting it. I do not know enough about malicious exploits. Do I need to replace the sample payload with some other exploits to get the flag?"
  },
  "source": "meta"
}