Introducing The Sweep: OX’s New Live Security Research Series
Register Now
Breaking: The 2026 Vulnpocalypse Hits PHP: Four Critical RCEs, but How Dangerous Are They?
Read the Report
Are you exposed? Connect your apps in minutes.
Scan your apps free

vpndetection-flask

Latest version: v2.2.3

Overview

Last scanned
25 Nov 2026
Published
25 Nov 2026
PyPI package Publisher: mslm
1 Stars
0 Forks
31 Versions
2.3K Downloads
Python Repo language

Scan summary

vpndetection-flask was last scanned on 25 Nov 2026 at version 2.2.3. Risk score 0 of 100. No malicious behavior was detected.

  • Releases: 31 versions; the latest 5 were published within 4 days (22–25 Nov 2026).
  • Findings: No rules fired in version 2.2.3.
  • Downloads: 2,291 downloads.

Versions

31 versions published
Versions and the rules that fired in each
VersionPublishedStatus
2.2.3 LATEST 25 Nov 2026 No rules fired
2.2.2 24 Nov 2026 No rules fired
2.2.1 24 Nov 2026 No rules fired
2.2.0 23 Nov 2026 Not shown
2.1.29 22 Nov 2026 Not shown

No rules fired in 2.2.3

Findings

Findings for v2.2.3. The score is a capped sum of the weights of the rules that fired — not CVSS, not exploitability, and not a probability. It is not comparable across packages with different scan coverage.

The score describes 2.2.3; other versions have their own rules, not their own score.

README

The publisher’s own README, as collected from the registry.

VPNDetection Flask Extension

PyPI license

The official Flask extension for the VPNDetection API: it checks each visitor's IP for VPN, Tor and proxy use, and can block them with a 403.

It classifies the visitor behind each request: VPN, residential proxy, Tor, hosting, CDN or relay. Then it hands the answer to your code. Blocking is opt-in.

Getting Started

pip install vpndetection-flask

Requires Python 3.11 or newer.

No API key needed to start. Without one, a lookup is on Unlimited, the free plan, which answers VPN, Tor and relay detection with no daily or monthly cap. A paid plan's key adds the hosting, CDN and proxy flags and the provider behind each flag: create one in the console. A free account tries every field.

from flask import Flask
from vpndetection_flask import VPNDetection

app = Flask(__name__)
VPNDetection(app, api_key=os.environ["VPNDETECTION_API_KEY"])

init_app(app) is supported for the application-factory pattern.

from vpndetection_flask import lookup


@app.route("/")
def index():
    found = lookup()
    return "Hello, VPN user" if found.result.is_vpn else "Hello"

A request your skip claims gets no answer, and lookup() is None for it.

By default nothing is blocked. Every request gets an answer and your own code decides what to do with it, since whether a VPN visitor is a problem depends on what they're doing.

Blocking

Pass a block_condition and a matching request is answered with 403 and never reaches your code.

block_condition = {"is_vpn": True}

A condition is written in the shape of a result, keyed by the same names the API uses, and only the members you name are considered. That lets it reach the evidence, not just the flags:

{"is_vpn": True, "vpn": {"provider": "nordvpn"}}  # one provider
{"is_resproxy": True, "resproxy": {"hits": {"gte": 5}}}  # a numeric threshold
{"vpn": {"confidence": ["high", "medium"]}}  # any of these
[{"is_tor": True}, {"is_resproxy": True}]  # a list is OR

Values are matched by equality, strings without regard to case. A list means any-of. A dict of gte/gt/lte/lt compares numbers, and every bound you give must hold, so two of them are a range. A member the answer holds as a list (web, pubproxy.protocols, bittorrent.clients, bot.agents, bot.categories) matches when any one element does: {"pubproxy": {"protocols": "socks5"}} blocks a proxy that speaks SOCKS5 among others, and an object term such as {"web": {"port": 443}} must match a single row. Members set to False or None are ignored, so a condition states the signals you act on; one that constrains nothing would match every request, and is refused when the middleware is built rather than silently blocking all your traffic.

Replace the refusal with on_blocked.

Letting verified crawlers through

allow_bots=True sends each request's own User-Agent header with its lookup, and a request whose answer verifies that crawler, lookup().result.user_agent.verdict == "verified", is never refused, by block_condition or by block_if; the answer is still attached. A request with no User-Agent sends none. It is off by default, which keeps one cached answer per address rather than one per agent.

VPNDetection(
    app,
    api_key=os.environ["VPNDETECTION_API_KEY"],
    block_condition={"is_hosting": True},
    allow_bots=True,
)

With it on, a condition can name the verdict, refusing a forged crawler and a script: {"user_agent": {"verdict": ["spoofed", "not_bot"]}}. Only a paid plan's answer carries user_agent: a keyless client, or a free key past its trial, never gets a verdict and lets no crawler through, and the middleware warns once when that happens.

Blocking one view

block_condition applies to every view. To refuse a visitor on some views only, decorate them below the route, sync or async:

from vpndetection_flask import block_if


@app.get("/checkout")
@block_if({"is_vpn": True})
def checkout(): ...

block_if takes the same condition, on_blocked, fail_closed and on_missing_field. It judges the answer the extension already attached, so a visitor is looked up once however many views check them, and it warns once for a member your plan doesn't include. A request skip claimed reaches the view. The extension still has to be registered: on an app without it, a decorated view raises RuntimeError instead of letting everyone through.

Where the client address comes from

Get this setting right, or none of the above works.

By default the extension uses request.remote_addr, which is the socket peer unless you have wrapped the app in werkzeug's ProxyFix. Behind a load balancer without it, every visitor looks like the load balancer, and that is the address that gets checked: VPN visitors pass unnoticed, and if it is a hosting address, a hosting rule blocks everyone. A load balancer in your own network usually has a private address, which the extension answers locally without a lookup, flagging nobody and logging a warning. Adding ProxyFix is Flask's own answer and everything else here follows from it. It counts proxies from the right (x_for=1 believes the last X-Forwarded-For entry), so it is right only when the app cannot be reached except through those proxies: anyone who connects to the app directly writes that entry themselves.

For an edge that writes the address into its own header, name the header:

from vpndetection_flask import header_ip_selector

ip_selector = header_ip_selector("CF-Connecting-IP")  # or True-Client-IP, or your own

xff_ip_selector() reads X-Forwarded-For directly. The left-most entry is whatever the caller sent, since proxies append to that header, so trust it only when an edge you control overwrites it. If you know how many proxies sit in front, count from the right instead: xff_ip_selector(1) is the address your nearest proxy saw.

Anything else, pass your own callable. It receives the request and returns an address.

If the address resolves to a private one, the middleware says so once through the vpndetection logger. That is expected on localhost and is the signal to fix your configuration anywhere else.

When a lookup fails

The request is let through, and the reason is recorded on the answer's error. Our outage should not become yours, so a network failure, an exhausted quota or a rejected key all fail open. Pass fail_closed=True to block instead. Private addresses are answered locally and never fail, so this will not lock you out in development.

Cost and latency

Answers are cached for an hour, so a returning visitor costs nothing, and private addresses never leave the process. A cache miss is one request to our API, bounded at 2.5 seconds by default and not retried: on a request path, failing open fast beats holding a visitor while we retry. Both are adjustable, as is the cache, through a vpndetection client you build yourself and pass as client.

Skip what you do not care about:

skip = lambda request: request.path.startswith("/static")

Beyond a few million distinct visitors a day, stop calling the API per request: download the dataset and look addresses up locally instead.

Absent is not false

Unlimited, with a key or without one, leaves out is_hosting, is_cdn, the four proxy flags, the carrier, satellite and service flags, bot, company and abuse, and of the detail behind each flag it answers only Tor's and relay's. A field your plan does not include is None, which means "not in your plan" rather than "checked, and no".

lookup().result.is_hosting  # None when your plan does not include it

A block_condition naming a member your plan does not serve can never match, so the middleware warns once instead of failing silently. Pass on_missing_field="raise" to make it an error.

Other Libraries

There are official VPNDetection client libraries available for many languages including PHP, Python, Go, Java, Ruby, and many popular frameworks such as Django, Rails, and Laravel. See our GitHub at https://github.com/vpndetection-io for more.

About VPNDetection

VPN Detection API: Accurate anonymity detection identifying VPNs, residential proxies, hosting servers, Tor nodes, CDNs, relays and more.

License

This project is licensed under the MIT License.

OX Radar and Response Center

Find threats in your stack.

OX Radar can check high-priority threats, like critical package CVEs, against your context.

Each incident is marked Detected or Not Detected with a remediation plan and proof all tracked in the Response Center.

Where it’s listed

The probe returned only these fields for this server — auth requirement, protocol and tool list weren’t observed, so they’re not shown (never guessed).

  • pypi-releases vpndetection-flask

References

The publisher’s own links, as the registry reports them. These are not sources for the assessment on this page.

Scan your whole stack

Group 1261154050 1
Group 1261154050
 

From OX Research Newsroom

Copy of Template Design OX Blog (2)
Research

NGINX2Root: Five Critical NGINX Flaws Expose Web Servers to Remote Code Execution

Ethersphere Hijacked With Crypto Stealing Malware (1)
npm

Ethersphere Hijacked With Crypto Stealing Malware Via Github & npm

Vulnerability Insights

OpenSSH Password Authentication Bypass on Alpine Linux (*sshole) – CVE-2026-123158

Frame 2085668439 (1)
Group 1261154229