Semtex Level 2
Semtex Level 2 — a program checks your user ID; trick it into seeing a different one using function interception.
Table of Contents
Source: This content is aggregated from overthewire (MIT). Visit the original repository for the latest version.
Dynamic tricks
This program checks your user ID.
Perhaps you can trick it, so that it thinks you have a different one.
Think dynamically.
Reading Material
Study guide
Level map: the goal is to make the program believe you are a different user.
What this level teaches
Dynamic tricks: changing a program’s behaviour without changing the program.
Key ideas
- Library calls can be replaced. On Linux, the dynamic linker can be told to load your own version of a function before the system’s, so the program calls yours.
- Think dynamically. The page’s hint is to think about what happens at run time rather than in the file on disk.
- The reading link. The page points you to a search about Linux function interception.
- Limits. Setuid programs ignore some of these mechanisms for safety; understanding which is part of the challenge.
How to approach it
- Find which function the program uses to learn the user ID.
- Research function interception on Linux.
- Build and test a small replacement.
Why it matters
Interposition is used by profilers and debuggers as well as by malware.