s4ch1n

Sting - ImaginaryCTF

Posted on

Description

Enter the beehive. Don't get stung.

Analysis

When opening the elf file in gdb, we can see that our input was being subtracted by constant 1 and then it was being compared with a string constant.

string constant: jdug|tus2oht`5s4ou`i2ee4o`28c32b7:~

So taking the string and subtracting with constant 1 gives us the flag.

Heres a quick snippet in C.

decode.c
#include <stdio.h>
#include <string.h>

int main() {
  char *string = "jdug|tus2oht`5s4ou`i2ee4o`28c32b7:~";
  int n = strlen(string);
  for (int i = 0; i < n; i++) {
    printf("%c", string[i] - 1);
  }
  return 0;
}
flag:
ictf{str1ngs_4r3nt_h1dd3n_17b21a69}