Skip to content

Commit 1c27a8b

Browse files
committed
Security: add rules to .htaccess to prevent direct PHP execution from the corresponding directories and updates security.html with a missing change in the previous commit. Using security.html is still the recommended way to go for security, but in the absence of that, we want to make sure Chamilo is always more secure.
1 parent e7fcee6 commit 1c27a8b

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

.htaccess

100644100755
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@
88

99
RewriteEngine on
1010

11+
# Prevent execution of PHP from directories used for different types of uploads
12+
RedirectMatch 403 ^/app/(cache|courses|home|logs|upload)/.*\.(php|php4|php5)$
13+
RedirectMatch 403 ^/main/default_course_document/images/.*\.(php|php4|php5)$
14+
RedirectMatch 403 ^/main/lang/.*\.(php|php4|php5)$
15+
RedirectMatch 403 ^/web/css/.*\.(php|php4|php5)$
16+
1117
# http://my.chamilo.net/certificates/?id=123 to http://my.chamilo.net/certificates/index.php?id=123
1218
RewriteCond %{QUERY_STRING} ^id=(.*)$
1319
RewriteRule ^certificates/$ certificates/index.php?id=%1 [L]

documentation/security.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -141,13 +141,13 @@ <h2><a name="5.Files-permissions"></a>5. Restricting files permissions</h2>
141141
location ~ ^/app/(cache|courses|home|logs|upload)/.*\.(php|php4|php5)$ {
142142
deny all;
143143
}
144-
location ~ ^/main/default_course_document/images/.*\.php$ {
144+
location ~ ^/main/default_course_document/images/.*\.(php|php4|php5)$ {
145145
deny all;
146146
}
147-
location ~ ^/main/lang/.*\.php$ {
147+
location ~ ^/main/lang/.*\.(php|php4|php5)$ {
148148
deny all;
149149
}
150-
location ~ ^/web/css/.*\.php$ {
150+
location ~ ^/web/css/.*\.(php|php4|php5)$ {
151151
deny all;
152152
}
153153
</pre>

0 commit comments

Comments
 (0)