mirror of
https://github.com/cliffe/SecGen.git
synced 2026-02-22 19:58:03 +00:00
randomise salt for metactf ase challenges
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
#!/bin/zsh
|
||||
SALT=`date +%g`
|
||||
SALT=`date +%N`
|
||||
if [[ ARGC -gt 0 ]] then
|
||||
BINNAME=`basename $PWD`
|
||||
foreach USER ($@)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/bin/zsh
|
||||
|
||||
SALT=`date +%g`
|
||||
SALT=`date +%N`
|
||||
if [[ ARGC -gt 0 ]] then
|
||||
BINNAME=`basename $PWD`
|
||||
foreach USER ($@)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/bin/zsh
|
||||
|
||||
SALT=`date +%g`
|
||||
SALT=`date +%N`
|
||||
if [[ ARGC -gt 0 ]] then
|
||||
BINNAME=`basename $PWD`
|
||||
foreach USER ($@)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/bin/zsh
|
||||
|
||||
SALT=`date +%g`
|
||||
SALT=`date +%N`
|
||||
if [[ ARGC -gt 0 ]] then
|
||||
BINNAME=`basename $PWD`
|
||||
foreach USER ($@)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/bin/zsh
|
||||
|
||||
SALT=`date +%g`
|
||||
SALT=`date +%N`
|
||||
if [[ ARGC -gt 0 ]] then
|
||||
BINNAME=`basename $PWD`
|
||||
foreach USER ($@)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/bin/zsh
|
||||
|
||||
SALT=`date +%g`
|
||||
SALT=`date +%N`
|
||||
if [[ ARGC -gt 0 ]] then
|
||||
BINNAME=`basename $PWD`
|
||||
foreach USER ($@)
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
#!/bin/zsh
|
||||
|
||||
SALT=`date +%g`
|
||||
SALT=`date +%N`
|
||||
if [[ ARGC -gt 0 ]] then
|
||||
BINNAME=`basename $PWD`
|
||||
foreach USER ($@)
|
||||
mkdir -p obj/$USER
|
||||
HASH=`echo $USER $SALT $BINNAME | sha256sum | awk '{print $1}' | cut -c 1-2 | tr \[a-f\] \[A-F\]`
|
||||
AA=`echo "ibase=16;$HASH+20" | bc`
|
||||
BB=`echo $USER $SALT $BINNAME | openssl dgst -sha512 -binary | base64 | head -1 | tr -d /=+ | cut -c 1-3 | xxd -p | sed s/0a$/5a/`
|
||||
BB=`echo $USER $SALT $BINNAME | openssl dgst -sha512 -binary | base64 | head -1 | tr -d /=+ | cut -c 1-3 | xxd -p | sed s/0a$/5a/`
|
||||
cat program.c.template | sed s/AAAAAA/$AA/ >! program.c
|
||||
gcc -m32 -Wformat=0 -Wl,--section-start=.bss=0x$BB -o obj/$USER/$BINNAME program.c
|
||||
end
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/bin/zsh
|
||||
|
||||
SALT=`date +%g`
|
||||
SALT=`date +%N`
|
||||
if [[ ARGC -gt 0 ]] then
|
||||
BINNAME=`basename $PWD`
|
||||
foreach USER ($@)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/bin/zsh
|
||||
SALT=`date +%g`
|
||||
SALT=`date +%N`
|
||||
if [[ ARGC -gt 0 ]] then
|
||||
BINNAME=`basename $PWD`
|
||||
foreach USER ($@)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/bin/zsh
|
||||
SALT=`date +%g`
|
||||
SALT=`date +%N`
|
||||
if [[ ARGC -gt 0 ]] then
|
||||
BINNAME=`basename $PWD`
|
||||
foreach USER ($@)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/bin/zsh
|
||||
SALT=`date +%g`
|
||||
SALT=`date +%N`
|
||||
if [[ ARGC -gt 0 ]] then
|
||||
BINNAME=`basename $PWD`
|
||||
foreach USER ($@)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/bin/zsh
|
||||
SALT=`date +%g`
|
||||
SALT=`date +%N`
|
||||
if [[ ARGC -gt 0 ]] then
|
||||
BINNAME=`basename $PWD`
|
||||
foreach USER ($@)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/bin/zsh
|
||||
SALT=`date +%g`
|
||||
SALT=`date +%N`
|
||||
if [[ ARGC -gt 0 ]] then
|
||||
BINNAME=`basename $PWD`
|
||||
foreach USER ($@)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/bin/zsh
|
||||
SALT=`date +%g`
|
||||
SALT=`date +%N`
|
||||
if [[ ARGC -gt 0 ]] then
|
||||
BINNAME=`basename $PWD`
|
||||
foreach USER ($@)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/bin/zsh
|
||||
SALT=`date +%g`
|
||||
SALT=`date +%N`
|
||||
if [[ ARGC -gt 0 ]] then
|
||||
BINNAME=`basename $PWD`
|
||||
foreach USER ($@)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/bin/zsh
|
||||
SALT=`date +%g`
|
||||
SALT=`date +%N`
|
||||
if [[ ARGC -gt 0 ]] then
|
||||
BINNAME=`basename $PWD`
|
||||
foreach USER ($@)
|
||||
|
||||
@@ -1,19 +1,12 @@
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
|
||||
int main() {
|
||||
char name [20];
|
||||
char command [100];
|
||||
printf("This challenge has no password -- you need to exploit a weakness to access the flag\n");
|
||||
printf("A program is vulnerable to command injection if you can change "
|
||||
"the behaviour of software by inserting commands into input that get "
|
||||
"interpreted as commands for the program to execute.\n"
|
||||
"Hint: the input string is surrounded by quotes.\n\n");
|
||||
printf("A program is vulnerable to command injection if you can change the behaviour of software by inserting commands into input that get interpreted as commands for the program to execute.\n\n");
|
||||
printf("What is your name?\n");
|
||||
scanf("%19[^\n]s", &name);
|
||||
sprintf(command, "echo Hello '%s'; echo The time is "
|
||||
sprintf(command, "echo Hello %s; echo The time is "
|
||||
"currently:; date", name);
|
||||
setregid(getegid(),getegid());
|
||||
system(command);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user