The dispatcher has five named branches. The default arm has no password check.
static_content is declared as /static/<string:group>/<string:filename>. Flask's <string:> URL converter forbids slashes inside either component, so the URL grammar pre-rejects multi-segment traversal in filename. Inside the handler, group switches over five cases:
@app.route("/static/<string:group>/<string:filename>", methods=['GET'])
def static_content(group, filename):
from flask import make_response
import re
group = re.sub(r'[^\w.-]+', '', group.lower())
filename = re.sub(r'[^\w.-]+', '', filename.lower())
if group == 'screenshot':
# Could be sensitive, follow password requirements
if datastore.data['settings']['application']['password'] and not flask_login.current_user.is_authenticated:
if not datastore.data['settings']['application'].get('shared_diff_access'):
abort(403)
# ... serve last-screenshot.png from the datastore
if group == 'favicon':
# Could be sensitive, follow password requirements
if datastore.data['settings']['application']['password'] and not flask_login.current_user.is_authenticated:
abort(403)
# ... serve favicon from the watch's data directory
if group == 'visual_selector_data':
# Could be sensitive, follow password requirements
if datastore.data['settings']['application']['password'] and not flask_login.current_user.is_authenticated:
abort(403)
# ... serve elements.deflate from the watch directory
if group == 'plugin':
# ... iterate registered plugins and serve their static files
# These files should be in our subdirectory
try:
return send_from_directory(f"static/{group}", path=filename)
except FileNotFoundError:
abort(404)
Three of the four named branches carry an explicit password gate. The fourth (plugin) walks the registered plugin list and serves files from each plugin's declared static directory. The unnamed fifth branch, the default fallthrough, has no password check because the legitimate set of values it serves is the contents of changedetectionio/static/: CSS, JavaScript, images, the sort of asset that ships to every visitor of every page before login. Static assets are public.
The author's authorization model is: the set of "sensitive" groups is enumerated, each enumerated case enforces its own password gate, and anything outside the enumeration is a public static asset by definition. The model is correct for the four values the author had in mind. The model assumes group is one of those four values or a directory name under static/. The model has no failure case for a group that is neither.
The character class admits the two characters that name a directory's parent
re.sub(r'[^\w.-]+', '', "..") returns "..". The class [^\w.-]+ strips any character that is not a word character, a period, or a hyphen. Both characters in .. are periods. Nothing is stripped.
.. matches none of the four named branches. The handler falls through to the default arm:
return send_from_directory(f"static/{group}", path=filename)
which expands, for group=".." and filename="flask_app.py", to:
return send_from_directory("static/..", path="flask_app.py")
send_from_directory joins the directory argument against the application root and normalises the result before joining the filename. static/.. normalises to changedetectionio/. The filename URL converter has already forbidden slashes in flask_app.py, so the join resolves to /app/changedetectionio/flask_app.py. Werkzeug's path-safety check confirms the result is inside the normalised base. The base was the parent of static/. The result is.
$ curl -i http://target:5000/static/%2e%2e/flask_app.py
HTTP/1.1 200 OK
Content-Type: text/x-python; charset=utf-8
Content-Length: 47214
import datetime
import flask_login
import locale
import os
import queue
import threading
import time
import timeago
...
The response body is the 1,164-line source of the handler the request just executed.
Thirty lines above, the same author wrote the strict version
static_flags is declared eleven lines below the URL-prefix middleware and thirty lines above static_content. It serves country-flag SVGs for the watch-status UI, and the URL it answers is /static/flags/<path:flag_path>:
@app.route("/static/flags/<path:flag_path>", methods=['GET'])
def static_flags(flag_path):
"""Handle flag icon files with subdirectories"""
from flask import make_response
import re
# flag_path comes in as "1x1/de.svg" or "4x3/de.svg"
if re.match(r'^(1x1|4x3)/[a-z0-9-]+\.svg$', flag_path.lower()):
parts = flag_path.lower().split('/')
if len(parts) != 2:
abort(404)
subdir = parts[0]
svg_file = parts[1]
# Extra validation: ensure subdir is exactly 1x1 or 4x3
if subdir not in ['1x1', '4x3']:
abort(404)
# Extra validation: ensure svg_file only contains safe characters
if not re.match(r'^[a-z0-9-]+\.svg$', svg_file):
abort(404)
try:
response = make_response(send_from_directory(f"static/flags/{subdir}", svg_file))
response.headers['Content-type'] = 'image/svg+xml'
response.headers['Cache-Control'] = 'max-age=86400, public'
return response
except FileNotFoundError:
abort(404)
else:
abort(404)
The route is declared with <path:flag_path>, which DOES permit slashes, so the handler is the only thing between the URL and the filesystem. It responds with four layers: an anchored match against an enumerated alternation, a split-and-recheck of length, an explicit subdir not in ['1x1', '4x3'] rejection, and a second anchored match on the filename half. Each layer narrows the accepted set against a value the author can name aloud.
static_content ships with none of these. The route converter is <string:filename> instead of <path:filename>, which carries one layer for free (no slashes inside the filename). The handler then applies one substitution, not a match, against a character class permissive enough to ship every value the author wanted plus every value they did not. The same author who, thirty lines above, wrote if subdir not in ['1x1', '4x3']: abort(404) against a set with two members did not write if group not in ['screenshot', 'favicon', 'visual_selector_data', 'plugin']: ... against a set with four.
Convention Is The Allowlist
The set of legitimate group values lives in the dispatcher's switch. The author knows the values; the values are the four if group == '...': string literals plus whatever subdirectory names exist under static/. None of those values contains a period. The author's mental model of group is "one of a dozen short identifiers."
The implemented model is "any string that survives re.sub(r'[^\w.-]+', '', x.lower())." This is the Convention Is The Allowlist shape applied to an HTTP route dispatcher. The spec author's implicit allowlist (the dispatcher's enumeration) is not the code's allowlist (the regex's character class). The set the code accepts is whatever the broad syntactic type admits, and the broad syntactic type was chosen for a different field.
The other field is filename. Filenames in changedetectionio/static/ include chart.min.js, pikaday.css, apexcharts.min.js, style.scss. Each has at least one period. The class [^\w.-]+ was the right shape for filename. The author then applied the same regex to group because the substitution call already existed two lines above and group is also a string the user controls. One field needed the period in the class. The other field shared it.
What the attacker can actually read
Flask's <string:filename> converter forbids slashes, so the traversal cannot ascend beyond changedetectionio/. The GHSA records this as the limitation that holds CVSS at 5.3 (C:L) and notes that the route "cannot traverse further to arbitrary system paths like /etc/passwd." The advisory does not enumerate what changedetectionio/ does contain. The relevant flat-file Python sources at that directory in 0.52.9:
| File |
What it carries |
flask_app.py |
every route, every handler, every middleware |
auth_decorator.py |
the login_optionally_required decorator and its session model |
is_safe_url.py |
the SSRF allowlist and the IANA-restricted-address logic |
validate_url.py |
URL parsing for the watch URL field |
notification_service.py |
the Apprise integration and the credential handling around it |
pluggy_interface.py |
the plugin loader and its trust model |
store.py |
the datastore layout and the on-disk key set |
forms.py |
every WTForms field, every validator, every choice constant |
html_tools.py |
every parser the watch pipeline hands untrusted HTML, XML, and RSS to |
The CVSS impact rating reflects what the attacker reads as a finished primitive. The map of every URL-fetching codepath, every IP-allowlist check, every parser the backend hands untrusted bytes to, and every authentication branch in the application is the input to whatever the attacker hunts next. The same project shipped CVE-2026-29039 (XPath unparsed-text() arbitrary file read), CVE-2026-41895 (XXE in the XPath helper), and CVE-2026-43891 (arbitrary local file read via backup restore) in the months that followed the 0.52.9 release. Each of those bugs lives in one of the files in the table above. The pre-patch source map was unauthenticated for anyone who knew the route existed.
The patch deletes the sanitizer that needed the period
- group = re.sub(r'[^\w.-]+', '', group.lower())
- filename = re.sub(r'[^\w.-]+', '', filename.lower())
+ # Strict sanitization: only allow a-z, 0-9, and underscore (blocks .. and other traversal)
+ group = re.sub(r'[^a-z0-9_-]+', '', group.lower())
+ filename = filename
+
+ # Additional safety: reject if sanitization resulted in empty strings
+ if not group or not filename:
+ abort(404)
Two lines removed, four lines added. The group regex's character class loses the period and gains an underscore (cosmetic, since \w already includes underscore in Python's re). The filename sanitizer is deleted; the author now trusts Flask's <string:filename> URL converter to forbid the slash and accepts whatever character set remains. The "two fields, one regex" regime becomes "two fields, two regimes." The fields had two different threat models all along.
The patch's own comment names the change: # Strict sanitization: only allow a-z, 0-9, and underscore (blocks .. and other traversal). The comment frames the pre-patch regex as "loose sanitization" that needed to be tightened. The pre-patch regex was not loose sanitization in the abstract. It was sanitization for filename that the author also ran on group because the line above was already running it.
The post-patch handler still does not enumerate the legitimate values of group. It still has no if group not in [...]: abort(404). It still dispatches the unknown-group case to the default send_from_directory arm with no password check. Anything that survives [^a-z0-9_-]+ and matches a subdirectory under static/ is served. The change closes the demonstrated chain; the dispatcher's open-set authorization model is unchanged. The character class is tighter; the convention is still the allowlist.
PoC: projectdiscovery/nuclei-templates.
The dot was in the character class because filenames have dots. The dispatcher tag did not. The regex shipped to both fields for two years anyway.