Skip to content

Commit ae7bcb3

Browse files
author
Pongsakorn Sommalai
committedNov 24, 2020
Add readme lab detail and change gitignore
1 parent f2b53a4 commit ae7bcb3

File tree

5 files changed

+78
-143
lines changed

5 files changed

+78
-143
lines changed
 

‎.env.example

+2-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
FLAG=flag{ILoveYou}
1+
FLAG=flag{ILoveYou}
2+
PORT=1337

‎.gitignore

+1-138
Original file line numberDiff line numberDiff line change
@@ -1,138 +1 @@
1-
# Byte-compiled / optimized / DLL files
2-
__pycache__/
3-
*.py[cod]
4-
*$py.class
5-
6-
# C extensions
7-
*.so
8-
9-
# Distribution / packaging
10-
.Python
11-
build/
12-
develop-eggs/
13-
dist/
14-
downloads/
15-
eggs/
16-
.eggs/
17-
lib/
18-
lib64/
19-
parts/
20-
sdist/
21-
var/
22-
wheels/
23-
share/python-wheels/
24-
*.egg-info/
25-
.installed.cfg
26-
*.egg
27-
MANIFEST
28-
29-
# PyInstaller
30-
# Usually these files are written by a python script from a template
31-
# before PyInstaller builds the exe, so as to inject date/other infos into it.
32-
*.manifest
33-
*.spec
34-
35-
# Installer logs
36-
pip-log.txt
37-
pip-delete-this-directory.txt
38-
39-
# Unit test / coverage reports
40-
htmlcov/
41-
.tox/
42-
.nox/
43-
.coverage
44-
.coverage.*
45-
.cache
46-
nosetests.xml
47-
coverage.xml
48-
*.cover
49-
*.py,cover
50-
.hypothesis/
51-
.pytest_cache/
52-
cover/
53-
54-
# Translations
55-
*.mo
56-
*.pot
57-
58-
# Django stuff:
59-
*.log
60-
local_settings.py
61-
db.sqlite3
62-
db.sqlite3-journal
63-
64-
# Flask stuff:
65-
instance/
66-
.webassets-cache
67-
68-
# Scrapy stuff:
69-
.scrapy
70-
71-
# Sphinx documentation
72-
docs/_build/
73-
74-
# PyBuilder
75-
.pybuilder/
76-
target/
77-
78-
# Jupyter Notebook
79-
.ipynb_checkpoints
80-
81-
# IPython
82-
profile_default/
83-
ipython_config.py
84-
85-
# pyenv
86-
# For a library or package, you might want to ignore these files since the code is
87-
# intended to run in multiple environments; otherwise, check them in:
88-
# .python-version
89-
90-
# pipenv
91-
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92-
# However, in case of collaboration, if having platform-specific dependencies or dependencies
93-
# having no cross-platform support, pipenv may install dependencies that don't work, or not
94-
# install all needed dependencies.
95-
#Pipfile.lock
96-
97-
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
98-
__pypackages__/
99-
100-
# Celery stuff
101-
celerybeat-schedule
102-
celerybeat.pid
103-
104-
# SageMath parsed files
105-
*.sage.py
106-
107-
# Environments
108-
.env
109-
.venv
110-
env/
111-
venv/
112-
ENV/
113-
env.bak/
114-
venv.bak/
115-
116-
# Spyder project settings
117-
.spyderproject
118-
.spyproject
119-
120-
# Rope project settings
121-
.ropeproject
122-
123-
# mkdocs documentation
124-
/site
125-
126-
# mypy
127-
.mypy_cache/
128-
.dmypy.json
129-
dmypy.json
130-
131-
# Pyre type checker
132-
.pyre/
133-
134-
# pytype static type analyzer
135-
.pytype/
136-
137-
# Cython debug symbols
138-
cython_debug/
1+
.env

‎README.md

+71
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,73 @@
11
# Stack Buffer Overflow 101 Lab
22

3+
The very basic stack buffer overflow lab
4+
5+
## Let Play
6+
7+
Review source code [chall.c](/chall.c) and find a bug. Please hack this lab on your own environment. And then, get a real flag [ws://stack-buf-overflow-101-lab.herokuapp.com/](ws://stack-buf-overflow-101-lab.herokuapp.com/).
8+
9+
## WebSocket PWN
10+
11+
In heroku platform, we can deploy only web application. Thus, we deployed the PWN challenge using WebSocket protocol. Enjoy WebSocket below !
12+
13+
### netcat to wscat
14+
15+
Connect to lab app with wscat instead. To install wscat, NPM is required.
16+
17+
```
18+
$ npm install -g wscat
19+
$ wscat -c ws://echo.websocket.org
20+
Connected (press CTRL+C to quit)
21+
> hi there
22+
< hi there
23+
> are you a happy parrot?
24+
< are you a happy parrot?
25+
```
26+
27+
### pwnlib.tubes.remote.remote to sock_websocket.WebSock
28+
29+
Connect to lab app with sock_websocket.WebSock instead.
30+
31+
```
32+
$ pip install sock-websocket
33+
[...]
34+
$ cat echo.py
35+
from pwn import *
36+
from sock_websocket import WebSock
37+
38+
# s = process("chall")
39+
# s = remote("1.3.3.7", 1337)
40+
s = WebSock("ws://echo.websocket.org")
41+
s.sendline(b"Hello World !"))
42+
s.interactive()
43+
44+
$ python echo.py
45+
Hello World !
46+
<3
47+
<3
48+
```
49+
50+
## Running Locally
51+
52+
Make sure you have Python 3.7 [installed locally](http://install.python-guide.org). To push to Heroku, you'll need to install the [Heroku CLI](https://devcenter.heroku.com/articles/heroku-cli).
53+
54+
```sh
55+
$ git clone https://github.com/suam-team/stack-buf-overflow-101-lab.git
56+
$ cd stack-buf-overflow-101-lab
57+
$ docker build -t stack-buf-overflow-101-lab .
58+
$ docker run -d --rm -p 1337:1337 -e PORT=1337 -e FLAG=flag{ILoveU} stack-buf-overflow-101-lab
59+
```
60+
61+
Your app should now be running on [ws://localhost:1337](ws://localhost:1337).
62+
63+
## Deploying to Heroku
64+
65+
```sh
66+
$ heroku create
67+
$ heroku config:set FLAG=flag{ILoveU}
68+
$ git push heroku main
69+
$ heroku open
70+
```
71+
or
72+
73+
[![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy)

‎app.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "Stack Buffer Overflow 101 Lab",
3-
"description": "",
4-
"repository": "",
3+
"description": "The very basic stack buffer overflow lab",
4+
"repository": "https://github.com/suam-team/stack-buf-overflow-101-lab",
55
"logo": "https://suam.wtf/favicon-32x32.png",
66
"keywords": ["hacking", "lab", "pwn"],
77
"stack": "container"

‎lab.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
"name": "Stack Buffer Overflow 101 Lab",
33
"category": "PWN",
44
"author": "bongtrop",
5-
"flag": "",
6-
"detail": ""
5+
"flag": "237265834d5d5a8a85db6667378bbce0,f940d2439d16c0a1073677aeb093b2a8,a5dc574f3e46a52866178c79605fe925,5d407d4c125bf2e668c04138dccf0e51ed1f45f09a5feb58cb9caee0386d493ccb42088f5b4077a56ea95b477ce73f3f09821f860ded87cf17f70e94,c59d74b787aba8b557a9ea969c519cd1",
6+
"detail": "The very basic stack buffer overflow lab"
77
}

0 commit comments

Comments
 (0)
Please sign in to comment.