> For the complete documentation index, see [llms.txt](https://n3r.gitbook.io/6e3372/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://n3r.gitbook.io/6e3372/ctf-writeups/crackmes/pieismyfav.md).

# PieIsMyFav

<figure><img src="https://3637584725-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fvd4Xli3FqNh4SrZDWim8%2Fuploads%2FsytR3YmbgAsnt6lIg6Ru%2Fimage.png?alt=media&amp;token=c6edc8ba-23e0-45ce-ae52-c700125b5b2f" alt=""><figcaption></figcaption></figure>

***

## Solution

This challenge is pretty easy. Given an ELF file

<figure><img src="https://3637584725-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fvd4Xli3FqNh4SrZDWim8%2Fuploads%2FQvdogC77XaY8VfNhJhLg%2Fimage.png?alt=media&amp;token=6357127a-d7e4-49fe-853e-80c5b954fa3d" alt=""><figcaption></figcaption></figure>

It needs to validate a number, but not just any number.

<figure><img src="https://3637584725-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fvd4Xli3FqNh4SrZDWim8%2Fuploads%2Fb4zjwjZclJyjT5Jdrf0n%2Fimage.png?alt=media&amp;token=a76d6a6b-3f0c-4ce0-97fa-47b35ea37d19" alt=""><figcaption></figcaption></figure>

Dissamble the program using Ghidra, i can see it checks the number with some calculations

<figure><img src="https://3637584725-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fvd4Xli3FqNh4SrZDWim8%2Fuploads%2F0I1Ny0GkP79wjjkTo8XE%2Fimage.png?alt=media&amp;token=c868a367-ffa4-4fed-b9a9-f3137011d4ca" alt=""><figcaption><p>Line 17 is where the numbers are calculated</p></figcaption></figure>

To sum up, the calculation looks like this.

`number = (14 + 100 x 3) / 100`

So the number calculated is `3.42`

<figure><img src="https://3637584725-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fvd4Xli3FqNh4SrZDWim8%2Fuploads%2FQLNwIPQq7nUS0Qsg1dBA%2Fimage.png?alt=media&amp;token=12cff09c-6bd3-4be5-86f5-c2f1bab40263" alt=""><figcaption></figcaption></figure>

p/s: i know nothing about the language but im pretty sure it is portugese and it says "correct" :rofl:
