{
  "id": 454373,
  "title": "Pixelated - bad OCR? Generate an adversarial image instead!",
  "content": "<p>I heard a lot of people are complaining about how bad the OCR is in the Pixelated problem. I feel the same, and was having a hard time making an image that the server will read correctly.</p>\n<p>Out of desperation, I took Huggingface TrOCR model, and generate an adversarial image using it. Suprisingly the server will decode my adversarial image with high accuracy, even when the encoded text is very long!</p>\n<p>To get the flag, I encoded the following string into my adversarial image:</p>\n<pre><code>801-867-5309truea\n</code></pre>\n<p>That string is encoded into the following generated image:</p>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F6873748%2F29165a9548497f2ac4383aed96898880%2Fpixelated-ans.png?generation=1699615029910302&amp;alt=media\" alt=\"\"></p>\n<p>Then voila, the server returned the flag!</p>\n<p>Another interesting point is I had difficulty sending a blank or empty string in a normal image, even when the image is blank. But using this adversarial image, we can generate an image that will be decoded as empty string. The image lead me to know that the content of <code>&lt;text&gt;</code> element should not be empty due to \"Invalid XML\" message.</p>\n<p>My code is a mess and currently lack of comment or description, but you can read it here <a href=\"https://www.kaggle.com/code/thariqnugrohotomo/ctf-defcon31-pixelated-ocr-image-generator/\" target=\"_blank\">https://www.kaggle.com/code/thariqnugrohotomo/ctf-defcon31-pixelated-ocr-image-generator/</a></p>",
  "comments": [
    {
      "id": 2520883,
      "author_name": "Pascal JACQ ",
      "author_url": "",
      "post_date": "2023-11-11T08:51:49.650000",
      "content": "<p>The best solution to pixelated! Very interesting findings ☺️</p>",
      "votes": 1,
      "replies": []
    },
    {
      "id": 2519369,
      "author_name": "Oleksiy Kononenko",
      "author_url": "",
      "post_date": "2023-11-10T00:30:07.610000",
      "content": "<p>I just used capital letters+space padding instead of small letters in the places where OCR had issues. At the end, this is what gave me the flag:</p>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F2099265%2F0b77c015fc5f683e9e3842c018b7ef2d%2F__results___75_0.png?generation=1699658081864954&amp;alt=media\" alt=\"\"></p>\n<p>\"rose\" is just some text you have to pass along. If interested in more details, here is <a href=\"https://www.kaggle.com/code/kononenko/ctf-a-silver-medal-journey-22-flags?scriptVersionId=150145838&amp;cellId=71\" target=\"_blank\">the full solution</a>.</p>",
      "votes": 2,
      "replies": []
    }
  ],
  "comment_count": 2,
  "messages": [
    {
      "id": 2519368,
      "postDate": "2023-11-10T00:28:25.893Z",
      "content": "<p>I heard a lot of people are complaining about how bad the OCR is in the Pixelated problem. I feel the same, and was having a hard time making an image that the server will read correctly.</p>\n<p>Out of desperation, I took Huggingface TrOCR model, and generate an adversarial image using it. Suprisingly the server will decode my adversarial image with high accuracy, even when the encoded text is very long!</p>\n<p>To get the flag, I encoded the following string into my adversarial image:</p>\n<pre><code>801-867-5309truea\n</code></pre>\n<p>That string is encoded into the following generated image:</p>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F6873748%2F29165a9548497f2ac4383aed96898880%2Fpixelated-ans.png?generation=1699615029910302&amp;alt=media\" alt=\"\"></p>\n<p>Then voila, the server returned the flag!</p>\n<p>Another interesting point is I had difficulty sending a blank or empty string in a normal image, even when the image is blank. But using this adversarial image, we can generate an image that will be decoded as empty string. The image lead me to know that the content of <code>&lt;text&gt;</code> element should not be empty due to \"Invalid XML\" message.</p>\n<p>My code is a mess and currently lack of comment or description, but you can read it here <a href=\"https://www.kaggle.com/code/thariqnugrohotomo/ctf-defcon31-pixelated-ocr-image-generator/\" target=\"_blank\">https://www.kaggle.com/code/thariqnugrohotomo/ctf-defcon31-pixelated-ocr-image-generator/</a></p>",
      "rawMarkdown": "I heard a lot of people are complaining about how bad the OCR is in the Pixelated problem. I feel the same, and was having a hard time making an image that the server will read correctly.\n\nOut of desperation, I took Huggingface TrOCR model, and generate an adversarial image using it. Suprisingly the server will decode my adversarial image with high accuracy, even when the encoded text is very long!\n\nTo get the flag, I encoded the following string into my adversarial image:\n\n```xml\n801-867-5309</text><is_admin>true</is_admin><text>a\n```\n\nThat string is encoded into the following generated image:\n\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F6873748%2F29165a9548497f2ac4383aed96898880%2Fpixelated-ans.png?generation=1699615029910302&alt=media)\n\nThen voila, the server returned the flag!\n\nAnother interesting point is I had difficulty sending a blank or empty string in a normal image, even when the image is blank. But using this adversarial image, we can generate an image that will be decoded as empty string. The image lead me to know that the content of `<text>` element should not be empty due to \"Invalid XML\" message.\n\nMy code is a mess and currently lack of comment or description, but you can read it here https://www.kaggle.com/code/thariqnugrohotomo/ctf-defcon31-pixelated-ocr-image-generator/\n\n",
      "votes": 14
    },
    {
      "id": 2520883,
      "postDate": "2023-11-11T08:51:49.650Z",
      "content": "<p>The best solution to pixelated! Very interesting findings ☺️</p>",
      "rawMarkdown": "The best solution to pixelated! Very interesting findings ☺️",
      "votes": 1
    },
    {
      "id": 2519369,
      "postDate": "2023-11-10T00:30:07.610Z",
      "content": "<p>I just used capital letters+space padding instead of small letters in the places where OCR had issues. At the end, this is what gave me the flag:</p>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F2099265%2F0b77c015fc5f683e9e3842c018b7ef2d%2F__results___75_0.png?generation=1699658081864954&amp;alt=media\" alt=\"\"></p>\n<p>\"rose\" is just some text you have to pass along. If interested in more details, here is <a href=\"https://www.kaggle.com/code/kononenko/ctf-a-silver-medal-journey-22-flags?scriptVersionId=150145838&amp;cellId=71\" target=\"_blank\">the full solution</a>.</p>",
      "rawMarkdown": "I just used capital letters+space padding instead of small letters in the places where OCR had issues. At the end, this is what gave me the flag:\n\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F2099265%2F0b77c015fc5f683e9e3842c018b7ef2d%2F__results___75_0.png?generation=1699658081864954&alt=media)\n\n \"rose\" is just some text you have to pass along. If interested in more details, here is [the full solution](https://www.kaggle.com/code/kononenko/ctf-a-silver-medal-journey-22-flags?scriptVersionId=150145838&cellId=71).",
      "votes": 2
    }
  ],
  "complete": true,
  "source": "live",
  "fetched_at": "2026-10-19T16:05:29Z",
  "competition_id": 57818,
  "competition_slug": "ai-village-capture-the-flag-defcon31",
  "team_id": 11044355,
  "solution_url": "/competitions/ai-village-capture-the-flag-defcon31/writeups/thariq-nugrohotomo-pixelated-bad-ocr-generate-an-a"
}