Skip to content

Commit 4138667

Browse files
authored
Fix ssrf lookback edge case (#4205)
1 parent d44427f commit 4138667

File tree

5 files changed

+60
-5
lines changed

5 files changed

+60
-5
lines changed

.trivyignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,7 @@ CVE-2026-25793
1010
CVE-2025-45769
1111

1212
# True positive but local attack vector, we will be waiting for frankenphp to update their image.
13-
CVE-2026-0861
13+
CVE-2026-0861
14+
15+
# Unfortunately Frankenphp is
16+
CVE-2026-33186

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ RUN npm run build
5656
# ============================================================================
5757
# Stage 3: Production FrankenPHP Image
5858
# ============================================================================
59-
FROM dunglas/frankenphp:php8.5-trixie@sha256:7315062106fd2ee885d884072e3335f59e25a3abc34de0a03e102604ab73b4d0
59+
FROM dunglas/frankenphp:php8.5-trixie@sha256:93dcc4f16e01f0bc8e9d752bb19559cba4a23c14c9fd7ab825538fb432cd91ed
6060

6161
ARG USER=appuser
6262

app/Rules/PhotoUrlRule.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ public function validate(string $attribute, mixed $value, \Closure $fail): void
8686
if (
8787
$this->config_manager->getValueAsBool('import_via_url_forbidden_local_ip') &&
8888
filter_var($host, FILTER_VALIDATE_IP) !== false &&
89-
filter_var($host, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE) === false
89+
filter_var($host, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE) === false
9090
) {
9191
$fail($attribute . ' must not be a private IP address.');
9292

@@ -95,7 +95,7 @@ public function validate(string $attribute, mixed $value, \Closure $fail): void
9595

9696
if (
9797
$this->config_manager->getValueAsBool('import_via_url_forbidden_localhost') &&
98-
$host === 'localhost'
98+
in_array(strtolower($host), ['localhost', '127.0.0.1', '::1'], true)
9999
) {
100100
$fail($attribute . ' must not be localhost.');
101101

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
<?php
2+
3+
/**
4+
* SPDX-License-Identifier: MIT
5+
* Copyright (c) 2017-2018 Tobias Reich
6+
* Copyright (c) 2018-2026 LycheeOrg.
7+
*/
8+
9+
use Illuminate\Database\Migrations\Migration;
10+
use Illuminate\Support\Facades\Artisan;
11+
use Illuminate\Support\Facades\DB;
12+
use Symfony\Component\Console\Output\ConsoleOutput;
13+
use Symfony\Component\Console\Output\ConsoleSectionOutput;
14+
15+
return new class() extends Migration {
16+
private ConsoleOutput $output;
17+
private ConsoleSectionOutput $msg_section;
18+
19+
public function __construct()
20+
{
21+
$this->output = new ConsoleOutput();
22+
$this->msg_section = $this->output->section();
23+
}
24+
25+
/**
26+
* Run the migrations.
27+
*
28+
* @return void
29+
*/
30+
public function up(): void
31+
{
32+
DB::table('configs')->where('key', 'version')->update(['value' => '070501']);
33+
try {
34+
Artisan::call('cache:clear');
35+
} catch (\Throwable $e) {
36+
$this->msg_section->writeln('<error>Warning:</error> Failed to clear cache for version 7.5.1');
37+
38+
return;
39+
}
40+
$this->msg_section->writeln('<info>Info:</info> Cleared cache for version 7.5.1');
41+
}
42+
43+
/**
44+
* Reverse the migrations.
45+
*
46+
* @return void
47+
*/
48+
public function down(): void
49+
{
50+
DB::table('configs')->where('key', 'version')->update(['value' => '070500']);
51+
}
52+
};

version.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
7.5.0
1+
7.5.1

0 commit comments

Comments
 (0)