====== PHP Anwendung: Rechte testen ====== yum install php service httpd restart cd /var/www/html/ id -Z ls -dZ . matchpathcon . -> Type: ''httpd_sys_content_t'' PHP-Shell((https://github.com/flozz/p0wny-shell)) installieren: (**niemals auf produktiven Systemen**) wget https://github.com/flozz/p0wny-shell/raw/master/shell.php ls -Z shell.php -> Type: ''httpd_sys_content_t'', Webserver kann darauf zugreifen ===== lesen ===== Testen: http://localhost/shell.php ===== schreiben ===== mkdir /var/www/html/playground chown apache /var/www/html/playground su -s /bin/bash - apache id -Z cd /var/www/html/playground touch test1 -> Datei ''/var/www/html/playground/test1'' kann angelegt werden ls -Z test1 -> Type: ''unconfined_t'' http://localhost/shell.php aufrufen: cd /var/www/html/playground touch test2 -> Datei ''/var/www/html/playground/test2'' kann nicht angelegt werden als root: Fehlermeldung anzeigen: ausearch -m avc -c touch Korrekturmöglichkeit anzeigen: journalctl -f _COMM=setroubleshootd Filecontext anpassen: semanage fcontext --add -t httpd_sys_rw_content_t /var/www/html/playground restorecon -v /var/www/html/playground http://localhost/shell.php aufrufen: cd /var/www/html/playground touch test2 -> Datei ''/var/www/html/playground/test2'' kann angelegt werden