[CrackMe] BabyELF

BabyELF


                        _..--""""--...___                 .---,
                      ,' \               `'--.___        /   /
                     /`\  \                      ``''--:'`--'
                    (  ,'. '.              _____..--''`
                    )__/`-'._;__       .-'`
                     _/ e    /.-|     /
                     \        _/      |
                      |_,    (  \     /
                       \______\__\_.-'//////
                        |||||||||}////////;._
          __/\ _..----''````     \_       /  /.
         (    / |                  `'._---:./  '.
          '---\_;-...______.           '.   |_,  \  ===---
                        /               .`     '-'
                       /             _.'                ===---
                      /___.._  _..-'`\
                       /    /`'  \    '--.______ \
                      /    /      \         \   \#\
                      |   |        '---------'-. \#\
            ----------|  /----------------------\_\-\-----------------
                      |__|                         ._\
                   __.'  |
                  /______|       ..::::::::::::::::::::::::::..
                (___#__#____  .::::::::::::::::::::::::::::::::::'
                              '':::::::::::::::::::::::::::::'

Rules

  • Make the binary display Congrats!

  • Patch more than one byte and you’re disqualified. Don’t patch any instruction!


Binary

base64 -d dump | gunzip > babyelf
H4sICHM1MlsAA2JhYnllbGYA7VlvbFPXFb+24/whwTEUWCCsvHZQBaQYJzVZaDWwkxheWAJZcCjV
Fl4cPyfx8J/IfqYJHza2FFYLaFG7SfkyqVK1tZMmbd0+DE0aCQqCIe0DrdQJbftAt1ElZe1SlaFo
Gnjn3nfu83vXz4N92b5wJPu887vnnHvueee+d+993w737XM6HISTk+whVPK7g0wOIn5qk6ECWCep
g/8tZDOpBtlt0guSoIWvoGvOa1HPBb8q+HU6dbnTGbTwzajHucPE3cRMQQs/hx1wTohk2NFYvR4d
9XpGLDyIcchOq50T7VrQrgX1Ob+Bgd0QxleFvwj6i+C4OO9BvR6TPqWB25pKr0dqdHmkJmjhAdQL
CHZfA7tq8ujkRT6I/VXKyzKOi3N+H3YmE6MdgZ1JtTWZSOenWqc6O1o7Ar5cxtfOYvKi7v6DQ0yf
51HCmNcRvQZo++/uXj/2zy++tKr1qPvHo2+9eOK1Xxz6rgPtS5X5aFQPv7UVxmuHP1UBb62AV/K/
l/CKEQjyFKNp6SCT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9PFRUsR6mg
n8soE9G0CiEqvYegQU2klXwurppHR1ME8mguh671Y9kDJ5RBHGt3MprLsRqAUfOk03TYJoP4ctMp
LToKXMvqfIJfJdKgPUl86YwW94W6elu16DhK4+m8bzSfSKqtCZUwaSKamyA+dToN/nSuZfWWE/Fs
LpFJWwQF2rLxZJQq4tVkUqNdwvDopW88AxdafAr+2R31ZTPsJvniE1iEE2q2JOmmevHoFvz6m7Es
iyeaSsQIdav3pDuDPBIfzIsUFLDNbPzvib5P6buKP8dL35F0ebOgL35P+BKxnmGXvtPosiToVwly
m2DP150aAlsfYk/f7/dg7c/t+fp0Voif73+Mz1pI9Dy/3tQ/X8deROAdxOl+yUHK9ylHiL4X4vZ8
vTuCGyS+n+Ik5u8Y0fcy3J6vi6+gvUeI3ynw40TfG3GZr59vor2/Qvyc6HqnyuTP2I9hovk4xfxx
/GW070KZr8cltOf7QTfaiPavktK3RUr8PTKL9qbPpozE+18Q7Pn6fh4VRwR9r8C/L9jzfYCEAxbz
Jco/FOz5e9mP9k7hkNZrFclbgj1f3wRwg1wn6Ivj/wmxzl++vgii/ZMPsX9XsC99L8V4HmI/J9jz
/cws2t8V9MX80XUsrXF+nlD6fmqvL8p0ndRosufr4aZHtP8Q4+f2fP0tPaL9R0S/d9y+9H1bl/l3
bX5/uT2vg1mhf74vW2n8z/1z/nfB3livYwfBh9ivCPZ8/Rv0WuMU7Tk9QIzb83XjgNdeX3z+uRw6
5hdwbi/Wn3iOtsbUt5km8QCtQehQ7N9cu2Z6Bfu/gDeOzqOdxP6cyq7/JjzwOio4F7/H/xs0wYoi
QCIAAA==
7 Likes

I’m curious about the 4 bits patch. This is a basic 1 byte patch. Hope to get some time to look for the 4bits solution

echo -ne “\x26” | dd of=test1 seek=$((0x2b8 + 0x78)) bs=1 count=1 conv=notrunc

2 Likes

Oopsie! I had made a previous demo whose strings in the string table differed in distance so little that required 4-bit patching. Updated the description :sweat_smile:

Congrats on patching .dynsym like a boss :sunglasses:

2 Likes

I see, glad to see that I haven’t missed something obvious :slight_smile:
BTW, thanks for the challenge mate.

I love the smell of .dynsym in the morning

1 Like

I’m not sure if this was the intended way. Was fun though :smiley:

echo -ne “\x65” | dd of=babyelf seek=4152 bs=1 count=1 conv=notrunc

1 Like

Not bad at all :clap:

The intended patch required ELF mastery, but a patch is a patch. Feel free to look through the spoiler tags or try a lil’ harder :wink:

1 Like

Worked on a solution using LIEF :grin:

2 Likes

What fitting challenges :wink:

This one is about patching the right index for the string table in the st_name field in the .dynsym section for the second puts call. When looking at the assembly code the second puts looks more like an intended strcmp with the loading of ‘kek’ in the register right before the fubction call.

In the string table puts is index at 11, where as strcmp is at index 38. It’s enough to provide just the start of the string in the st_name field since those strings are null terminated and the replacement routine in the end does something like “[fromhere] until \0”

note: you actually can count the bytes for the correct replacement by hand if you found the right position :slight_smile:

dynsym

$ ./babyelf
kek
Congrats!

2 Likes

Nice control over your ELF structures @ricksanchez, gj :clap:

1 Like

LIEF is awesome and does wonders! gj :clap:

This topic was automatically closed after 30 days. New replies are no longer allowed.