Sicherheitsupdate nach Audit (0.29.0)
Some checks failed
CI / PHP 8.3 / mariadb:10.6 (pull_request) Successful in 7m50s
CI / PHP 8.4 / mariadb:10.6 (pull_request) Successful in 7m34s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Successful in 5m45s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Successful in 5m30s
CI / PHP 8.3 / mysql:8.0 (pull_request) Failing after 7m7s
CI / PHP 8.4 / mysql:8.0 (pull_request) Failing after 7m9s
CI / PHP 8.3 / mysql:8.4 (pull_request) Failing after 6m8s
CI / PHP 8.4 / mysql:8.4 (pull_request) Failing after 6m5s
CI / Bekannte Sicherheitslücken in Paketen (pull_request) Successful in 48s
CI / Build-Artefakte aktuell (pull_request) Successful in 1m5s
Some checks failed
CI / PHP 8.3 / mariadb:10.6 (pull_request) Successful in 7m50s
CI / PHP 8.4 / mariadb:10.6 (pull_request) Successful in 7m34s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Successful in 5m45s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Successful in 5m30s
CI / PHP 8.3 / mysql:8.0 (pull_request) Failing after 7m7s
CI / PHP 8.4 / mysql:8.0 (pull_request) Failing after 7m9s
CI / PHP 8.3 / mysql:8.4 (pull_request) Failing after 6m8s
CI / PHP 8.4 / mysql:8.4 (pull_request) Failing after 6m5s
CI / Bekannte Sicherheitslücken in Paketen (pull_request) Successful in 48s
CI / Build-Artefakte aktuell (pull_request) Successful in 1m5s
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
a37895a16a
commit
f1202bea08
226 changed files with 1952 additions and 450 deletions
|
|
@ -29,6 +29,7 @@ class ZipExtractor
|
|||
}
|
||||
|
||||
try {
|
||||
self::checkLimits($zip);
|
||||
$this->recreate($targetDir);
|
||||
$root = realpath($targetDir);
|
||||
$prefix = $this->commonPrefix($zip);
|
||||
|
|
@ -143,4 +144,35 @@ class ZipExtractor
|
|||
throw new RuntimeException("Verzeichnis {$dir} kann nicht angelegt werden. Bitte Schreibrechte prüfen.");
|
||||
}
|
||||
}
|
||||
|
||||
/** Grenzen gegen „ZIP-Bomben“ (ein Inhaus-Update entpackt heute ~17.000 Dateien, ~70 MB) */
|
||||
public const MAX_ENTRIES = 60_000;
|
||||
|
||||
public const MAX_TOTAL_BYTES = 800 * 1024 * 1024;
|
||||
|
||||
public const MAX_RATIO = 200;
|
||||
|
||||
private static function checkLimits(ZipArchive $zip): void
|
||||
{
|
||||
if ($zip->numFiles > self::MAX_ENTRIES) {
|
||||
throw new RuntimeException('Das Archiv enthält zu viele Dateien.');
|
||||
}
|
||||
|
||||
$total = 0;
|
||||
|
||||
for ($i = 0; $i < $zip->numFiles; $i++) {
|
||||
$stat = $zip->statIndex($i);
|
||||
$size = (int) ($stat['size'] ?? 0);
|
||||
$total += $size;
|
||||
|
||||
// Stark komprimierte große Einträge sind verdächtig
|
||||
if ($size > 10 * 1024 * 1024 && $size > max(1, (int) ($stat['comp_size'] ?? 0)) * self::MAX_RATIO) {
|
||||
throw new RuntimeException('Das Archiv enthält eine ungewöhnlich stark komprimierte Datei und wurde abgelehnt.');
|
||||
}
|
||||
|
||||
if ($total > self::MAX_TOTAL_BYTES) {
|
||||
throw new RuntimeException('Das Archiv ist entpackt zu groß.');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue