Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
205d9fc
fix: update errors as per convention
v1bh475u Mar 1, 2025
4090bdc
feat: add field for service config file name
v1bh475u Mar 1, 2025
c576137
mod: remove DOCKER CHALLENGE TYPE
v1bh475u Mar 1, 2025
e5976fa
feat: make servicefile and dockerfile optional fields
v1bh475u Mar 1, 2025
70732dc
mod: update mod and sum files
v1bh475u Mar 1, 2025
345f9af
refactor
v1bh475u Mar 1, 2025
a44ff20
mod: rename service_config to xinetd_conf
v1bh475u Mar 1, 2025
514a6ba
refactor
v1bh475u Mar 1, 2025
97df88a
feat: add XinetdConf field to BeastBareDockerfile and update entrypoi…
v1bh475u Mar 1, 2025
458f106
fix(stageChallenge): correct condition for Dockerfile deletion
v1bh475u Mar 1, 2025
7be6af4
update(static-chall): add static_dir to challenge_env
v1bh475u Mar 1, 2025
805db68
add(xinetd-service): sample chal with user xinetd.conf
v1bh475u Mar 1, 2025
afb19df
add(service): sample chal without author provided xinetd.conf
v1bh475u Mar 1, 2025
51fb2a5
update(dependencies): upgrade gorm and sqlite driver versions
v1bh475u Mar 1, 2025
978daa4
fix(challenge-config): loosen up constraints on config file
v1bh475u Apr 15, 2025
027cdd1
update: examples
v1bh475u Apr 15, 2025
e82d4c3
update(README): add descriptions of new challenges
v1bh475u Apr 15, 2025
a22fac1
mod: update dependencies and fix bugs
v1bh475u Apr 15, 2025
cc1f428
refactor: rename example challenge name for better understanding
v1bh475u Apr 16, 2025
7e15644
fix: correct link for bare docker challenge in README
v1bh475u Apr 16, 2025
22f1cc5
fix: correct typo in error log message for remote container search
v1bh475u Apr 16, 2025
cc4bf9b
fix: append challenge names to list in HandleAll function
v1bh475u Apr 17, 2025
508e4ed
Merge branch 'bl4ze/dev' into chall-type-separation
sukhman-sukh Jun 5, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion _examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@
* [PHP Web challenge](./web-php)
* [PHP Web challenge with MySQL](./web-php-mysql)
* [Challenge with Static files only](./static-chall)
* [Xinted Service challenge](./xinetd-service)
* [Xinted Service challenge with custom xinetd config](./xinetd-service)
* [Service challenge with auto-generated xinetd config](./service)
* [A bare challenge using docker](./bare-docker)

To test any of the above challenges, cd to \_example directory and use the below command:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ ssh_key = "ssh-rsa AAAAB3NzaC1y"
[challenge.metadata]
name = "docker-type"
flag = "FLAG{r3GEx_i5_3vi1!!}"
type = "docker"
type = "bare"
points = 200

[[challenge.metadata.hints]]
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
26 changes: 26 additions & 0 deletions _examples/service/beast.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
[author]
name = "fristonio"
email = "[email protected]"
ssh_key = "ssh-rsa AAAAB3NzaC1y"

[challenge.metadata]
name = "service"
flag = "CTF{sample_flag}"
type = "service"
points = 100
max_attempt_limit=10

[[challenge.metadata.hints]]
text = "simple_hint_1"
points = 10

[[challenge.metadata.hints]]
text = "simple_hint_2"
points = 20


[challenge.env]
apt_deps = ["gcc", "socat"]
setup_scripts = ["setup.sh"]
service_path = "pwn"
ports = [10004]
29 changes: 29 additions & 0 deletions _examples/service/pwn_me.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#include <stdio.h>
#include <unistd.h>

int sample()
{ FILE *ptr_file;
char buf[100];

ptr_file = fopen("flag.txt","r");
if (!ptr_file)
return 1;

while (fgets(buf,100, ptr_file)!=NULL)
fprintf(stderr, "%s",buf);
fclose(ptr_file);
return 0;
}

void test()
{ char input[50];
printf("Please enter your name: ");
gets(input);
sleep(1);
fprintf(stderr, "ECHO: %s\n",input);
}

int main()
{ test();
return 0;
}
3 changes: 3 additions & 0 deletions _examples/service/setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
set -e

gcc -o pwn pwn_me.c
3 changes: 3 additions & 0 deletions _examples/static-chall/beast.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,6 @@ points = 20
maxPoints = 100
minPoints = 50
tags = ["easy", "web"]

[challenge.env]
static_dir = "static"
9 changes: 5 additions & 4 deletions _examples/xinetd-service/beast.toml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
[author]
name = "fristonio"
email = "contact+fristonio@sdslabs.co.in"
name = "contact"
email = "[email protected]"
ssh_key = "ssh-rsa AAAAB3NzaC1y"

[challenge.metadata]
name = "xinetd-service"
flag = "CTF{sample_flag}"
flag = "CTF{not_the_flag}"
type = "service"
points = 100
points = 500
max_attempt_limit=10

[[challenge.metadata.hints]]
Expand All @@ -25,5 +25,6 @@ preReqs = ["simple", "web-php"]
[challenge.env]
apt_deps = ["gcc", "socat"]
setup_scripts = ["setup.sh"]
xinetd_config = "ctf.xinetd"
service_path = "pwn"
ports = [10003]
18 changes: 18 additions & 0 deletions _examples/xinetd-service/ctf.xinetd
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
service xinetd-service
{
disable = no
socket_type = stream
protocol = tcp
wait = no
user = beast
type = UNLISTED
port = 10003
bind = 0.0.0.0
server = /bin/sh
server_args = -c cd${IFS}/challenge;exec${IFS}/challenge/pwn
banner_fail = /etc/banner_fail
# Options below are for safety mainly
#per_source = 10 # max instances per source at once
rlimit_cpu = 5 # max cpu seconds
#rlimit_as = 1024M # addr space resource limit
}
1 change: 1 addition & 0 deletions _examples/xinetd-service/flag.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
CTF{not_the_flag}
2 changes: 2 additions & 0 deletions _examples/xinetd-service/pwn_me.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ int sample()

void test()
{ char input[50];
printf("Please enter your name: ");
fflush(stdout);
gets(input);
sleep(1);
fprintf(stderr, "ECHO: %s\n",input);
Expand Down
2 changes: 1 addition & 1 deletion api/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ func updateChallengeInfoHandler(c *gin.Context) {
// Update challenge
if e := database.UpdateChallenge(&chall, configInfo); e != nil {
c.JSON(http.StatusBadRequest, HTTPPlainResp{
Message: fmt.Sprintf("Error while updating challenge info: %s", err.Error()),
Message: fmt.Sprintf("Error while updating challenge info: %s", e.Error()),
})
return
}
Expand Down
8 changes: 4 additions & 4 deletions api/response.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ type HTTPPlainResp struct {
}

type HTTPPlainMapResp struct {
Messages map[string]string `json:"messages" example:"["name1": "message1"],["name2": "message2"]"`
Messages map[string]string `json:"messages" example:"{\"name1\": \"message1\", \"name2\": \"message2\"}"`
}

type HTTPErrorResp struct {
Expand All @@ -30,7 +30,7 @@ type AvailableImagesResp struct {
type PortsInUseResp struct {
MinPortValue uint32 `json:"port_min_value" example:"10000"`
MaxPortValue uint32 `json:"port_max_value" example:"20000"`
PortsInUse []uint32 `json:"ports_in_use" example:[100001, 100003, 10010]`
PortsInUse []uint32 `json:"ports_in_use" example:"[100001, 100003, 10010]"`
}

type ChallengeStatusResp struct {
Expand Down Expand Up @@ -119,7 +119,7 @@ type ChallengeInfoResp struct {
Status string `json:"status" example:"deployed"`
MaxAttemptLimit int `json:"maxAttemptLimit" example:"5"`
PreReqs []string `json:"preReqs" example:"['web-php','simple']"`
Ports []uint32 `json:"ports" example:[3001, 3002]`
Ports []uint32 `json:"ports" example:"[3001, 3002]"`
Hints []HintInfo `json:"hints"`
Desc string `json:"description" example:"A simple web challenge"`
Points uint `json:"points" example:"50"`
Expand All @@ -139,7 +139,7 @@ type ChallengePreviewResp struct {
AdditionalLinks []string `json:"additionalLinks" example:"['http://link1.abc:8080','http://link2.abc:8081']"`
MaxAttemptLimit int `json:"maxAttemptLimit" example:"5"`
PreReqs []string `json:"preReqs" example:"['web-php','simple']"`
Ports []uint32 `json:"ports" example:[3001, 3002]`
Ports []uint32 `json:"ports" example:"[3001, 3002]"`
Desc string `json:"description" example:"A simple web challenge"`
Points uint `json:"points" example:"50"`
DeployedLink string `json:"deployedLink" example:"beast.sdslabs.co"`
Expand Down
Loading