GHSA-W4H6-9WRP-V5JQ
Vulnerability from github – Published: 2024-05-09 15:13 – Updated: 2024-05-14 20:00Important: Exploiting this vulnerability requires the attacker to have access to your Frigate instance, which means they could also just delete all of your recordings or perform any other action. If you have configured authentication in front of Frigate via a reverse proxy, then this vulnerability is not exploitable without first getting around your authentication method. For many obvious reasons in addition to this one, please don't expose your Frigate instance publicly without any kind of authentication.
Summary
When uploading a file or retrieving the filename, a user may intentionally use a large Unicode filename which would lead to a application-level denial of service. This is due to no limitation set on the length of the filename and the costy use of the Unicode normalization with the form NFKD under the hood of secure_filename().
I idenfied multiple vulnerable paths on blakeblackshear/frigate repository. In all of those paths, it was possible for a malicious user to send a filename equals to the output of : python3 -c "print('℀' * 1_000_000)" which would reach the werkzeug secure_filename() call , which in turn under the hood uses a compatibility Unicode normalization with NFKC/NFKD form. In sum, the latter call would be costly in matter of CPU resource and may lead to the application-level denial of service.
Vulnerable Paths
Path with 2 steps 1. [frigate/api/media.py](https://github.com/blakeblackshear/frigate/blob/d7ae0eedf89e14f297093ac5c8042862034cbaeb/frigate/api/media.py#L379C20-L379C31)@MediaBp.route("/<camera_name>/start/<int:start_ts>/end/<int:end_ts>/clip.mp4")
@MediaBp.route("/<camera_name>/start/<float:start_ts>/end/<float:end_ts>/clip.mp4")
def recording_clip(camera_name, start_ts, end_ts):
download = request.args.get("download", type=bool)
2. [frigate/api/media.py](https://github.com/blakeblackshear/frigate/blob/d7ae0eedf89e14f297093ac5c8042862034cbaeb/frigate/api/media.py#L408C33-L408C78)
playlist_lines.append(f"outpoint {int(end_ts - clip.start_time)}")
file_name = secure_filename(f"clip_{camera_name}_{start_ts}-{end_ts}.mp4")
path = os.path.join(CACHE_DIR, file_name)
playlist_lines.append(f"outpoint {int(end_ts - clip.start_time)}")
file_name = secure_filename(f"clip_{camera_name}_{start_ts}-{end_ts}.mp4")
path = os.path.join(CACHE_DIR, file_name)
This user-provided value can reach a costly Unicode normalization operation.
Paths
Path with 2 steps 1. [frigate/api/media.py](https://github.com/blakeblackshear/frigate/blob/d7ae0eedf89e14f297093ac5c8042862034cbaeb/frigate/api/media.py#L379C33-L379C41)@MediaBp.route("/<camera_name>/start/<int:start_ts>/end/<int:end_ts>/clip.mp4")
@MediaBp.route("/<camera_name>/start/<float:start_ts>/end/<float:end_ts>/clip.mp4")
def recording_clip(camera_name, start_ts, end_ts):
download = request.args.get("download", type=bool)
2. [frigate/api/media.py](https://github.com/blakeblackshear/frigate/blob/d7ae0eedf89e14f297093ac5c8042862034cbaeb/frigate/api/media.py#L408C33-L408C78)
playlist_lines.append(f"outpoint {int(end_ts - clip.start_time)}")
file_name = secure_filename(f"clip_{camera_name}_{start_ts}-{end_ts}.mp4")
path = os.path.join(CACHE_DIR, file_name)
playlist_lines.append(f"outpoint {int(end_ts - clip.start_time)}")
file_name = secure_filename(f"clip_{camera_name}_{start_ts}-{end_ts}.mp4")
path = os.path.join(CACHE_DIR, file_name)
This user-provided value can reach a costly Unicode normalization operation.
Paths
Path with 2 steps 1. [frigate/api/media.py](https://github.com/blakeblackshear/frigate/blob/d7ae0eedf89e14f297093ac5c8042862034cbaeb/frigate/api/media.py#L379C43-L379C49)@MediaBp.route("/<camera_name>/start/<int:start_ts>/end/<int:end_ts>/clip.mp4")
@MediaBp.route("/<camera_name>/start/<float:start_ts>/end/<float:end_ts>/clip.mp4")
def recording_clip(camera_name, start_ts, end_ts):
download = request.args.get("download", type=bool)
2. [frigate/api/media.py](https://github.com/blakeblackshear/frigate/blob/d7ae0eedf89e14f297093ac5c8042862034cbaeb/frigate/api/media.py#L408C33-L408C78)
playlist_lines.append(f"outpoint {int(end_ts - clip.start_time)}")
file_name = secure_filename(f"clip_{camera_name}_{start_ts}-{end_ts}.mp4")
path = os.path.join(CACHE_DIR, file_name)
current_app.frigate_config,
camera_name,
secure_filename(name.replace(" ", "_")) if name else None,
int(start_time),
int(end_time),
This user-provided value can reach a costly Unicode normalization operation.
Paths
Path with 8 steps 1. [frigate/api/media.py](https://github.com/blakeblackshear/frigate/blob/d7ae0eedf89e14f297093ac5c8042862034cbaeb/frigate/api/media.py#L23C5-L23C12) jsonify,
make_response,
request,
)
from peewee import DoesNotExist, fn
2. [frigate/api/media.py](https://github.com/blakeblackshear/frigate/blob/d7ae0eedf89e14f297093ac5c8042862034cbaeb/frigate/api/media.py#L23C5-L23C12)
jsonify,
make_response,
request,
)
from peewee import DoesNotExist, fn
3. [frigate/api/media.py](https://github.com/blakeblackshear/frigate/blob/d7ae0eedf89e14f297093ac5c8042862034cbaeb/frigate/api/media.py#L620C28-L620C35)
)
json: dict[str, any] = request.get_json(silent=True) or {}
playback_factor = json.get("playback", "realtime")
name: Optional[str] = json.get("name")
4. [frigate/api/media.py](https://github.com/blakeblackshear/frigate/blob/d7ae0eedf89e14f297093ac5c8042862034cbaeb/frigate/api/media.py#L620C5-L620C9)
)
json: dict[str, any] = request.get_json(silent=True) or {}
playback_factor = json.get("playback", "realtime")
name: Optional[str] = json.get("name")
5. [frigate/api/media.py](https://github.com/blakeblackshear/frigate/blob/d7ae0eedf89e14f297093ac5c8042862034cbaeb/frigate/api/media.py#L622C27-L622C31)
json: dict[str, any] = request.get_json(silent=True) or {}
playback_factor = json.get("playback", "realtime")
name: Optional[str] = json.get("name")
recordings_count = (
6. [frigate/api/media.py](https://github.com/blakeblackshear/frigate/blob/d7ae0eedf89e14f297093ac5c8042862034cbaeb/frigate/api/media.py#L622C27-L622C43)
json: dict[str, any] = request.get_json(silent=True) or {}
playback_factor = json.get("playback", "realtime")
name: Optional[str] = json.get("name")
recordings_count = (
7. [frigate/api/media.py](https://github.com/blakeblackshear/frigate/blob/d7ae0eedf89e14f297093ac5c8042862034cbaeb/frigate/api/media.py#L622C5-L622C9)
json: dict[str, any] = request.get_json(silent=True) or {}
playback_factor = json.get("playback", "realtime")
name: Optional[str] = json.get("name")
recordings_count = (
8. [frigate/api/media.py](https://github.com/blakeblackshear/frigate/blob/d7ae0eedf89e14f297093ac5c8042862034cbaeb/frigate/api/media.py#L646C25-L646C47)
current_app.frigate_config,
camera_name,
secure_filename(name.replace(" ", "_")) if name else None,
int(start_time),
int(end_time),
def export_rename(file_name_current, file_name_new: str):
safe_file_name_current = secure_filename(
export_filename_check_extension(file_name_current)
)
file_current = os.path.join(EXPORT_DIR, safe_file_name_current)
This user-provided value can reach a costly Unicode normalization operation.
Paths
Path with 5 steps 1. [frigate/api/media.py](https://github.com/blakeblackshear/frigate/blob/d7ae0eedf89e14f297093ac5c8042862034cbaeb/frigate/api/media.py#L682C19-L682C36)
@MediaBp.route("/export/<file_name_current>/<file_name_new>", methods=["PATCH"])
def export_rename(file_name_current, file_name_new: str):
safe_file_name_current = secure_filename(
export_filename_check_extension(file_name_current)
2. [frigate/api/media.py](https://github.com/blakeblackshear/frigate/blob/d7ae0eedf89e14f297093ac5c8042862034cbaeb/frigate/api/media.py#L684C41-L684C58)
def export_rename(file_name_current, file_name_new: str):
safe_file_name_current = secure_filename(
export_filename_check_extension(file_name_current)
)
file_current = os.path.join(EXPORT_DIR, safe_file_name_current)
3. [frigate/api/media.py](https://github.com/blakeblackshear/frigate/blob/d7ae0eedf89e14f297093ac5c8042862034cbaeb/frigate/api/media.py#L667C37-L667C45)
def export_filename_check_extension(filename: str):
if filename.endswith(".mp4"):
return filename
4. [frigate/api/media.py](https://github.com/blakeblackshear/frigate/blob/d7ae0eedf89e14f297093ac5c8042862034cbaeb/frigate/api/media.py#L669C16-L669C24)
def export_filename_check_extension(filename: str):
if filename.endswith(".mp4"):
return filename
else:
return filename + ".mp4"
5. [frigate/api/media.py](https://github.com/blakeblackshear/frigate/blob/d7ae0eedf89e14f297093ac5c8042862034cbaeb/frigate/api/media.py#L684C9-L684C59)
def export_rename(file_name_current, file_name_new: str):
safe_file_name_current = secure_filename(
export_filename_check_extension(file_name_current)
)
file_current = os.path.join(EXPORT_DIR, safe_file_name_current)
Path with 5 steps
1. [frigate/api/media.py](https://github.com/blakeblackshear/frigate/blob/d7ae0eedf89e14f297093ac5c8042862034cbaeb/frigate/api/media.py#L682C19-L682C36)
@MediaBp.route("/export/<file_name_current>/<file_name_new>", methods=["PATCH"])
def export_rename(file_name_current, file_name_new: str):
safe_file_name_current = secure_filename(
export_filename_check_extension(file_name_current)
2. [frigate/api/media.py](https://github.com/blakeblackshear/frigate/blob/d7ae0eedf89e14f297093ac5c8042862034cbaeb/frigate/api/media.py#L684C41-L684C58)
def export_rename(file_name_current, file_name_new: str):
safe_file_name_current = secure_filename(
export_filename_check_extension(file_name_current)
)
file_current = os.path.join(EXPORT_DIR, safe_file_name_current)
3. [frigate/api/media.py](https://github.com/blakeblackshear/frigate/blob/d7ae0eedf89e14f297093ac5c8042862034cbaeb/frigate/api/media.py#L667C37-L667C45)
def export_filename_check_extension(filename: str):
if filename.endswith(".mp4"):
return filename
4. [frigate/api/media.py](https://github.com/blakeblackshear/frigate/blob/d7ae0eedf89e14f297093ac5c8042862034cbaeb/frigate/api/media.py#L671C16-L671C33)
return filename
else:
return filename + ".mp4"
5. [frigate/api/media.py](https://github.com/blakeblackshear/frigate/blob/d7ae0eedf89e14f297093ac5c8042862034cbaeb/frigate/api/media.py#L684C9-L684C59)
def export_rename(file_name_current, file_name_new: str):
safe_file_name_current = secure_filename(
export_filename_check_extension(file_name_current)
)
file_current = os.path.join(EXPORT_DIR, safe_file_name_current)
)
safe_file_name_new = secure_filename(export_filename_check_extension(file_name_new))
file_new = os.path.join(EXPORT_DIR, safe_file_name_new)
This user-provided value can reach a costly Unicode normalization operation.
Paths
Path with 5 steps 1. [frigate/api/media.py](https://github.com/blakeblackshear/frigate/blob/d7ae0eedf89e14f297093ac5c8042862034cbaeb/frigate/api/media.py#L682C38-L682C51)
@MediaBp.route("/export/<file_name_current>/<file_name_new>", methods=["PATCH"])
def export_rename(file_name_current, file_name_new: str):
safe_file_name_current = secure_filename(
export_filename_check_extension(file_name_current)
2. [frigate/api/media.py](https://github.com/blakeblackshear/frigate/blob/d7ae0eedf89e14f297093ac5c8042862034cbaeb/frigate/api/media.py#L705C74-L705C87)
)
safe_file_name_new = secure_filename(export_filename_check_extension(file_name_new))
file_new = os.path.join(EXPORT_DIR, safe_file_name_new)
3. [frigate/api/media.py](https://github.com/blakeblackshear/frigate/blob/d7ae0eedf89e14f297093ac5c8042862034cbaeb/frigate/api/media.py#L667C37-L667C45)
def export_filename_check_extension(filename: str):
if filename.endswith(".mp4"):
return filename
4. [frigate/api/media.py](https://github.com/blakeblackshear/frigate/blob/d7ae0eedf89e14f297093ac5c8042862034cbaeb/frigate/api/media.py#L669C16-L669C24)
def export_filename_check_extension(filename: str):
if filename.endswith(".mp4"):
return filename
else:
return filename + ".mp4"
5. [frigate/api/media.py](https://github.com/blakeblackshear/frigate/blob/d7ae0eedf89e14f297093ac5c8042862034cbaeb/frigate/api/media.py#L705C42-L705C88)
)
safe_file_name_new = secure_filename(export_filename_check_extension(file_name_new))
file_new = os.path.join(EXPORT_DIR, safe_file_name_new)
Path with 5 steps
1. [frigate/api/media.py](https://github.com/blakeblackshear/frigate/blob/d7ae0eedf89e14f297093ac5c8042862034cbaeb/frigate/api/media.py#L682C38-L682C51)
@MediaBp.route("/export/<file_name_current>/<file_name_new>", methods=["PATCH"])
def export_rename(file_name_current, file_name_new: str):
safe_file_name_current = secure_filename(
export_filename_check_extension(file_name_current)
2. [frigate/api/media.py](https://github.com/blakeblackshear/frigate/blob/d7ae0eedf89e14f297093ac5c8042862034cbaeb/frigate/api/media.py#L705C74-L705C87)
)
safe_file_name_new = secure_filename(export_filename_check_extension(file_name_new))
file_new = os.path.join(EXPORT_DIR, safe_file_name_new)
3. [frigate/api/media.py](https://github.com/blakeblackshear/frigate/blob/d7ae0eedf89e14f297093ac5c8042862034cbaeb/frigate/api/media.py#L667C37-L667C45)
def export_filename_check_extension(filename: str):
if filename.endswith(".mp4"):
return filename
4. [frigate/api/media.py](https://github.com/blakeblackshear/frigate/blob/d7ae0eedf89e14f297093ac5c8042862034cbaeb/frigate/api/media.py#L671C16-L671C33)
return filename
else:
return filename + ".mp4"
5. [frigate/api/media.py](https://github.com/blakeblackshear/frigate/blob/d7ae0eedf89e14f297093ac5c8042862034cbaeb/frigate/api/media.py#L705C42-L705C88)
)
safe_file_name_new = secure_filename(export_filename_check_extension(file_name_new))
file_new = os.path.join(EXPORT_DIR, safe_file_name_new)
@MediaBp.route("/export/<file_name>", methods=["DELETE"])
def export_delete(file_name: str):
safe_file_name = secure_filename(export_filename_check_extension(file_name))
file = os.path.join(EXPORT_DIR, safe_file_name)
This user-provided value can reach a costly Unicode normalization operation.
Paths
Path with 5 steps 1. [frigate/api/media.py](https://github.com/blakeblackshear/frigate/blob/d7ae0eedf89e14f297093ac5c8042862034cbaeb/frigate/api/media.py#L727C19-L727C28)
@MediaBp.route("/export/<file_name>", methods=["DELETE"])
def export_delete(file_name: str):
safe_file_name = secure_filename(export_filename_check_extension(file_name))
file = os.path.join(EXPORT_DIR, safe_file_name)
2. [frigate/api/media.py](https://github.com/blakeblackshear/frigate/blob/d7ae0eedf89e14f297093ac5c8042862034cbaeb/frigate/api/media.py#L728C70-L728C79)
@MediaBp.route("/export/<file_name>", methods=["DELETE"])
def export_delete(file_name: str):
safe_file_name = secure_filename(export_filename_check_extension(file_name))
file = os.path.join(EXPORT_DIR, safe_file_name)
3. [frigate/api/media.py](https://github.com/blakeblackshear/frigate/blob/d7ae0eedf89e14f297093ac5c8042862034cbaeb/frigate/api/media.py#L667C37-L667C45)
def export_filename_check_extension(filename: str):
if filename.endswith(".mp4"):
return filename
4. [frigate/api/media.py](https://github.com/blakeblackshear/frigate/blob/d7ae0eedf89e14f297093ac5c8042862034cbaeb/frigate/api/media.py#L669C16-L669C24)
def export_filename_check_extension(filename: str):
if filename.endswith(".mp4"):
return filename
else:
return filename + ".mp4"
5. [frigate/api/media.py](https://github.com/blakeblackshear/frigate/blob/d7ae0eedf89e14f297093ac5c8042862034cbaeb/frigate/api/media.py#L728C38-L728C80)
@MediaBp.route("/export/<file_name>", methods=["DELETE"])
def export_delete(file_name: str):
safe_file_name = secure_filename(export_filename_check_extension(file_name))
file = os.path.join(EXPORT_DIR, safe_file_name)
Path with 5 steps
1. [frigate/api/media.py](https://github.com/blakeblackshear/frigate/blob/d7ae0eedf89e14f297093ac5c8042862034cbaeb/frigate/api/media.py#L727C19-L727C28)
@MediaBp.route("/export/<file_name>", methods=["DELETE"])
def export_delete(file_name: str):
safe_file_name = secure_filename(export_filename_check_extension(file_name))
file = os.path.join(EXPORT_DIR, safe_file_name)
2. [frigate/api/media.py](https://github.com/blakeblackshear/frigate/blob/d7ae0eedf89e14f297093ac5c8042862034cbaeb/frigate/api/media.py#L728C70-L728C79)
@MediaBp.route("/export/<file_name>", methods=["DELETE"])
def export_delete(file_name: str):
safe_file_name = secure_filename(export_filename_check_extension(file_name))
file = os.path.join(EXPORT_DIR, safe_file_name)
3. [frigate/api/media.py](https://github.com/blakeblackshear/frigate/blob/d7ae0eedf89e14f297093ac5c8042862034cbaeb/frigate/api/media.py#L667C37-L667C45)
def export_filename_check_extension(filename: str):
if filename.endswith(".mp4"):
return filename
4. [frigate/api/media.py](https://github.com/blakeblackshear/frigate/blob/d7ae0eedf89e14f297093ac5c8042862034cbaeb/frigate/api/media.py#L671C16-L671C33)
return filename
else:
return filename + ".mp4"
5. [frigate/api/media.py](https://github.com/blakeblackshear/frigate/blob/d7ae0eedf89e14f297093ac5c8042862034cbaeb/frigate/api/media.py#L728C38-L728C80)
@MediaBp.route("/export/<file_name>", methods=["DELETE"])
def export_delete(file_name: str):
safe_file_name = secure_filename(export_filename_check_extension(file_name))
file = os.path.join(EXPORT_DIR, safe_file_name)
def preview_thumbnail(file_name: str):
"""Get a thumbnail from the cached preview frames."""
safe_file_name_current = secure_filename(file_name)
preview_dir = os.path.join(CACHE_DIR, "preview_frames")
This user-provided value can reach a costly Unicode normalization operation.
Paths
Path with 2 steps 1. [frigate/api/media.py](https://github.com/blakeblackshear/frigate/blob/d7ae0eedf89e14f297093ac5c8042862034cbaeb/frigate/api/media.py#L1344C23-L1344C32)@MediaBp.route("/preview/<file_name>/thumbnail.jpg")
@MediaBp.route("/preview/<file_name>/thumbnail.webp")
def preview_thumbnail(file_name: str):
"""Get a thumbnail from the cached preview frames."""
safe_file_name_current = secure_filename(file_name)
2. [frigate/api/media.py](https://github.com/blakeblackshear/frigate/blob/d7ae0eedf89e14f297093ac5c8042862034cbaeb/frigate/api/media.py#L1346C46-L1346C55)
def preview_thumbnail(file_name: str):
"""Get a thumbnail from the cached preview frames."""
safe_file_name_current = secure_filename(file_name)
preview_dir = os.path.join(CACHE_DIR, "preview_frames")
Impact
- Application-level Denial of Service, the web app would hung undefinetly and not process any further request due to the use of the malicious payload.
Mitigation
- Limiting the length of the incoming filename, similar to this commit fix.
References
- Similar to CVE-2023-46695
{
"affected": [
{
"package": {
"ecosystem": "PyPI",
"name": "frigate"
},
"ranges": [
{
"events": [
{
"introduced": "0"
},
{
"fixed": "0.13.2"
}
],
"type": "ECOSYSTEM"
}
]
}
],
"aliases": [
"CVE-2024-32874"
],
"database_specific": {
"cwe_ids": [
"CWE-770"
],
"github_reviewed": true,
"github_reviewed_at": "2024-05-09T15:13:49Z",
"nvd_published_at": "2024-05-14T15:37:13Z",
"severity": "CRITICAL"
},
"details": "**Important: Exploiting this vulnerability requires the attacker to have access to your Frigate instance, which means they could also just delete all of your recordings or perform any other action. If you have configured authentication in front of Frigate via a reverse proxy, then this vulnerability is not exploitable without first getting around your authentication method. For many obvious reasons in addition to this one, please don\u0027t expose your Frigate instance publicly without any kind of authentication.**\n\n## Summary\n\nWhen uploading a file or retrieving the filename, a user may intentionally use a large Unicode filename which would lead to a application-level denial of service. This is due to no limitation set on the length of the filename and the costy use of the Unicode normalization with the form NFKD under the hood of `secure_filename()`.\n\nI idenfied multiple vulnerable paths on [blakeblackshear/frigate](https://www.github.com/blakeblackshear/frigate/) repository. In all of those paths, it was possible for a malicious user to send a filename equals to the output of : `python3 -c \"print(\u0027\u2100\u0027 * 1_000_000)\"` which would reach the werkzeug `secure_filename()` call , which in turn under the hood uses a compatibility Unicode normalization with NFKC/NFKD form. In sum, the latter call would be costly in matter of CPU resource and may lead to the application-level denial of service. \n\n## Vulnerable Paths\n\n\u003cdetails\u003e\n\u003csummary\u003ePath with 2 steps\u003c/summary\u003e\n\n1. [frigate/api/media.py](https://github.com/blakeblackshear/frigate/blob/d7ae0eedf89e14f297093ac5c8042862034cbaeb/frigate/api/media.py#L379C20-L379C31)\n \u003cpre\u003e\u003ccode class=\"python\"\u003e@MediaBp.route(\"/\u0026lt;camera_name\u0026gt;/start/\u0026lt;int:start_ts\u0026gt;/end/\u0026lt;int:end_ts\u0026gt;/clip.mp4\")\n @MediaBp.route(\"/\u0026lt;camera_name\u0026gt;/start/\u0026lt;float:start_ts\u0026gt;/end/\u0026lt;float:end_ts\u0026gt;/clip.mp4\")\n def recording_clip(\u003cstrong\u003ecamera_name\u003c/strong\u003e, start_ts, end_ts):\n download = request.args.get(\"download\", type=bool)\n\n \u003c/code\u003e\u003c/pre\u003e\n\n2. [frigate/api/media.py](https://github.com/blakeblackshear/frigate/blob/d7ae0eedf89e14f297093ac5c8042862034cbaeb/frigate/api/media.py#L408C33-L408C78)\n \u003cpre\u003e\u003ccode class=\"python\"\u003e playlist_lines.append(f\"outpoint {int(end_ts - clip.start_time)}\")\n\n file_name = secure_filename(\u003cstrong\u003ef\"clip_{camera_name}_{start_ts}-{end_ts}.mp4\"\u003c/strong\u003e)\n path = os.path.join(CACHE_DIR, file_name)\n\n \u003c/code\u003e\u003c/pre\u003e\n\n\u003c/details\u003e\n\n----------------------------------------\n\n[frigate/api/media.py](https://github.com/blakeblackshear/frigate/blob/d7ae0eedf89e14f297093ac5c8042862034cbaeb/frigate/api/media.py#L408C33-L408C78)\n\n\u003cpre\u003e\u003ccode class=\"python\"\u003e playlist_lines.append(f\"outpoint {int(end_ts - clip.start_time)}\")\n\n file_name = secure_filename(\u003cstrong\u003ef\"clip_{camera_name}_{start_ts}-{end_ts}.mp4\"\u003c/strong\u003e)\n path = os.path.join(CACHE_DIR, file_name)\n\n\u003c/code\u003e\u003c/pre\u003e\n\n*This [user-provided value](https://github.com/blakeblackshear/frigate/blob/d7ae0eedf89e14f297093ac5c8042862034cbaeb/frigate/api/media.py#L379C33-L379C41) can reach a [costly Unicode normalization operation](https://github.com/blakeblackshear/frigate/blob/d7ae0eedf89e14f297093ac5c8042862034cbaeb/frigate/api/media.py#L408C33-L408C78).*\n\n#### Paths\n\n\u003cdetails\u003e\n\u003csummary\u003ePath with 2 steps\u003c/summary\u003e\n\n1. [frigate/api/media.py](https://github.com/blakeblackshear/frigate/blob/d7ae0eedf89e14f297093ac5c8042862034cbaeb/frigate/api/media.py#L379C33-L379C41)\n \u003cpre\u003e\u003ccode class=\"python\"\u003e@MediaBp.route(\"/\u0026lt;camera_name\u0026gt;/start/\u0026lt;int:start_ts\u0026gt;/end/\u0026lt;int:end_ts\u0026gt;/clip.mp4\")\n @MediaBp.route(\"/\u0026lt;camera_name\u0026gt;/start/\u0026lt;float:start_ts\u0026gt;/end/\u0026lt;float:end_ts\u0026gt;/clip.mp4\")\n def recording_clip(camera_name, \u003cstrong\u003estart_ts\u003c/strong\u003e, end_ts):\n download = request.args.get(\"download\", type=bool)\n\n \u003c/code\u003e\u003c/pre\u003e\n\n2. [frigate/api/media.py](https://github.com/blakeblackshear/frigate/blob/d7ae0eedf89e14f297093ac5c8042862034cbaeb/frigate/api/media.py#L408C33-L408C78)\n \u003cpre\u003e\u003ccode class=\"python\"\u003e playlist_lines.append(f\"outpoint {int(end_ts - clip.start_time)}\")\n\n file_name = secure_filename(\u003cstrong\u003ef\"clip_{camera_name}_{start_ts}-{end_ts}.mp4\"\u003c/strong\u003e)\n path = os.path.join(CACHE_DIR, file_name)\n\n \u003c/code\u003e\u003c/pre\u003e\n\n\u003c/details\u003e\n\n----------------------------------------\n\n[frigate/api/media.py](https://github.com/blakeblackshear/frigate/blob/d7ae0eedf89e14f297093ac5c8042862034cbaeb/frigate/api/media.py#L408C33-L408C78)\n\n\u003cpre\u003e\u003ccode class=\"python\"\u003e playlist_lines.append(f\"outpoint {int(end_ts - clip.start_time)}\")\n\n file_name = secure_filename(\u003cstrong\u003ef\"clip_{camera_name}_{start_ts}-{end_ts}.mp4\"\u003c/strong\u003e)\n path = os.path.join(CACHE_DIR, file_name)\n\n\u003c/code\u003e\u003c/pre\u003e\n\n*This [user-provided value](https://github.com/blakeblackshear/frigate/blob/d7ae0eedf89e14f297093ac5c8042862034cbaeb/frigate/api/media.py#L379C43-L379C49) can reach a [costly Unicode normalization operation](https://github.com/blakeblackshear/frigate/blob/d7ae0eedf89e14f297093ac5c8042862034cbaeb/frigate/api/media.py#L408C33-L408C78).*\n\n#### Paths\n\n\u003cdetails\u003e\n\u003csummary\u003ePath with 2 steps\u003c/summary\u003e\n\n1. [frigate/api/media.py](https://github.com/blakeblackshear/frigate/blob/d7ae0eedf89e14f297093ac5c8042862034cbaeb/frigate/api/media.py#L379C43-L379C49)\n \u003cpre\u003e\u003ccode class=\"python\"\u003e@MediaBp.route(\"/\u0026lt;camera_name\u0026gt;/start/\u0026lt;int:start_ts\u0026gt;/end/\u0026lt;int:end_ts\u0026gt;/clip.mp4\")\n @MediaBp.route(\"/\u0026lt;camera_name\u0026gt;/start/\u0026lt;float:start_ts\u0026gt;/end/\u0026lt;float:end_ts\u0026gt;/clip.mp4\")\n def recording_clip(camera_name, start_ts, \u003cstrong\u003eend_ts\u003c/strong\u003e):\n download = request.args.get(\"download\", type=bool)\n\n \u003c/code\u003e\u003c/pre\u003e\n\n2. [frigate/api/media.py](https://github.com/blakeblackshear/frigate/blob/d7ae0eedf89e14f297093ac5c8042862034cbaeb/frigate/api/media.py#L408C33-L408C78)\n \u003cpre\u003e\u003ccode class=\"python\"\u003e playlist_lines.append(f\"outpoint {int(end_ts - clip.start_time)}\")\n\n file_name = secure_filename(\u003cstrong\u003ef\"clip_{camera_name}_{start_ts}-{end_ts}.mp4\"\u003c/strong\u003e)\n path = os.path.join(CACHE_DIR, file_name)\n\n \u003c/code\u003e\u003c/pre\u003e\n\n\u003c/details\u003e\n\n----------------------------------------\n\n[frigate/api/media.py](https://github.com/blakeblackshear/frigate/blob/d7ae0eedf89e14f297093ac5c8042862034cbaeb/frigate/api/media.py#L646C25-L646C47)\n\n\u003cpre\u003e\u003ccode class=\"python\"\u003e current_app.frigate_config,\n camera_name,\n secure_filename(\u003cstrong\u003ename.replace(\" \", \"_\")\u003c/strong\u003e) if name else None,\n int(start_time),\n int(end_time),\n\u003c/code\u003e\u003c/pre\u003e\n\n*This [user-provided value](https://github.com/blakeblackshear/frigate/blob/d7ae0eedf89e14f297093ac5c8042862034cbaeb/frigate/api/media.py#L23C5-L23C12) can reach a [costly Unicode normalization operation](https://github.com/blakeblackshear/frigate/blob/d7ae0eedf89e14f297093ac5c8042862034cbaeb/frigate/api/media.py#L646C25-L646C47).*\n\n#### Paths\n\n\u003cdetails\u003e\n\u003csummary\u003ePath with 8 steps\u003c/summary\u003e\n\n1. [frigate/api/media.py](https://github.com/blakeblackshear/frigate/blob/d7ae0eedf89e14f297093ac5c8042862034cbaeb/frigate/api/media.py#L23C5-L23C12)\n \u003cpre\u003e\u003ccode class=\"python\"\u003e jsonify,\n make_response,\n \u003cstrong\u003erequest\u003c/strong\u003e,\n )\n from peewee import DoesNotExist, fn\n \u003c/code\u003e\u003c/pre\u003e\n\n2. [frigate/api/media.py](https://github.com/blakeblackshear/frigate/blob/d7ae0eedf89e14f297093ac5c8042862034cbaeb/frigate/api/media.py#L23C5-L23C12)\n \u003cpre\u003e\u003ccode class=\"python\"\u003e jsonify,\n make_response,\n \u003cstrong\u003erequest\u003c/strong\u003e,\n )\n from peewee import DoesNotExist, fn\n \u003c/code\u003e\u003c/pre\u003e\n\n3. [frigate/api/media.py](https://github.com/blakeblackshear/frigate/blob/d7ae0eedf89e14f297093ac5c8042862034cbaeb/frigate/api/media.py#L620C28-L620C35)\n \u003cpre\u003e\u003ccode class=\"python\"\u003e )\n\n json: dict[str, any] = \u003cstrong\u003erequest\u003c/strong\u003e.get_json(silent=True) or {}\n playback_factor = json.get(\"playback\", \"realtime\")\n name: Optional[str] = json.get(\"name\")\n \u003c/code\u003e\u003c/pre\u003e\n\n4. [frigate/api/media.py](https://github.com/blakeblackshear/frigate/blob/d7ae0eedf89e14f297093ac5c8042862034cbaeb/frigate/api/media.py#L620C5-L620C9)\n \u003cpre\u003e\u003ccode class=\"python\"\u003e )\n\n \u003cstrong\u003ejson\u003c/strong\u003e: dict[str, any] = request.get_json(silent=True) or {}\n playback_factor = json.get(\"playback\", \"realtime\")\n name: Optional[str] = json.get(\"name\")\n \u003c/code\u003e\u003c/pre\u003e\n\n5. [frigate/api/media.py](https://github.com/blakeblackshear/frigate/blob/d7ae0eedf89e14f297093ac5c8042862034cbaeb/frigate/api/media.py#L622C27-L622C31)\n \u003cpre\u003e\u003ccode class=\"python\"\u003e json: dict[str, any] = request.get_json(silent=True) or {}\n playback_factor = json.get(\"playback\", \"realtime\")\n name: Optional[str] = \u003cstrong\u003ejson\u003c/strong\u003e.get(\"name\")\n\n recordings_count = (\n \u003c/code\u003e\u003c/pre\u003e\n\n6. [frigate/api/media.py](https://github.com/blakeblackshear/frigate/blob/d7ae0eedf89e14f297093ac5c8042862034cbaeb/frigate/api/media.py#L622C27-L622C43)\n \u003cpre\u003e\u003ccode class=\"python\"\u003e json: dict[str, any] = request.get_json(silent=True) or {}\n playback_factor = json.get(\"playback\", \"realtime\")\n name: Optional[str] = \u003cstrong\u003ejson.get(\"name\")\u003c/strong\u003e\n\n recordings_count = (\n \u003c/code\u003e\u003c/pre\u003e\n\n7. [frigate/api/media.py](https://github.com/blakeblackshear/frigate/blob/d7ae0eedf89e14f297093ac5c8042862034cbaeb/frigate/api/media.py#L622C5-L622C9)\n \u003cpre\u003e\u003ccode class=\"python\"\u003e json: dict[str, any] = request.get_json(silent=True) or {}\n playback_factor = json.get(\"playback\", \"realtime\")\n \u003cstrong\u003ename\u003c/strong\u003e: Optional[str] = json.get(\"name\")\n\n recordings_count = (\n \u003c/code\u003e\u003c/pre\u003e\n\n8. [frigate/api/media.py](https://github.com/blakeblackshear/frigate/blob/d7ae0eedf89e14f297093ac5c8042862034cbaeb/frigate/api/media.py#L646C25-L646C47)\n \u003cpre\u003e\u003ccode class=\"python\"\u003e current_app.frigate_config,\n camera_name,\n secure_filename(\u003cstrong\u003ename.replace(\" \", \"_\")\u003c/strong\u003e) if name else None,\n int(start_time),\n int(end_time),\n \u003c/code\u003e\u003c/pre\u003e\n\n\u003c/details\u003e\n\n----------------------------------------\n\n[frigate/api/media.py](https://github.com/blakeblackshear/frigate/blob/d7ae0eedf89e14f297093ac5c8042862034cbaeb/frigate/api/media.py#L684C9-L684C59)\n\n\u003cpre\u003e\u003ccode class=\"python\"\u003edef export_rename(file_name_current, file_name_new: str):\n safe_file_name_current = secure_filename(\n \u003cstrong\u003eexport_filename_check_extension(file_name_current)\u003c/strong\u003e\n )\n file_current = os.path.join(EXPORT_DIR, safe_file_name_current)\n\u003c/code\u003e\u003c/pre\u003e\n\n*This [user-provided value](https://github.com/blakeblackshear/frigate/blob/d7ae0eedf89e14f297093ac5c8042862034cbaeb/frigate/api/media.py#L682C19-L682C36) can reach a [costly Unicode normalization operation](https://github.com/blakeblackshear/frigate/blob/d7ae0eedf89e14f297093ac5c8042862034cbaeb/frigate/api/media.py#L684C9-L684C59).*\n\n#### Paths\n\n\u003cdetails\u003e\n\u003csummary\u003ePath with 5 steps\u003c/summary\u003e\n\n1. [frigate/api/media.py](https://github.com/blakeblackshear/frigate/blob/d7ae0eedf89e14f297093ac5c8042862034cbaeb/frigate/api/media.py#L682C19-L682C36)\n \u003cpre\u003e\u003ccode class=\"python\"\u003e\n @MediaBp.route(\"/export/\u0026lt;file_name_current\u0026gt;/\u0026lt;file_name_new\u0026gt;\", methods=[\"PATCH\"])\n def export_rename(\u003cstrong\u003efile_name_current\u003c/strong\u003e, file_name_new: str):\n safe_file_name_current = secure_filename(\n export_filename_check_extension(file_name_current)\n \u003c/code\u003e\u003c/pre\u003e\n\n2. [frigate/api/media.py](https://github.com/blakeblackshear/frigate/blob/d7ae0eedf89e14f297093ac5c8042862034cbaeb/frigate/api/media.py#L684C41-L684C58)\n \u003cpre\u003e\u003ccode class=\"python\"\u003edef export_rename(file_name_current, file_name_new: str):\n safe_file_name_current = secure_filename(\n export_filename_check_extension(\u003cstrong\u003efile_name_current\u003c/strong\u003e)\n )\n file_current = os.path.join(EXPORT_DIR, safe_file_name_current)\n \u003c/code\u003e\u003c/pre\u003e\n\n3. [frigate/api/media.py](https://github.com/blakeblackshear/frigate/blob/d7ae0eedf89e14f297093ac5c8042862034cbaeb/frigate/api/media.py#L667C37-L667C45)\n \u003cpre\u003e\u003ccode class=\"python\"\u003e\n\n def export_filename_check_extension(\u003cstrong\u003efilename\u003c/strong\u003e: str):\n if filename.endswith(\".mp4\"):\n return filename\n \u003c/code\u003e\u003c/pre\u003e\n\n4. [frigate/api/media.py](https://github.com/blakeblackshear/frigate/blob/d7ae0eedf89e14f297093ac5c8042862034cbaeb/frigate/api/media.py#L669C16-L669C24)\n \u003cpre\u003e\u003ccode class=\"python\"\u003edef export_filename_check_extension(filename: str):\n if filename.endswith(\".mp4\"):\n return \u003cstrong\u003efilename\u003c/strong\u003e\n else:\n return filename + \".mp4\"\n \u003c/code\u003e\u003c/pre\u003e\n\n5. [frigate/api/media.py](https://github.com/blakeblackshear/frigate/blob/d7ae0eedf89e14f297093ac5c8042862034cbaeb/frigate/api/media.py#L684C9-L684C59)\n \u003cpre\u003e\u003ccode class=\"python\"\u003edef export_rename(file_name_current, file_name_new: str):\n safe_file_name_current = secure_filename(\n \u003cstrong\u003eexport_filename_check_extension(file_name_current)\u003c/strong\u003e\n )\n file_current = os.path.join(EXPORT_DIR, safe_file_name_current)\n \u003c/code\u003e\u003c/pre\u003e\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003ePath with 5 steps\u003c/summary\u003e\n\n1. [frigate/api/media.py](https://github.com/blakeblackshear/frigate/blob/d7ae0eedf89e14f297093ac5c8042862034cbaeb/frigate/api/media.py#L682C19-L682C36)\n \u003cpre\u003e\u003ccode class=\"python\"\u003e\n @MediaBp.route(\"/export/\u0026lt;file_name_current\u0026gt;/\u0026lt;file_name_new\u0026gt;\", methods=[\"PATCH\"])\n def export_rename(\u003cstrong\u003efile_name_current\u003c/strong\u003e, file_name_new: str):\n safe_file_name_current = secure_filename(\n export_filename_check_extension(file_name_current)\n \u003c/code\u003e\u003c/pre\u003e\n\n2. [frigate/api/media.py](https://github.com/blakeblackshear/frigate/blob/d7ae0eedf89e14f297093ac5c8042862034cbaeb/frigate/api/media.py#L684C41-L684C58)\n \u003cpre\u003e\u003ccode class=\"python\"\u003edef export_rename(file_name_current, file_name_new: str):\n safe_file_name_current = secure_filename(\n export_filename_check_extension(\u003cstrong\u003efile_name_current\u003c/strong\u003e)\n )\n file_current = os.path.join(EXPORT_DIR, safe_file_name_current)\n \u003c/code\u003e\u003c/pre\u003e\n\n3. [frigate/api/media.py](https://github.com/blakeblackshear/frigate/blob/d7ae0eedf89e14f297093ac5c8042862034cbaeb/frigate/api/media.py#L667C37-L667C45)\n \u003cpre\u003e\u003ccode class=\"python\"\u003e\n\n def export_filename_check_extension(\u003cstrong\u003efilename\u003c/strong\u003e: str):\n if filename.endswith(\".mp4\"):\n return filename\n \u003c/code\u003e\u003c/pre\u003e\n\n4. [frigate/api/media.py](https://github.com/blakeblackshear/frigate/blob/d7ae0eedf89e14f297093ac5c8042862034cbaeb/frigate/api/media.py#L671C16-L671C33)\n \u003cpre\u003e\u003ccode class=\"python\"\u003e return filename\n else:\n return \u003cstrong\u003efilename + \".mp4\"\u003c/strong\u003e\n\n\n \u003c/code\u003e\u003c/pre\u003e\n\n5. [frigate/api/media.py](https://github.com/blakeblackshear/frigate/blob/d7ae0eedf89e14f297093ac5c8042862034cbaeb/frigate/api/media.py#L684C9-L684C59)\n \u003cpre\u003e\u003ccode class=\"python\"\u003edef export_rename(file_name_current, file_name_new: str):\n safe_file_name_current = secure_filename(\n \u003cstrong\u003eexport_filename_check_extension(file_name_current)\u003c/strong\u003e\n )\n file_current = os.path.join(EXPORT_DIR, safe_file_name_current)\n \u003c/code\u003e\u003c/pre\u003e\n\n\u003c/details\u003e\n\n----------------------------------------\n\n[frigate/api/media.py](https://github.com/blakeblackshear/frigate/blob/d7ae0eedf89e14f297093ac5c8042862034cbaeb/frigate/api/media.py#L705C42-L705C88)\n\n\u003cpre\u003e\u003ccode class=\"python\"\u003e )\n\n safe_file_name_new = secure_filename(\u003cstrong\u003eexport_filename_check_extension(file_name_new)\u003c/strong\u003e)\n file_new = os.path.join(EXPORT_DIR, safe_file_name_new)\n\n\u003c/code\u003e\u003c/pre\u003e\n\n*This [user-provided value](https://github.com/blakeblackshear/frigate/blob/d7ae0eedf89e14f297093ac5c8042862034cbaeb/frigate/api/media.py#L682C38-L682C51) can reach a [costly Unicode normalization operation](https://github.com/blakeblackshear/frigate/blob/d7ae0eedf89e14f297093ac5c8042862034cbaeb/frigate/api/media.py#L705C42-L705C88).*\n\n#### Paths\n\n\u003cdetails\u003e\n\u003csummary\u003ePath with 5 steps\u003c/summary\u003e\n\n1. [frigate/api/media.py](https://github.com/blakeblackshear/frigate/blob/d7ae0eedf89e14f297093ac5c8042862034cbaeb/frigate/api/media.py#L682C38-L682C51)\n \u003cpre\u003e\u003ccode class=\"python\"\u003e\n @MediaBp.route(\"/export/\u0026lt;file_name_current\u0026gt;/\u0026lt;file_name_new\u0026gt;\", methods=[\"PATCH\"])\n def export_rename(file_name_current, \u003cstrong\u003efile_name_new\u003c/strong\u003e: str):\n safe_file_name_current = secure_filename(\n export_filename_check_extension(file_name_current)\n \u003c/code\u003e\u003c/pre\u003e\n\n2. [frigate/api/media.py](https://github.com/blakeblackshear/frigate/blob/d7ae0eedf89e14f297093ac5c8042862034cbaeb/frigate/api/media.py#L705C74-L705C87)\n \u003cpre\u003e\u003ccode class=\"python\"\u003e )\n\n safe_file_name_new = secure_filename(export_filename_check_extension(\u003cstrong\u003efile_name_new\u003c/strong\u003e))\n file_new = os.path.join(EXPORT_DIR, safe_file_name_new)\n\n \u003c/code\u003e\u003c/pre\u003e\n\n3. [frigate/api/media.py](https://github.com/blakeblackshear/frigate/blob/d7ae0eedf89e14f297093ac5c8042862034cbaeb/frigate/api/media.py#L667C37-L667C45)\n \u003cpre\u003e\u003ccode class=\"python\"\u003e\n\n def export_filename_check_extension(\u003cstrong\u003efilename\u003c/strong\u003e: str):\n if filename.endswith(\".mp4\"):\n return filename\n \u003c/code\u003e\u003c/pre\u003e\n\n4. [frigate/api/media.py](https://github.com/blakeblackshear/frigate/blob/d7ae0eedf89e14f297093ac5c8042862034cbaeb/frigate/api/media.py#L669C16-L669C24)\n \u003cpre\u003e\u003ccode class=\"python\"\u003edef export_filename_check_extension(filename: str):\n if filename.endswith(\".mp4\"):\n return \u003cstrong\u003efilename\u003c/strong\u003e\n else:\n return filename + \".mp4\"\n \u003c/code\u003e\u003c/pre\u003e\n\n5. [frigate/api/media.py](https://github.com/blakeblackshear/frigate/blob/d7ae0eedf89e14f297093ac5c8042862034cbaeb/frigate/api/media.py#L705C42-L705C88)\n \u003cpre\u003e\u003ccode class=\"python\"\u003e )\n\n safe_file_name_new = secure_filename(\u003cstrong\u003eexport_filename_check_extension(file_name_new)\u003c/strong\u003e)\n file_new = os.path.join(EXPORT_DIR, safe_file_name_new)\n\n \u003c/code\u003e\u003c/pre\u003e\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003ePath with 5 steps\u003c/summary\u003e\n\n1. [frigate/api/media.py](https://github.com/blakeblackshear/frigate/blob/d7ae0eedf89e14f297093ac5c8042862034cbaeb/frigate/api/media.py#L682C38-L682C51)\n \u003cpre\u003e\u003ccode class=\"python\"\u003e\n @MediaBp.route(\"/export/\u0026lt;file_name_current\u0026gt;/\u0026lt;file_name_new\u0026gt;\", methods=[\"PATCH\"])\n def export_rename(file_name_current, \u003cstrong\u003efile_name_new\u003c/strong\u003e: str):\n safe_file_name_current = secure_filename(\n export_filename_check_extension(file_name_current)\n \u003c/code\u003e\u003c/pre\u003e\n\n2. [frigate/api/media.py](https://github.com/blakeblackshear/frigate/blob/d7ae0eedf89e14f297093ac5c8042862034cbaeb/frigate/api/media.py#L705C74-L705C87)\n \u003cpre\u003e\u003ccode class=\"python\"\u003e )\n\n safe_file_name_new = secure_filename(export_filename_check_extension(\u003cstrong\u003efile_name_new\u003c/strong\u003e))\n file_new = os.path.join(EXPORT_DIR, safe_file_name_new)\n\n \u003c/code\u003e\u003c/pre\u003e\n\n3. [frigate/api/media.py](https://github.com/blakeblackshear/frigate/blob/d7ae0eedf89e14f297093ac5c8042862034cbaeb/frigate/api/media.py#L667C37-L667C45)\n \u003cpre\u003e\u003ccode class=\"python\"\u003e\n\n def export_filename_check_extension(\u003cstrong\u003efilename\u003c/strong\u003e: str):\n if filename.endswith(\".mp4\"):\n return filename\n \u003c/code\u003e\u003c/pre\u003e\n\n4. [frigate/api/media.py](https://github.com/blakeblackshear/frigate/blob/d7ae0eedf89e14f297093ac5c8042862034cbaeb/frigate/api/media.py#L671C16-L671C33)\n \u003cpre\u003e\u003ccode class=\"python\"\u003e return filename\n else:\n return \u003cstrong\u003efilename + \".mp4\"\u003c/strong\u003e\n\n\n \u003c/code\u003e\u003c/pre\u003e\n\n5. [frigate/api/media.py](https://github.com/blakeblackshear/frigate/blob/d7ae0eedf89e14f297093ac5c8042862034cbaeb/frigate/api/media.py#L705C42-L705C88)\n \u003cpre\u003e\u003ccode class=\"python\"\u003e )\n\n safe_file_name_new = secure_filename(\u003cstrong\u003eexport_filename_check_extension(file_name_new)\u003c/strong\u003e)\n file_new = os.path.join(EXPORT_DIR, safe_file_name_new)\n\n \u003c/code\u003e\u003c/pre\u003e\n\n\u003c/details\u003e\n\n----------------------------------------\n\n[frigate/api/media.py](https://github.com/blakeblackshear/frigate/blob/d7ae0eedf89e14f297093ac5c8042862034cbaeb/frigate/api/media.py#L728C38-L728C80)\n\n\u003cpre\u003e\u003ccode class=\"python\"\u003e@MediaBp.route(\"/export/\u0026lt;file_name\u0026gt;\", methods=[\"DELETE\"])\ndef export_delete(file_name: str):\n safe_file_name = secure_filename(\u003cstrong\u003eexport_filename_check_extension(file_name)\u003c/strong\u003e)\n file = os.path.join(EXPORT_DIR, safe_file_name)\n\n\u003c/code\u003e\u003c/pre\u003e\n\n*This [user-provided value](https://github.com/blakeblackshear/frigate/blob/d7ae0eedf89e14f297093ac5c8042862034cbaeb/frigate/api/media.py#L727C19-L727C28) can reach a [costly Unicode normalization operation](https://github.com/blakeblackshear/frigate/blob/d7ae0eedf89e14f297093ac5c8042862034cbaeb/frigate/api/media.py#L728C38-L728C80).*\n\n#### Paths\n\n\u003cdetails\u003e\n\u003csummary\u003ePath with 5 steps\u003c/summary\u003e\n\n1. [frigate/api/media.py](https://github.com/blakeblackshear/frigate/blob/d7ae0eedf89e14f297093ac5c8042862034cbaeb/frigate/api/media.py#L727C19-L727C28)\n \u003cpre\u003e\u003ccode class=\"python\"\u003e\n @MediaBp.route(\"/export/\u0026lt;file_name\u0026gt;\", methods=[\"DELETE\"])\n def export_delete(\u003cstrong\u003efile_name\u003c/strong\u003e: str):\n safe_file_name = secure_filename(export_filename_check_extension(file_name))\n file = os.path.join(EXPORT_DIR, safe_file_name)\n \u003c/code\u003e\u003c/pre\u003e\n\n2. [frigate/api/media.py](https://github.com/blakeblackshear/frigate/blob/d7ae0eedf89e14f297093ac5c8042862034cbaeb/frigate/api/media.py#L728C70-L728C79)\n \u003cpre\u003e\u003ccode class=\"python\"\u003e@MediaBp.route(\"/export/\u0026lt;file_name\u0026gt;\", methods=[\"DELETE\"])\n def export_delete(file_name: str):\n safe_file_name = secure_filename(export_filename_check_extension(\u003cstrong\u003efile_name\u003c/strong\u003e))\n file = os.path.join(EXPORT_DIR, safe_file_name)\n\n \u003c/code\u003e\u003c/pre\u003e\n\n3. [frigate/api/media.py](https://github.com/blakeblackshear/frigate/blob/d7ae0eedf89e14f297093ac5c8042862034cbaeb/frigate/api/media.py#L667C37-L667C45)\n \u003cpre\u003e\u003ccode class=\"python\"\u003e\n\n def export_filename_check_extension(\u003cstrong\u003efilename\u003c/strong\u003e: str):\n if filename.endswith(\".mp4\"):\n return filename\n \u003c/code\u003e\u003c/pre\u003e\n\n4. [frigate/api/media.py](https://github.com/blakeblackshear/frigate/blob/d7ae0eedf89e14f297093ac5c8042862034cbaeb/frigate/api/media.py#L669C16-L669C24)\n \u003cpre\u003e\u003ccode class=\"python\"\u003edef export_filename_check_extension(filename: str):\n if filename.endswith(\".mp4\"):\n return \u003cstrong\u003efilename\u003c/strong\u003e\n else:\n return filename + \".mp4\"\n \u003c/code\u003e\u003c/pre\u003e\n\n5. [frigate/api/media.py](https://github.com/blakeblackshear/frigate/blob/d7ae0eedf89e14f297093ac5c8042862034cbaeb/frigate/api/media.py#L728C38-L728C80)\n \u003cpre\u003e\u003ccode class=\"python\"\u003e@MediaBp.route(\"/export/\u0026lt;file_name\u0026gt;\", methods=[\"DELETE\"])\n def export_delete(file_name: str):\n safe_file_name = secure_filename(\u003cstrong\u003eexport_filename_check_extension(file_name)\u003c/strong\u003e)\n file = os.path.join(EXPORT_DIR, safe_file_name)\n\n \u003c/code\u003e\u003c/pre\u003e\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003ePath with 5 steps\u003c/summary\u003e\n\n1. [frigate/api/media.py](https://github.com/blakeblackshear/frigate/blob/d7ae0eedf89e14f297093ac5c8042862034cbaeb/frigate/api/media.py#L727C19-L727C28)\n \u003cpre\u003e\u003ccode class=\"python\"\u003e\n @MediaBp.route(\"/export/\u0026lt;file_name\u0026gt;\", methods=[\"DELETE\"])\n def export_delete(\u003cstrong\u003efile_name\u003c/strong\u003e: str):\n safe_file_name = secure_filename(export_filename_check_extension(file_name))\n file = os.path.join(EXPORT_DIR, safe_file_name)\n \u003c/code\u003e\u003c/pre\u003e\n\n2. [frigate/api/media.py](https://github.com/blakeblackshear/frigate/blob/d7ae0eedf89e14f297093ac5c8042862034cbaeb/frigate/api/media.py#L728C70-L728C79)\n \u003cpre\u003e\u003ccode class=\"python\"\u003e@MediaBp.route(\"/export/\u0026lt;file_name\u0026gt;\", methods=[\"DELETE\"])\n def export_delete(file_name: str):\n safe_file_name = secure_filename(export_filename_check_extension(\u003cstrong\u003efile_name\u003c/strong\u003e))\n file = os.path.join(EXPORT_DIR, safe_file_name)\n\n \u003c/code\u003e\u003c/pre\u003e\n\n3. [frigate/api/media.py](https://github.com/blakeblackshear/frigate/blob/d7ae0eedf89e14f297093ac5c8042862034cbaeb/frigate/api/media.py#L667C37-L667C45)\n \u003cpre\u003e\u003ccode class=\"python\"\u003e\n\n def export_filename_check_extension(\u003cstrong\u003efilename\u003c/strong\u003e: str):\n if filename.endswith(\".mp4\"):\n return filename\n \u003c/code\u003e\u003c/pre\u003e\n\n4. [frigate/api/media.py](https://github.com/blakeblackshear/frigate/blob/d7ae0eedf89e14f297093ac5c8042862034cbaeb/frigate/api/media.py#L671C16-L671C33)\n \u003cpre\u003e\u003ccode class=\"python\"\u003e return filename\n else:\n return \u003cstrong\u003efilename + \".mp4\"\u003c/strong\u003e\n\n\n \u003c/code\u003e\u003c/pre\u003e\n\n5. [frigate/api/media.py](https://github.com/blakeblackshear/frigate/blob/d7ae0eedf89e14f297093ac5c8042862034cbaeb/frigate/api/media.py#L728C38-L728C80)\n \u003cpre\u003e\u003ccode class=\"python\"\u003e@MediaBp.route(\"/export/\u0026lt;file_name\u0026gt;\", methods=[\"DELETE\"])\n def export_delete(file_name: str):\n safe_file_name = secure_filename(\u003cstrong\u003eexport_filename_check_extension(file_name)\u003c/strong\u003e)\n file = os.path.join(EXPORT_DIR, safe_file_name)\n\n \u003c/code\u003e\u003c/pre\u003e\n\n\u003c/details\u003e\n\n----------------------------------------\n\n[frigate/api/media.py](https://github.com/blakeblackshear/frigate/blob/d7ae0eedf89e14f297093ac5c8042862034cbaeb/frigate/api/media.py#L1346C46-L1346C55)\n\n\u003cpre\u003e\u003ccode class=\"python\"\u003edef preview_thumbnail(file_name: str):\n \"\"\"Get a thumbnail from the cached preview frames.\"\"\"\n safe_file_name_current = secure_filename(\u003cstrong\u003efile_name\u003c/strong\u003e)\n preview_dir = os.path.join(CACHE_DIR, \"preview_frames\")\n\n\u003c/code\u003e\u003c/pre\u003e\n\n*This [user-provided value](https://github.com/blakeblackshear/frigate/blob/d7ae0eedf89e14f297093ac5c8042862034cbaeb/frigate/api/media.py#L1344C23-L1344C32) can reach a [costly Unicode normalization operation](https://github.com/blakeblackshear/frigate/blob/d7ae0eedf89e14f297093ac5c8042862034cbaeb/frigate/api/media.py#L1346C46-L1346C55).*\n\n#### Paths\n\n\u003cdetails\u003e\n\u003csummary\u003ePath with 2 steps\u003c/summary\u003e\n\n1. [frigate/api/media.py](https://github.com/blakeblackshear/frigate/blob/d7ae0eedf89e14f297093ac5c8042862034cbaeb/frigate/api/media.py#L1344C23-L1344C32)\n \u003cpre\u003e\u003ccode class=\"python\"\u003e@MediaBp.route(\"/preview/\u0026lt;file_name\u0026gt;/thumbnail.jpg\")\n @MediaBp.route(\"/preview/\u0026lt;file_name\u0026gt;/thumbnail.webp\")\n def preview_thumbnail(\u003cstrong\u003efile_name\u003c/strong\u003e: str):\n \"\"\"Get a thumbnail from the cached preview frames.\"\"\"\n safe_file_name_current = secure_filename(file_name)\n \u003c/code\u003e\u003c/pre\u003e\n\n2. [frigate/api/media.py](https://github.com/blakeblackshear/frigate/blob/d7ae0eedf89e14f297093ac5c8042862034cbaeb/frigate/api/media.py#L1346C46-L1346C55)\n \u003cpre\u003e\u003ccode class=\"python\"\u003edef preview_thumbnail(file_name: str):\n \"\"\"Get a thumbnail from the cached preview frames.\"\"\"\n safe_file_name_current = secure_filename(\u003cstrong\u003efile_name\u003c/strong\u003e)\n preview_dir = os.path.join(CACHE_DIR, \"preview_frames\")\n\n \u003c/code\u003e\u003c/pre\u003e\n\n\u003c/details\u003e\n\n\n\n## Impact\n\n* Application-level Denial of Service, the web app would hung undefinetly and not process any further request due to the use of the malicious payload.\n \n\n## Mitigation\n\n* Limiting the length of the incoming filename, similar to this commit [fix](https://github.com/django/django/commit/048a9ebb6ea468426cb4e57c71572cbbd975517f).\n \n\n## References\n\n* Similar to [CVE-2023-46695](https://github.com/advisories/GHSA-qmf9-6jqf-j8fq \"CVE-2023-46695\")",
"id": "GHSA-w4h6-9wrp-v5jq",
"modified": "2024-05-14T20:00:47Z",
"published": "2024-05-09T15:13:49Z",
"references": [
{
"type": "WEB",
"url": "https://github.com/blakeblackshear/frigate/security/advisories/GHSA-w4h6-9wrp-v5jq"
},
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2024-32874"
},
{
"type": "WEB",
"url": "https://github.com/blakeblackshear/frigate/commit/cc851555e4029647986dccc8b8ecf54afee31442"
},
{
"type": "PACKAGE",
"url": "https://github.com/blakeblackshear/frigate"
},
{
"type": "WEB",
"url": "https://github.com/blakeblackshear/frigate/blob/d7ae0eedf89e14f297093ac5c8042862034cbaeb/frigate/api/media.py#L1346C46-L1346C55"
},
{
"type": "WEB",
"url": "https://github.com/blakeblackshear/frigate/blob/d7ae0eedf89e14f297093ac5c8042862034cbaeb/frigate/api/media.py#L408C33-L408C78"
},
{
"type": "WEB",
"url": "https://github.com/blakeblackshear/frigate/blob/d7ae0eedf89e14f297093ac5c8042862034cbaeb/frigate/api/media.py#L646C25-L646C47"
},
{
"type": "WEB",
"url": "https://github.com/blakeblackshear/frigate/blob/d7ae0eedf89e14f297093ac5c8042862034cbaeb/frigate/api/media.py#L684C9-L684C59"
},
{
"type": "WEB",
"url": "https://github.com/blakeblackshear/frigate/blob/d7ae0eedf89e14f297093ac5c8042862034cbaeb/frigate/api/media.py#L705C42-L705C88"
},
{
"type": "WEB",
"url": "https://github.com/blakeblackshear/frigate/blob/d7ae0eedf89e14f297093ac5c8042862034cbaeb/frigate/api/media.py#L728C38-L728C80"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:N/I:L/A:H",
"type": "CVSS_V3"
}
],
"summary": "Malicious Long Unicode filenames may cause a Multiple Application-level Denial of Service"
}
Sightings
| Author | Source | Type | Date |
|---|
Nomenclature
- Seen: The vulnerability was mentioned, discussed, or observed by the user.
- Confirmed: The vulnerability has been validated from an analyst's perspective.
- Published Proof of Concept: A public proof of concept is available for this vulnerability.
- Exploited: The vulnerability was observed as exploited by the user who reported the sighting.
- Patched: The vulnerability was observed as successfully patched by the user who reported the sighting.
- Not exploited: The vulnerability was not observed as exploited by the user who reported the sighting.
- Not confirmed: The user expressed doubt about the validity of the vulnerability.
- Not patched: The vulnerability was not observed as successfully patched by the user who reported the sighting.