Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ; Dr Gareth Owen, University of Greenwich, England.
- ; Explanation: http://gchqchallenge.blogspot.com
- // licence file to contain
- // gchqcyberwinAAAABBBBCCCC
- int main(int argc, char **argv) {
- char buf[0x18];
- long *longPtr = NULL;
- if(argc != 1)
- {
- // display usage and exit
- }
- memset(buf, 0, 0x18); // clear buffer
- FILE *in = fopen("license.txt", "r");
- fscanf(in, "%s", buf); // buffer overflow vulnerability - tut tut!
- fclose(in);
- &longPtr = &buf;
- if(*longPtr != 0x71686367) // first 4 bytes = 'gchq'?
- {
- // error & exit
- }
- if(strcmp(crypt(buf[4], "hq"), "hqDTK7b8K2rvw")) { //hash next 8 bytes and compare with our hash
- // invalid code - exit
- }
- // everything has checked out - construct URL
- // of format /hqDTK7b8K2rvw/XX/XX/XX/key.txt
- // where XX, XX, XX are taken from next 3x four bytes of licence and produced as HEX
- // connect to hostname supplied on command line
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement