Skip to content

Commit 97f2597

Browse files
authored
Merge pull request #173 from phpMussel/archive-overhaul
Archive overhaul.
2 parents 6bd72af + b7d690d commit 97f2597

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+2217
-1840
lines changed

Diff for: Changelog-v1.txt

+26-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,32 @@ Versioning guidelines for SemVer can be found at: http://www.semver.org/
77

88
=== Changes made since last versioned release ===
99

10-
(none)
10+
- [2018.10.12-17; Maikuolan]: Completely dropped all support for scanning phar
11+
files with phpMussel, due to vulnerabilities discovered in the way that the
12+
phar wrapper was implemented in phpMussel (with no safer, more secure
13+
alternative known at this time for handling phar files, I neither plan nor
14+
anticipate ever reintroducing phar support in the future). Deprecated and
15+
completely removed the allow_symlinks configuration directive (we don't need
16+
this anymore, because it was intended to address a problem in phar, which we
17+
won't be using anymore anyway). Dropped the max_recursion default value from
18+
10 down to 3 as a means to tighten security and improve safety for when
19+
handling archives. Completely overhauled the way that phpMussel deals with
20+
archives during a scan event, ditching almost all code associated with the
21+
archive phase of scanning, and implementing a separate, newly created archive
22+
handler, compression handler, and temporarily file handler. phpMussel now
23+
partially utilises OOP for handling archives, and includes a small number of
24+
classes in its codebase (a possible stepping stone towards a future v2.0.0).
25+
File decompression is now implicit, rather than explicit. Slightly improved
26+
the aesthetic for displayed scan results in CLI where archives are concerned.
27+
The recursor closure isn't responsible for the code associated with the
28+
archive phase of scanning anymore. Instead, a new, separate archive recursor
29+
closure has been created to deal with the code associated with the archive
30+
phase of scanning. Zip archive scanning is now fully recursive. Rar archive
31+
scanning is now fully supported (can scan recursively, can detect encryption,
32+
etc). Added quine detection. Added a table to the documentation to clarify
33+
which compression and archive formats are and aren't supported, and removed
34+
some otherwise ambiguous wording about it from the documentation and L10N
35+
data. Refactored all chameleon attack detection code.
1136

1237
=== Version/Release 1.6.0 ===
1338
MINOR RELEASE.

Diff for: _docs/readme.ar.md

+183-181
Large diffs are not rendered by default.

Diff for: _docs/readme.de.md

+16-11
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,8 @@ Sie sind jedoch auch in der Lage, phpMussel anzuweisen, spezifische Dateien, Ord
133133

134134
| Ergebnisse | Beschreibung |
135135
|---|---|
136-
| -3 | Zeigt an, dass es Probleme mit den phpMussel Signatur-Dateien oder Signatur-Map-Dateien gibt und dass sie wahrscheinlich fehlen oder beschädigt sind. |
136+
| -4 | Zeigt an, dass Daten aufgrund der Verschlüsselung nicht gescannt werden konnten. |
137+
| -3 | Zeigt an, dass es Probleme mit den phpMussel Signaturdateien gibt. |
137138
| -2 | Zeigt an, dass beschädigte Dateien gefunden wurden und der Scan nicht abgeschlossen wurde. |
138139
| -1 | Zeigt an, dass fehlende Erweiterungen oder Addons von PHP benötigt werden, um den Scan durchzuführen und der Scan deshalb nicht abgeschlossen wurde. |
139140
| 0 | Zeigt an, dass das Ziel nicht existiert und somit nichts überprüft werden konnte. |
@@ -520,9 +521,6 @@ Wert | Produziert | Beschreibung
520521
##### "statistics"
521522
- phpMussel-Nutzungsstatistiken verfolgen? True = Ja; False = Nein [Standardeinstellung].
522523

523-
##### "allow_symlinks"
524-
- Manchmal kann phpMussel nicht direkt auf eine Datei zugreifen, wenn sie auf eine bestimmte Art benannt ist. Der indirekte Zugriff auf die Datei über Symlinks kann dieses Problem manchmal beheben. Dies ist jedoch nicht immer eine praktikable Lösung, da auf einigen Systemen die Verwendung von Symlinks verboten sein kann oder Administratorrechte erfordern. Diese Anweisung wird verwendet, um zu bestimmen, ob phpMussel versuchen sollte, Symlinks zu verwenden, um indirekt auf Dateien zuzugreifen, wenn ein direkter Zugriff auf sie nicht möglich ist. True = Aktivieren Symlinks; False = Deaktivieren Symlinks [Standardeinstellung].
525-
526524
#### "signatures" (Kategorie)
527525
Konfiguration der Signaturen.
528526

@@ -577,11 +575,18 @@ Generelle Konfigurationen für die Handhabung von Dateien.
577575
- Wenn der Dateityp in der Blacklist ist, scanne nicht die Datei aber blockieren sie trotzdem, und überprüfe nicht wenn die Datei in der Greylist ist.
578576
- Wenn die Greylist leer ist oder wenn die Greylist nicht leer ist und der Dateityp in der Greylist ist, scanne die Datei wie standardmäßig eingestellt ist und stelle fest, ob diese blockiert werden soll, basierend auf dem Scan, aber wenn die Greylist nicht leer ist und der Dateityp nicht in der Greylist ist, behandel die Datei als ob sie in der Blacklist ist, scanne sie nicht aber blockiere sie trotzdem.
579577

580-
##### "check_archives" – Vorübergehend nicht erreichbar
578+
##### "check_archives"
581579
- Soll der Inhalt von Archiven überprüft werden? False = Nein (keine Überprüfung); True = Ja (wird überprüft) [Standardeinstellung].
582-
- Zur Zeit wird NUR die Überprüfung von BZ/BZIP2, GZ/GZIP, LZF, PHAR, TAR und ZIP Archiven unterstützt (Überprüfung von RAR, CAB, 7z, u.s.w. wird zur Zeit NICHT unterstützt).
583-
- Diese Funktion ist nicht sicher! Es wird dringend empfohlen, diese Funktion aktiviert zu lassen, es kann jedoch nicht garantiert werden, dass alles entdeckt wird.
584-
- Die Archivüberprüfung ist derzeit nicht rekursiv für PHAR-Archive oder ZIP-Archive.
580+
581+
Format | Kann lesen | Kann rekursiv lesen | Kann die Verschlüsselung erkennen | Notizen
582+
---|---|---|---|---
583+
Zip | ✔️ | ✔️ | ✔️ | Benötigt [libzip](http://php.net/manual/en/zip.requirements.php) (normalerweise sowieso mit PHP gebündelt). Auch unterstützt (verwendet das Zip-Format): ✔️ OLE-Objekt-Erkennung. ✔️ Office-Makro-Erkennung.
584+
Tar | ✔️ | ✔️ | ➖ | Keine besonderen Anforderungen. Format unterstützt keine Verschlüsselung.
585+
Rar | ✔️ | ✔️ | ✔️ | Benötigt die [rar](https://pecl.php.net/package/rar)-Erweiterung (Wenn diese Erweiterung nicht installiert ist, kann phpMussel keine rar-Dateien lesen).
586+
7zip | ❌ | ❌ | ❌ | Derzeit wird noch untersucht, wie 7zip-Dateien in phpMussel gelesen werden können.
587+
Phar | ❌ | ❌ | ❌ | Die Unterstützung für das Lesen von phar-Dateien wurde in v1.6.0 entfernt, und wird aufgrund von Sicherheitsbedenken nicht erneut hinzugefügt.
588+
589+
*Wenn jemand in der Lage und bereit ist, Unterstützung beim Lesen anderer Archivformate zu implementieren, wäre eine solche Hilfe willkommen.*
585590

586591
##### "filesize_archives"
587592
- Soll das Blacklisting/Whitelisting der Dateigröße auf den Inhalt des Archivs übertragen werden? False = Nein (alles nur in die Greylist aufnehmen); True = Ja [Standardeinstellung].
@@ -590,7 +595,7 @@ Generelle Konfigurationen für die Handhabung von Dateien.
590595
- Soll das Blacklisting/Whitelisting des Dateityps auf den Inhalt des Archivs übertragen werden? False = Nein (alles nur in die Greylist aufnehmen) [Standardeinstellung]; True = Ja.
591596

592597
##### "max_recursion"
593-
- Maximale Grenze der Rekursionstiefe von Archiven. Standardwert = 10.
598+
- Maximale Grenze der Rekursionstiefe von Archiven. Standardwert = 3.
594599

595600
##### "block_encrypted_archives"
596601
- Verschlüsselte Archive erkennen und blockieren? Denn phpMussel ist nicht in der Lage, die Inhalte von verschlüsselten Archiven zu scannen. Es ist möglich, dass Archiv-Verschlüsselung von Angreifern zum Umgehen von phpMussel, Antiviren-Scanner und weiterer solcher Schutzlösungen verwendet wird. Die Anweisung, dass phpMussel verschlüsselte Archive blockiert kann möglicherweise helfen, die Risiken, die mit dieser Möglichkeit verbunden sind, zu verringern. False = Nein; True = Ja [Standardeinstellung].
@@ -610,7 +615,7 @@ Chameleon-Angriffserkennung: False = Deaktiviert; True = Aktiviert.
610615
- Suche nach ausführbaren Headern in Dateien, die weder ausführbar noch erkannte Archive sind und nach ausführbaren Dateien, deren Header nicht korrekt sind.
611616

612617
##### "chameleon_to_archive"
613-
- Suche nach Archiven, deren Header nicht korrekt sind (Unterstützt: BZ, GZ, RAR, ZIP, GZ).
618+
- Identifizieren Sie falsche Header in Archiven und komprimierten Dateien. Unterstützt: BZ/BZIP2, GZ/GZIP, LZF, RAR, ZIP.
614619

615620
##### "chameleon_to_doc"
616621
- Suche nach Office-Dokumenten, deren Header nicht korrekt sind (Unterstützt: DOC, DOT, PPS, PPT, XLA, XLS, WIZ).
@@ -1313,4 +1318,4 @@ Alternativ gibt es einen kurzen (nicht autoritativen) Überblick über die GDPR/
13131318
---
13141319

13151320

1316-
Zuletzt aktualisiert: 9 Oktober 2018 (2018.10.09).
1321+
Zuletzt aktualisiert: 16 Oktober 2018 (2018.10.16).

Diff for: _docs/readme.en.md

+16-11
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,8 @@ However, you're also able to instruct phpMussel to scan specific files, director
133133

134134
| Results | Description |
135135
|---|---|
136-
| -3 | Indicates problems were encountered with the phpMussel signatures files or signature map files and that they may possible be missing or corrupted. |
136+
| -4 | Indicates that data couldn't be scanned due to encryption. |
137+
| -3 | Indicates that problems were encountered with the phpMussel signatures files. |
137138
| -2 | Indicates that corrupt data was detected during the scan and thus the scan failed to complete. |
138139
| -1 | Indicates that extensions or addons required by PHP to execute the scan were missing and thus the scan failed to complete. |
139140
| 0 | Indicates that the scan target doesn't exist and thus there was nothing to scan. |
@@ -520,9 +521,6 @@ Value | Produces | Description
520521
##### "statistics"
521522
- Track phpMussel usage statistics? True = Yes; False = No [Default].
522523

523-
##### "allow_symlinks"
524-
- Sometimes phpMussel isn't able to access a file directly when it's named in a certain way. Accessing the file indirectly via symlinks can sometimes resolve this problem. However, this isn't always a viable solution, because on some systems, using symlinks may be forbidden, or may require administrative privileges. This directive is used to determine whether phpMussel should attempt to use symlinks to access files indirectly, when accessing them directly isn't possible. True = Enable symlinks; False = Disable symlinks [Default].
525-
526524
#### "signatures" (Category)
527525
Signatures configuration.
528526

@@ -577,11 +575,18 @@ File handling configuration.
577575
- If the filetype is blacklisted, don't scan the file but block it anyway, and don't check the file against the greylist.
578576
- If the greylist is empty or if the greylist is not empty and the filetype is greylisted, scan the file as per normal and determine whether to block it based on the results of the scan, but if the greylist is not empty and the filetype is not greylisted, treat the file as blacklisted, therefore not scanning it but blocking it anyway.
579577

580-
##### "check_archives" – Temporarily unavailable
578+
##### "check_archives"
581579
- Attempt to check the contents of archives? False = Don't check; True = Check [Default].
582-
- Currently, the only archive and compression formats supported are BZ/BZIP2, GZ/GZIP, LZF, PHAR, TAR and ZIP (archive and compression formats RAR, CAB, 7z and etcetera not currently supported).
583-
- This is not foolproof! While I highly recommend keeping this turned on, I can't guarantee it'll always find everything.
584-
- Also be aware that archive checking currently is not recursive for PHARs or ZIPs.
580+
581+
Format | Can read | Can read recursively | Can detect encryption | Notes
582+
---|---|---|---|---
583+
Zip | ✔️ | ✔️ | ✔️ | Requires [libzip](http://php.net/manual/en/zip.requirements.php) (normally bundled with PHP anyway). Also supported (uses the zip format): ✔️ OLE object detection. ✔️ Office macro detection.
584+
Tar | ✔️ | ✔️ | ➖ | No special requirements. Format doesn't support encryption.
585+
Rar | ✔️ | ✔️ | ✔️ | Requires the [rar](https://pecl.php.net/package/rar) extension (when this extension isn't installed, phpMussel can't read rar files).
586+
7zip | ❌ | ❌ | ❌ | Still currently investigating how to read 7zip files in phpMussel.
587+
Phar | ❌ | ❌ | ❌ | Support for reading phar files was removed in v1.6.0, and won't be added again, due to security concerns.
588+
589+
*If anyone is able and willing to help implement support for reading other archive formats, such help would be welcomed.*
585590

586591
##### "filesize_archives"
587592
- Carry over filesize blacklisting/whitelisting to the contents of archives? False = No (just greylist everything); True = Yes [Default].
@@ -590,7 +595,7 @@ File handling configuration.
590595
- Carry over filetype blacklisting/whitelisting to the contents of archives? False = No (just greylist everything) [Default]; True = Yes.
591596

592597
##### "max_recursion"
593-
- Maximum recursion depth limit for archives. Default = 10.
598+
- Maximum recursion depth limit for archives. Default = 3.
594599

595600
##### "block_encrypted_archives"
596601
- Detect and block encrypted archives? Because phpMussel isn't able to scan the contents of encrypted archives, it's possible that archive encryption may be employed by an attacker as a means of attempting to bypass phpMussel, anti-virus scanners and other such protections. Instructing phpMussel to block any archives that it discovers to be encrypted could potentially help reduce any risk associated with these such possibilities. False = No; True = Yes [Default].
@@ -610,7 +615,7 @@ Chameleon attack detection: False = Off; True = On.
610615
- Search for executable headers in files that are neither executables nor recognised archives and for executables whose headers are incorrect.
611616

612617
##### "chameleon_to_archive"
613-
- Search for archives whose headers are incorrect (Supported: BZ, GZ, RAR, ZIP, GZ).
618+
- Detect incorrect headers in archives and compressed files. Supported: BZ/BZIP2, GZ/GZIP, LZF, RAR, ZIP.
614619

615620
##### "chameleon_to_doc"
616621
- Search for office documents whose headers are incorrect (Supported: DOC, DOT, PPS, PPT, XLA, XLS, WIZ).
@@ -1313,4 +1318,4 @@ Alternatively, there's a brief (non-authoritative) overview of GDPR/DSGVO availa
13131318
---
13141319

13151320

1316-
Last Updated: 9 October 2018 (2018.10.09).
1321+
Last Updated: 16 October 2018 (2018.10.16).

Diff for: _docs/readme.es.md

+16-11
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,8 @@ Pero, también es capaz instruirá phpMussel para escanear específicos archivos
133133

134134
| Resultados | Descripción |
135135
|---|---|
136-
| -3 | Indica se encontraron problemas con el phpMussel firmas archivos o firmas mapas archivos y que sea posible pueden faltar o dañado. |
136+
| -4 | Indica que los datos no se pudieron escanear debido al cifrado. |
137+
| -3 | Indica que se encontraron problemas con los archivos de firmas phpMussel. |
137138
| -2 | Indica que se ha corruptos datos detectados durante el escanear y por lo tanto el escanear no pudo completar. |
138139
| -1 | Indica que las extensiones o complementos requeridos por PHP para ejecutar el escaneo faltaban y por lo tanto el escanear no pudo completar, 0 indica que la escanear objetivo no existe y por lo tanto no había nada para escanear. |
139140
| 0 | Indica que la escanear objetivo no existe y por lo tanto no había nada para escanear. |
@@ -520,9 +521,6 @@ Valor | Produce | Descripción
520521
##### "statistics"
521522
- ¿Seguir las estadísticas de uso de phpMussel? True = Sí; False = No [Predefinido].
522523

523-
##### "allow_symlinks"
524-
- A veces, phpMussel no puede acceder a un archivo directamente cuando se nombra de cierta manera. Acceder al archivo indirectamente a través de symlinks a veces puede resolver este problema. Pero, esta no siempre es una solución viable, porque en algunos sistemas, el uso de symlinks puede estar prohibido, o puede requerir privilegios administrativos. Esta directiva se utiliza para determinar si phpMussel debe intentar usar symlinks para acceder a los archivos de forma indirecta, cuando acceder a ellos directamente no es posible. True = Habilitar symlinks; False = Deshabilitar symlinks [Predefinido].
525-
526524
#### "signatures" (Categoría)
527525
Configuración de firmas.
528526

@@ -577,11 +575,18 @@ General configuración para el manejo de archivos.
577575
- Si el tipo de archivo está en la blacklist, no escanear el archivo, pero bloquearlo en todo caso, y no cotejar el archivo con la greylist.
578576
- Si la greylist está vacía o si la greylist está no vacía y el tipo de archivo está en la greylist, escanearlo como normal y determinar si para bloquearlo basado en los resultados de la escaneo, pero si la greylist está no vacía y el tipo de archivo está no en la greylist, tratar el archivo como si está en la blacklist, por lo tanto no escanearlo pero bloquearlo en todo caso.
579577

580-
##### "check_archives" – Temporalmente no disponible
578+
##### "check_archives"
581579
- Intente comprobar el contenido de los compactados archivos? False = No (no comprobar); True = Sí (comprobar) [Predefinido].
582-
- Corrientemente, los únicos formatos soportados son BZ/BZIP2, GZ/GZIP, LZF, PHAR, TAR y ZIP (los formatos RAR, CAB, 7z y etc. corrientemente no es soportados).
583-
- Esto no es infalible! Mientras yo altamente recomiendo mantener este activado, no puedo garantizar que siempre encontrará todo.
584-
- También ser conscientes que la comprobación de compactados archivos corrientemente no es recursivo para PHAR o ZIP formatos.
580+
581+
Formato | Puede leer | Puede leer recursivamente | Puede detectar el cifrado | Notas
582+
---|---|---|---|---
583+
Zip | ✔️ | ✔️ | ✔️ | Requiere [libzip](http://php.net/manual/en/zip.requirements.php) (normalmente empaquetado con PHP de todos modos). También soportado (usa el formato zip): ✔️ Detección de objetos OLE. ✔️ Detección de macros Office.
584+
Tar | ✔️ | ✔️ | ➖ | Ningún requerimiento especial. El formato no soporte el cifrado.
585+
Rar | ✔️ | ✔️ | ✔️ | Requiere la extensión [rar](https://pecl.php.net/package/rar) (cuando esta extensión no está instalada, phpMussel no puede leer archivos rar).
586+
7zip | ❌ | ❌ | ❌ | Todavía estoy investigando cómo leer archivos 7zip en phpMussel.
587+
Phar | ❌ | ❌ | ❌ | Soporte para leer de archivos phar fue removido en v1.6.0 y no se agregará nuevamente, debido a preocupaciones de seguridad.
588+
589+
*Si alguien puede y está dispuesto a ayudar a implementar el soporte para leer otros formatos de archivo, dicha ayuda sería bienvenida.*
585590

586591
##### "filesize_archives"
587592
- Heredar tamaño de archivos blacklist/whitelist para los contenidos de compactados archivos? False = No (todo en la greylist); True = Sí [Predefinido].
@@ -590,7 +595,7 @@ General configuración para el manejo de archivos.
590595
- Heredar tipos de archivos blacklist/whitelist para los contenidos de compactados archivos? False = No (todo en la greylist); True = Sí [Predefinido].
591596

592597
##### "max_recursion"
593-
- Máximo recursividad nivel límite para compactados archivos. Predefinido = 10.
598+
- Máximo recursividad nivel límite para compactados archivos. Predefinido = 3.
594599

595600
##### "block_encrypted_archives"
596601
- Detectar y bloquear compactados archivos encriptados? Debido phpMussel no es capaz de escanear el contenido de los compactados archivos encriptados, es posible que este puede ser empleado por un atacante como un medio de evitando phpMussel, antivirus escáneres y otras protecciones. Instruir phpMussel para bloquear cualquier compactado archivo que se descubre es encriptado potencialmente podría ayudar a reducir el riesgo asociado a estos tales posibilidades. False = No; True = Sí [Predefinido].
@@ -610,7 +615,7 @@ Detección de ataques de camaleón: False = Desactivado; True = Activado.
610615
- Buscar para PE mágico número en archivos que no están ejecutables ni reconocidos compactados archivos y para ejecutables cuyo mágicos números son incorrectas.
611616

612617
##### "chameleon_to_archive"
613-
- Buscar para compactados archivos cuyo mágicos números son incorrectas (Soportado: BZ, GZ, RAR, ZIP, GZ).
618+
- Detectar mágicos números incorrectos en archivos y archivos comprimidos. Soportado: BZ/BZIP2, GZ/GZIP, LZF, RAR, ZIP.
614619

615620
##### "chameleon_to_doc"
616621
- Buscar para office documentos cuyo mágicos números son incorrectas (Soportado: DOC, DOT, PPS, PPT, XLA, XLS, WIZ).
@@ -1310,4 +1315,4 @@ Alternativamente, hay una breve descripción (no autoritativa) de GDPR/DSGVO dis
13101315
---
13111316

13121317

1313-
Última Actualización: 9 Octubre de 2018 (2018.10.09).
1318+
Última Actualización: 16 Octubre de 2018 (2018.10.16).

0 commit comments

Comments
 (0)