Tags: tls cloudflare web ip python 

Poll rating:

Site is behind cloudflare. If you access it via a private IP address you get the flag

import os
import ipaddress

from flask import Flask, request
from gevent.pywsgi import WSGIServer

app = Flask(__name__)
flag = os.getenv('FLAG', default='dice{flag}')

@app.route('/')
def index():
    ip = ipaddress.ip_address(request.headers.get('CF-Connecting-IP'))

    if isinstance(ip, ipaddress.IPv4Address) and ip.is_private:
        return flag

    return f'No flag for {format(ip)}'

WSGIServer(('', 8080), app).serve_forever()

Writeups

ActionRatingAuthor team
Read writeup
not rated
bawolff
You need to authenticate and join a team to post writeups