Skip to content
Permalink
Browse files Browse the repository at this point in the history
Merge pull request #173 from phpMussel/archive-overhaul
Archive overhaul.
  • Loading branch information
Maikuolan committed Oct 17, 2018
2 parents 6bd72af + b7d690d commit 97f2597
Show file tree
Hide file tree
Showing 67 changed files with 2,217 additions and 1,840 deletions.
27 changes: 26 additions & 1 deletion Changelog-v1.txt
Expand Up @@ -7,7 +7,32 @@ Versioning guidelines for SemVer can be found at: http://www.semver.org/

=== Changes made since last versioned release ===

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

=== Version/Release 1.6.0 ===
MINOR RELEASE.
Expand Down
364 changes: 183 additions & 181 deletions _docs/readme.ar.md

Large diffs are not rendered by default.

27 changes: 16 additions & 11 deletions _docs/readme.de.md
Expand Up @@ -133,7 +133,8 @@ Sie sind jedoch auch in der Lage, phpMussel anzuweisen, spezifische Dateien, Ord

| Ergebnisse | Beschreibung |
|---|---|
| -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. |
| -4 | Zeigt an, dass Daten aufgrund der Verschlüsselung nicht gescannt werden konnten. |
| -3 | Zeigt an, dass es Probleme mit den phpMussel Signaturdateien gibt. |
| -2 | Zeigt an, dass beschädigte Dateien gefunden wurden und der Scan nicht abgeschlossen wurde. |
| -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. |
| 0 | Zeigt an, dass das Ziel nicht existiert und somit nichts überprüft werden konnte. |
Expand Down Expand Up @@ -520,9 +521,6 @@ Wert | Produziert | Beschreibung
##### "statistics"
- phpMussel-Nutzungsstatistiken verfolgen? True = Ja; False = Nein [Standardeinstellung].

##### "allow_symlinks"
- 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].

#### "signatures" (Kategorie)
Konfiguration der Signaturen.

Expand Down Expand Up @@ -577,11 +575,18 @@ Generelle Konfigurationen für die Handhabung von Dateien.
- 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.
- 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.

##### "check_archives" – Vorübergehend nicht erreichbar
##### "check_archives"
- Soll der Inhalt von Archiven überprüft werden? False = Nein (keine Überprüfung); True = Ja (wird überprüft) [Standardeinstellung].
- 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).
- Diese Funktion ist nicht sicher! Es wird dringend empfohlen, diese Funktion aktiviert zu lassen, es kann jedoch nicht garantiert werden, dass alles entdeckt wird.
- Die Archivüberprüfung ist derzeit nicht rekursiv für PHAR-Archive oder ZIP-Archive.

Format | Kann lesen | Kann rekursiv lesen | Kann die Verschlüsselung erkennen | Notizen
---|---|---|---|---
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.
Tar | ✔️ | ✔️ | ➖ | Keine besonderen Anforderungen. Format unterstützt keine Verschlüsselung.
Rar | ✔️ | ✔️ | ✔️ | Benötigt die [rar](https://pecl.php.net/package/rar)-Erweiterung (Wenn diese Erweiterung nicht installiert ist, kann phpMussel keine rar-Dateien lesen).
7zip | ❌ | ❌ | ❌ | Derzeit wird noch untersucht, wie 7zip-Dateien in phpMussel gelesen werden können.
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.

*Wenn jemand in der Lage und bereit ist, Unterstützung beim Lesen anderer Archivformate zu implementieren, wäre eine solche Hilfe willkommen.*

##### "filesize_archives"
- 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].
Expand All @@ -590,7 +595,7 @@ Generelle Konfigurationen für die Handhabung von Dateien.
- Soll das Blacklisting/Whitelisting des Dateityps auf den Inhalt des Archivs übertragen werden? False = Nein (alles nur in die Greylist aufnehmen) [Standardeinstellung]; True = Ja.

##### "max_recursion"
- Maximale Grenze der Rekursionstiefe von Archiven. Standardwert = 10.
- Maximale Grenze der Rekursionstiefe von Archiven. Standardwert = 3.

##### "block_encrypted_archives"
- 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].
Expand All @@ -610,7 +615,7 @@ Chameleon-Angriffserkennung: False = Deaktiviert; True = Aktiviert.
- 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.

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

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


Zuletzt aktualisiert: 9 Oktober 2018 (2018.10.09).
Zuletzt aktualisiert: 16 Oktober 2018 (2018.10.16).
27 changes: 16 additions & 11 deletions _docs/readme.en.md
Expand Up @@ -133,7 +133,8 @@ However, you're also able to instruct phpMussel to scan specific files, director

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

##### "allow_symlinks"
- 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].

#### "signatures" (Category)
Signatures configuration.

Expand Down Expand Up @@ -577,11 +575,18 @@ File handling configuration.
- If the filetype is blacklisted, don't scan the file but block it anyway, and don't check the file against the greylist.
- 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.

##### "check_archives" – Temporarily unavailable
##### "check_archives"
- Attempt to check the contents of archives? False = Don't check; True = Check [Default].
- 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).
- This is not foolproof! While I highly recommend keeping this turned on, I can't guarantee it'll always find everything.
- Also be aware that archive checking currently is not recursive for PHARs or ZIPs.

Format | Can read | Can read recursively | Can detect encryption | Notes
---|---|---|---|---
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.
Tar | ✔️ | ✔️ | ➖ | No special requirements. Format doesn't support encryption.
Rar | ✔️ | ✔️ | ✔️ | Requires the [rar](https://pecl.php.net/package/rar) extension (when this extension isn't installed, phpMussel can't read rar files).
7zip | ❌ | ❌ | ❌ | Still currently investigating how to read 7zip files in phpMussel.
Phar | ❌ | ❌ | ❌ | Support for reading phar files was removed in v1.6.0, and won't be added again, due to security concerns.

*If anyone is able and willing to help implement support for reading other archive formats, such help would be welcomed.*

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

##### "max_recursion"
- Maximum recursion depth limit for archives. Default = 10.
- Maximum recursion depth limit for archives. Default = 3.

##### "block_encrypted_archives"
- 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].
Expand All @@ -610,7 +615,7 @@ Chameleon attack detection: False = Off; True = On.
- Search for executable headers in files that are neither executables nor recognised archives and for executables whose headers are incorrect.

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

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


Last Updated: 9 October 2018 (2018.10.09).
Last Updated: 16 October 2018 (2018.10.16).
27 changes: 16 additions & 11 deletions _docs/readme.es.md
Expand Up @@ -133,7 +133,8 @@ Pero, también es capaz instruirá phpMussel para escanear específicos archivos

| Resultados | Descripción |
|---|---|
| -3 | Indica se encontraron problemas con el phpMussel firmas archivos o firmas mapas archivos y que sea posible pueden faltar o dañado. |
| -4 | Indica que los datos no se pudieron escanear debido al cifrado. |
| -3 | Indica que se encontraron problemas con los archivos de firmas phpMussel. |
| -2 | Indica que se ha corruptos datos detectados durante el escanear y por lo tanto el escanear no pudo completar. |
| -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. |
| 0 | Indica que la escanear objetivo no existe y por lo tanto no había nada para escanear. |
Expand Down Expand Up @@ -520,9 +521,6 @@ Valor | Produce | Descripción
##### "statistics"
- ¿Seguir las estadísticas de uso de phpMussel? True = Sí; False = No [Predefinido].

##### "allow_symlinks"
- 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].

#### "signatures" (Categoría)
Configuración de firmas.

Expand Down Expand Up @@ -577,11 +575,18 @@ General configuración para el manejo de archivos.
- 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.
- 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.

##### "check_archives" – Temporalmente no disponible
##### "check_archives"
- Intente comprobar el contenido de los compactados archivos? False = No (no comprobar); True = Sí (comprobar) [Predefinido].
- 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).
- Esto no es infalible! Mientras yo altamente recomiendo mantener este activado, no puedo garantizar que siempre encontrará todo.
- También ser conscientes que la comprobación de compactados archivos corrientemente no es recursivo para PHAR o ZIP formatos.

Formato | Puede leer | Puede leer recursivamente | Puede detectar el cifrado | Notas
---|---|---|---|---
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.
Tar | ✔️ | ✔️ | ➖ | Ningún requerimiento especial. El formato no soporte el cifrado.
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).
7zip | ❌ | ❌ | ❌ | Todavía estoy investigando cómo leer archivos 7zip en phpMussel.
Phar | ❌ | ❌ | ❌ | Soporte para leer de archivos phar fue removido en v1.6.0 y no se agregará nuevamente, debido a preocupaciones de seguridad.

*Si alguien puede y está dispuesto a ayudar a implementar el soporte para leer otros formatos de archivo, dicha ayuda sería bienvenida.*

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

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

##### "block_encrypted_archives"
- 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].
Expand All @@ -610,7 +615,7 @@ Detección de ataques de camaleón: False = Desactivado; True = Activado.
- 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.

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

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


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

0 comments on commit 97f2597

Please sign in to comment.