[go: up one dir, main page]

My English-language Wikimedia user accounts:

Defence Signals Directorate (DSD) Solution

edit

DSD ad The last year I've noticed an ad from Australia's DSD keep appearing in the tech sites I've visited. I've decided to solve it after reading about the GCHQ challenge. I've posted it here since I don't have my own blog.

Step 1

edit

Write out the string provided and save it to a file (DSD-3line.txt). I initially had trouble with this by confusing 'l' (lowercase L) for 'I' (uppercase I):

6AAAAABbi8uDwx4zwDPSigOKETLCiAM
8AHQrg8EBg8MB6+wz/7/z+TEct0SlpGf5
dRyl53USYQEE56Ri7Kdkj8IAABkcOsw=

Step 2

edit

Decode the Base64 encoded string:

openssl base64 -d -in DSD-3line.txt -out DSD-3line.bin

Step 3

edit

Run the code. Initially I tried to link in the code using ld -r -b binary -o DSD-3line.o DSD-3line.bin, but had some trouble. After reading about the GCHQ challenge I've reused the technique explained in the solution. Compile program that will run the resulting code above (cyber.c):

#include <fcntl.h>
#include <stdio.h>
#include <sys/mman.h>
int main(int argc, char**argv)
{
   int fd;
   if (argv[1] == NULL) {
       fprintf(stderr, "%s: Argument required\n", argv[0]);
       return 1;
   }
   fd = open(argv[1], O_RDWR);
   if (fd < 0) {
       perror(argv[1]);
       return 1;
   }
   void *block = mmap(NULL, 4096, PROT_EXEC|PROT_READ|PROT_WRITE, MAP_SHARED|MAP_32BIT, fd, 0);
   if (block == MAP_FAILED) {
       perror("mmap");
       return 1;
   }
   __asm__
   (
      "call %%eax;"
      :
      : "a" (block)
   );
   return 0;
}

Step 4

edit

Execute what is in DSD-3line.bin:

./cyber DSD-3line.bin

Step 5

edit

Find the result:

strings DSD-3line.bin

I didn't apply for the position even though I live near Canberra, but it might help somebody who's interested.