> For the complete documentation index, see [llms.txt](https://picoctf2021.haydenhousen.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://picoctf2021.haydenhousen.com/web-exploitation/it-is-my-birthday.md).

# It is my Birthday

## Problem

> I sent out 2 invitations to all of my friends for my birthday! I'll know if they get stolen because the two invites look similar, and they even have the same md5 hash, but they are slightly different! You wouldn't believe how long it took me to find a collision. Anyway, see if you're invited by submitting 2 PDFs to my website. <http://mercury.picoctf.net:50970/>

## Solution

1. Find some PDFs that collide. I used [md5-1.pdf](https://github.com/corkami/collisions/blob/master/examples/free/md5-1.pdf) and [md5-1.pdf](https://github.com/corkami/collisions/blob/master/examples/free/md5-2.pdf).
2. Upload these PDFs to the server and get the PHP code and flag:

   ```php
   <?php
   if (isset($_POST["submit"])) {
       $type1 = $_FILES["file1"]["type"];
       $type2 = $_FILES["file2"]["type"];
       $size1 = $_FILES["file1"]["size"];
       $size2 = $_FILES["file2"]["size"];
       $SIZE_LIMIT = 18 * 1024;

       if (($size1 < $SIZE_LIMIT) && ($size2 < $SIZE_LIMIT)) {
           if (($type1 == "application/pdf") && ($type2 == "application/pdf")) {
               $contents1 = file_get_contents($_FILES["file1"]["tmp_name"]);
               $contents2 = file_get_contents($_FILES["file2"]["tmp_name"]);

               if ($contents1 != $contents2) {
                   if (md5_file($_FILES["file1"]["tmp_name"]) == md5_file($_FILES["file2"]["tmp_name"])) {
                       highlight_file("index.php");
                       die();
                   } else {
                       echo "MD5 hashes do not match!";
                       die();
                   }
               } else {
                   echo "Files are not different!";
                   die();
               }
           } else {
               echo "Not a PDF!";
               die();
           }
       } else {
           echo "File too large!";
           die();
       }
   }

   // FLAG: picoCTF{c0ngr4ts_u_r_1nv1t3d_73b0c8ad}

   ?>
   ```

### Flag

`picoCTF{c0ngr4ts_u_r_1nv1t3d_73b0c8ad}`


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://picoctf2021.haydenhousen.com/web-exploitation/it-is-my-birthday.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
