Skip to content
This repository has been archived by the owner on Jan 17, 2024. It is now read-only.

Commit

Permalink
rev/simple-asm (#16)
Browse files Browse the repository at this point in the history
* t

* deployment fixes and some yaml + sol tweaks

---------

Co-authored-by: mud-ali <[email protected]>
  • Loading branch information
awt-256 and mud-ali authored Aug 27, 2023
1 parent 11f0b53 commit 71e70a3
Show file tree
Hide file tree
Showing 5 changed files with 98 additions and 0 deletions.
29 changes: 29 additions & 0 deletions no-asm-required/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
FROM --platform=linux/amd64 ubuntu@sha256:86ac87f73641c920fb42cc9612d4fb57b5626b56ea2a19b894d0673fd5b4f2e9 AS build

RUN apt-get update -y && apt-get install -y gcc wget unzip && rm -rf /var/lib/apt/lists/*

RUN wget -O ynetd.c https://raw.githubusercontent.com/johnsonjh/ynetd/master/ynetd.c \
&& gcc -o ynetd ynetd.c \
&& rm -f /tmp/ynetd.zip

COPY main.c .

RUN gcc -o chall main.c

FROM --platform=linux/amd64 ubuntu@sha256:86ac87f73641c920fb42cc9612d4fb57b5626b56ea2a19b894d0673fd5b4f2e9

RUN useradd -m -d /home/ctf -u 12345 ctf
WORKDIR /home/ctf

COPY --from=build chall chall
COPY --from=build ynetd ynetd

RUN chmod +x ./ynetd

COPY flag.txt .

RUN chown -R root:root /home/ctf

USER ctf
EXPOSE 9999
CMD ./ynetd -p 9999 ./chall
23 changes: 23 additions & 0 deletions no-asm-required/chall.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: No Assembly Required
categories:
- rev
value: 50
flag:
file: ./flag.txt
description: >-
That's right! This challenge works right out of the box!
No need to assemble anything, all totally preassembled.
hints:
- If it comes pre-assembled, all you can do is disassemble right?
- Have you heard of Ghidra?
files:
- src: /home/ctf/chall
dest: chall
container: nc
authors:
- Andrew
visible: true
deploy:
nc:
build: .
expose: 9999/tcp
1 change: 1 addition & 0 deletions no-asm-required/flag.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
camp{FACT:CPUs_arE_pRe_A5SEmbLed_too..._0caec8a70f9a2}
36 changes: 36 additions & 0 deletions no-asm-required/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#include <stdio.h>
#include <stdlib.h>

static int NO_ONE_WILL_EVER_FIND_THIS_mwahahahahaha = 0x6FED;

int main(int argv, char **argc) {

setvbuf(stdout, NULL, _IONBF, 0);
setvbuf(stdin, NULL, _IONBF, 0);
setvbuf(stderr, NULL, _IONBF, 0);

int lol = 0xf00d;

puts("Hey.");
sleep(1);
printf("Password? ");
int password = 0;
scanf("%d", &password);

int actual_password = lol | (NO_ONE_WILL_EVER_FIND_THIS_mwahahahahaha << 16);

if (actual_password == password) {
system("/bin/sh");
} else {
puts("Cool");
sleep(1);
puts("Yeah thats wrong!");
}

return 0;
}

//
// Hello people who solved this
// How does it feel to have shell haha
//
9 changes: 9 additions & 0 deletions no-asm-required/solve.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Decompile with Ghidra

Read the source code

figure out the password

enter it into the netcat, gaining shell access.

Run `ls`, followed by `cat flag.txt` to get the flag.

0 comments on commit 71e70a3

Please sign in to comment.