Problem

Description: I created a program for an unsolveable equation system. My friend somehow forced it to solve the equations. Can you tell me how he did it?

(exp60, solved by 252)

Service: 188.166.133.53:12049

Solution

Interacting with the server, we see the following:

  1. $ nc 188.166.133.53 12049
  2. Solve the following equations:
  3. X > 1337
  4. X * 7 + 4 = 1337
  5. Enter the solution X: 190
  6. You entered: 190
  7. 190 is not bigger than 1337
  8. WRONG!!!
  9. Go to school and learn some math!

I tried a couple of overflow/underflow things but I couldn’t get it right. So I bruteforced it instead with this C program:

  1. #include <stdio.h>
  2. #include <stdint.h>
  3. int test(int32_t a) {
  4. return ((a*7+4) == 1337);
  5. }
  6. void main() {
  7. int i = 0;
  8. while(++i != 0) {
  9. if (test(i)) {
  10. printf("found it: %d\n", i);
  11. }
  12. }
  13. printf("done. %d\n", i);
  14. }
  1. $ ./crack
  2. found it: 613566947
  3. $ nc 188.166.133.53 12049
  4. Solve the following equations:
  5. X > 1337
  6. X * 7 + 4 = 1337
  7. Enter the solution X: 613566947
  8. You entered: 613566947
  9. 613566947 is bigger than 1337
  10. 1337 is equal to 1337
  11. Well done!
  12. IW{Y4Y_0verfl0w}

Flag is IW{Y4Y_0verfl0w}.