일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 |
- picoCTF
- return address overflow
- CSRF
- spoofing
- OverTheWire Bandit Level 1 → Level 2
- 시스템해킹
- dns
- Bandit Level 1 → Level 2
- dreamhack
- AES
- bandit
- redirect
- shellcode
- Cube Root Attack
- weak key
- 웹해킹
- Montgomery Reduction
- 드림핵
- 암호학
- Franklin-Reiter Related Message Attack
- RSA Common Modulas Attack
- RSA
- Hastad
- pycrpytodome
- arp
- rao
- XSS
- overthewire
- Crypto
- cryptography
- Today
- Total
목록Dreamhack (20)
암호(수학) 등.. 공부한 거 잊을거 같아서 만든 블로그

문제 문제 파일 : libc-2.27.so, rop.c, rop rop.c // Name: rop.c // Compile: gcc -o rop rop.c -fno-PIE -no-pie #include #include int main() { char buf[0x30]; setvbuf(stdin, 0, _IONBF, 0); setvbuf(stdout, 0, _IONBF, 0); // Leak canary puts("[1] Leak Canary"); printf("Buf: "); read(0, buf, 0x100); printf("Buf: %s\n", buf); // Do ROP puts("[2] Input ROP payload"); printf("Buf: "); read(0, buf, 0x100); retu..

문제 풀이 제목과 내용을 입력하면 업로드를 해주는 페이지다. 아무 값을 입력하고 업로드 버튼을 누르면 위와 같은 화면이 나온다. 여기서 123은 입력했던 메모의 제목이다. 123을 누르면 입력했던 메모를 보여주는 것을 알 수 있다. 입력한 메모의 제목이 파일이름이 되는 것인지 확인하기위해 제목에 ../ 를 사용해서 Path Traversal를 하려고 했지만 위와 같은 에러가 난다. "..", "/", "./" 을 제목에 입력해서 확인하니 ".." 을 필터링 하는 것으로 보인다. 업로드한 메모를 확인해보면 name 파라미터 값에 메모의 제목값이 들어가는 것을 확인할 수 있다. 따라서 이 파라미터를 통해 Path Traversal를 해서 name 값을 ../flag.py 로 주면 놀랍게도 flag를 확인할 ..

문제 풀이 upload 페이지는 파일을 업로드 할 수 있는 페이지임을 알 수 있다. S 파일 형식을 .php 로 해서 위의 코드로 업로드를 했더니 .php 형식으로 업로드가 된 것을 확인할 수 있다. 또한 php파일의 코드가 작동되는 것을 알 수 있다. 따라서 이를 이용해서 공격을 할 수 있다. system : send 위 코드는 입력 값을 그대로 system 함수의 인자로 실행할 수 있게 되어 있는 웹쉘 코드이다. 업로드 후, 확인해보면 작동하는 것을 알 수 있다. flag가 저장되어 있는 파일이 flag.txt 인 것을 문제에서 알려주었으므로 find 를 통해 파일의 위치를 찾아봤다. flag.txt 의 위치가 / 인 것을 알았으므로 파일의 내용을 확인해보면 flag가 나오는 것을 확인할 수 있다.

문제 문제 파일 : app.py #!/usr/bin/env python3 import subprocess from flask import Flask, request, render_template, redirect from flag import FLAG APP = Flask(__name__) @APP.route('/') def index(): return render_template('index.html') @APP.route('/ping', methods=['GET', 'POST']) def ping(): if request.method == 'POST': host = request.form.get('host') cmd = f'ping -c 3 "{host}"' try: output = subproces..

문제 문제 파일 : main.js const express = require('express'); const app = express(); const mongoose = require('mongoose'); mongoose.connect('mongodb://localhost/main', { useNewUrlParser: true, useUnifiedTopology: true }); const db = mongoose.connection; // flag is in db, {'uid': 'admin', 'upw': 'DH{32alphanumeric}'} const BAN = ['admin', 'dh', 'admi']; filter = function(data){ const dump = JSON.stringi..

문제 문제 파일 : app.py #!/usr/bin/python3 from flask import Flask, request, render_template, g import sqlite3 import os import binascii app = Flask(__name__) app.secret_key = os.urandom(32) try: FLAG = open('./flag.txt', 'r').read() except: FLAG = '[**FLAG**]' DATABASE = "database.db" if os.path.exists(DATABASE) == False: db = sqlite3.connect(DATABASE) db.execute('create table users(userid char(100),..

문제 문제 파일 : rtl.c // Name: rtl.c // Compile: gcc -o rtl rtl.c -fno-PIE -no-pie #include #include const char* binsh = "/bin/sh"; int main() { char buf[0x30]; setvbuf(stdin, 0, _IONBF, 0); setvbuf(stdout, 0, _IONBF, 0); // Add system function to plt's entry system("echo 'system@plt"); // Leak canary printf("[1] Leak Canary\n"); printf("Buf: "); read(0, buf, 0x100); printf("Buf: %s\n", buf); // Over..

문제 문제 파일 : app.py #!/usr/bin/python3 from flask import Flask, request, render_template, make_response, redirect, url_for from selenium import webdriver import urllib import os app = Flask(__name__) app.secret_key = os.urandom(32) try: FLAG = open("./flag.txt", "r").read() except: FLAG = "[**FLAG**]" users = { 'guest': 'guest', 'admin': FLAG } session_storage = {} def read_url(url, cookie={"name"..