This repository has been archived by the owner on Jun 11, 2024. It is now read-only.
generated from BCACTF/chall-repo-template
-
Notifications
You must be signed in to change notification settings - Fork 0
binex/inaccessible #61
Merged
Merged
Changes from 3 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
FROM gcc:4.9 | ||
COPY inaccessible.c . | ||
RUN gcc -o chall inaccessible.c |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
name: Inaccessible | ||
categories: | ||
- binex | ||
value: 25 | ||
flag: bcactf{W0w_Y0u_m4d3_iT_b810c453a9ac9} | ||
description: |- | ||
I wrote a function to generate the flag, but don't | ||
worry, I bet you can't access it! | ||
hints: | ||
- you could reverse engineer the function, but it's | ||
not necessary | ||
- see if you can use any debugging tools to just | ||
call the function | ||
files: | ||
- src: /chall | ||
dest: inaccessible | ||
container: static | ||
deploy: | ||
static: | ||
build: . | ||
authors: | ||
- Marvin | ||
visible: true | ||
# TODO: verify deployment |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#include<stdio.h> | ||
#include <cstring> | ||
|
||
int c(int n) { | ||
if (n == 0) { | ||
return 1; | ||
} else { | ||
return ((2.0 * ((2 * n) - 1)) / (n + 1)) * (c(n - 1)); | ||
} | ||
} | ||
|
||
int f(int n) | ||
{ | ||
int a = 0, b = 1, c, i; | ||
if (n == 0) | ||
return a; | ||
for (i = 2; i <= n; i++) { | ||
c = a + b; | ||
a = b; | ||
b = c; | ||
} | ||
return b; | ||
} | ||
long b[37] = {-1,-82,-16,-6,-50,-264,-169,-378,-476,-550,-6586,-9792,-6524,-2639,-45140,-39480,-49507,-7752,-142154,-588555,-963248,-1133504,-2235246,-3616704,-3601200,-1820895,-2749852,-9534330,-15941099,-60738920,-57889567,-174264720,-140983120,-45623096,-719742270,-537492672,-676418876}; | ||
char i2[37] = {12,13,9,12,12,12,12,12,11,12,13,13,13,12,13,12,13,12,13,13,13,13,13,13,13,11,11,12,13,13,13,13,13,9,13,13,12}; | ||
char i4[37] = {4,3,6,4,3,5,0,5,6,2,0,1,2,1,0,5,1,4,3,4,3,2,3,2,4,6,6,5,1,5,4,3,3,6,1,0,4}; | ||
|
||
int win() { | ||
char out[40]; | ||
memset(out, 0, 40); | ||
|
||
for(int i = 0; i < 37; i++) { | ||
long k = b[i]/(f(i+1)); | ||
out[i] = k + f(i2[i]) + c(i4[i]); | ||
out[i] ^= 0xff; | ||
} | ||
printf("%s\n", out); | ||
} | ||
int main() { | ||
printf("No flag for you >:(\n"); | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
The function win() will print the flag, | ||
but the program just doesn't call it. | ||
|
||
You can use a program like gdb to debug | ||
and call the function. | ||
|
||
Example: | ||
|
||
(gdb) break main | ||
(set a breakpoint so that the | ||
program doesn't immediately end) | ||
(gdb) run | ||
(gdb) call win() |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
me when he includes a c++ library