十一选五胆拖玩法:Installed as an Apache module

湖北十一选五官网 www.na503.cn When PHP is used as an Apache module it inherits Apache's user permissions (typically those of the "nobody" user). This has several impacts on security and authorization. For example, if you are using PHP to access a database, unless that database has built-in access control, you will have to make the database accessible to the "nobody" user. This means a malicious script could access and modify the database, even without a username and password. It's entirely possible that a web spider could stumble across a database administrator's web page, and drop all of your databases. You can protect against this with Apache authorization, or you can design your own access model using LDAP, .htaccess files, etc. and include that code as part of your PHP scripts.

Often, once security is established to the point where the PHP user (in this case, the apache user) has very little risk attached to it, it is discovered that PHP is now prevented from writing any files to user directories. Or perhaps it has been prevented from accessing or changing databases. It has equally been secured from writing good and bad files, or entering good and bad database transactions.

A frequent security mistake made at this point is to allow apache root permissions, or to escalate apache's abilities in some other way.

Escalating the Apache user's permissions to root is extremely dangerous and may compromise the entire system, so sudo'ing, chroot'ing, or otherwise running as root should not be considered by those who are not security professionals.

There are some simpler solutions. By using open_basedir you can control and restrict what directories are allowed to be used for PHP. You can also set up apache-only areas, to restrict all web based activity to non-user, or non-system, files.

add a note add a note

User Contributed Notes 4 notes

up
15
bk 2 at me dot com
7 years ago
doc_root already limits apache/php script folder locations.

open_basedir is better used to restrict script access to folders
which do NOT contain scripts. Can be a sub-folder of doc_root as in php doc example doc_root/tmp, but better yet in a separate folder tree, like ~user/open_basedir_root/. Harmful scripts could modify other scripts if doc_root (or include_path) and open_basedir overlap.
If apache/php can't browse scripts in open_basedir, even if malicious scripts uploaded more bad scripts there, they won't be browse-able (executable).

One should also note that the many shell execute functions are effectively a way to bypass open_basedir limits, and such functions should be disabled if security demands strict folder access control. Harmful scripts can do the unix/windows version of "delete */*/*/*" if allowed to execute native os shell commands via those functions. OS Shell commands could similarly bypass redirect restrictions and upload file restrictions by just brute force copying files into the doc_root tree. It would be nice if they could be disabled as a group or class of functions, but it is still possible to disable them one by one if needed for security.

PS. currently there is a bug whereby the documented setting of open_basedir to docroot/tmp will not work if any include or require statements are done. Right now include will fail if the included php file is not in BOTH the open_basedir tree and the doc_root+include_path trees. Which is the opposite of safe.
This means by any included php file must be in open_basedir, so is vulnerable to harmful scripts and php viruses like Injektor.
up
2
daniel dot eckl at gmx dot de
16 years ago
There is a better solution than starting every virtual host in a seperate instance, which is wasting ressources.

You can set open_basedir dynamically for every virtual host you have, so every PHP script on a virtual host is jailed to its document root.

Example:
<VirtualHost www.example.com>
  ServerName www.example.com
  DocumentRoot /www-home/example.com
[...]
  <Location />
    php_admin_value open_basedir     \ "/www-home/example.com/:/usr/lib/php/"
  </Location>
</VirtualHost>

If you set safe_mode on, then the script can only use binaries in given directories (make a special dir only with the binaries your customers may use).

Now no user of a virtual host can read/write/modify the data of another user on your machine.

Windseeker
up
-10
Vikanich
10 years ago
Big thanks to "daniel dot eckl at gmx dot de" but i have to change his config, because it doesn't work (may be wrong syntax).
I have add only this string to VirtualHost config and it works.
php_admin_value open_basedir  /www/site1/
Now all php scripts are locked in the directory.
up
-15
Kibab
13 years ago
I'm running Windows version of Apache with php as module. System is Windows XP Service Pack 2 on NTFS filesystem. To avoid potential security problems, I've set Apache to run under NT AUTHORITY\Network Service account, and there is only one directory, named Content, with Full Access for this account. Other directories are either not accessible at all or with readonly permissions (like %systemroot%)... So, even if Apache will be broken, nothing would happen to entire system, because that account doesn't have admin privilegies :)
To Top
  • 哈洽会上的台商:希望更多人分享中华文化 2019-06-18
  • 人民网评:厉害了我的国,厉害了我的环保 2019-06-18
  • 2018全国男篮NBL联赛第4轮:河北翔蓝Vs贵州古雾堂茶 2019-06-18
  • 西湖龙井、潍坊风筝、宣纸徽墨……大运河非遗大展亮相农展馆 2019-06-17
  • 追寻峥嵘岁月的精神传奇(铸剑·纪念中国人民解放军建军90周年特刊) 2019-06-17
  • 人民日报人民时评:广交会,见证更加开放的中国 2019-06-17
  • “最美水鸟”紫水鸡现身异龙湖湿地 春城壹网 七彩云南 一网天下 2019-06-16
  • 忙着给孩子报夏令营?专家:不妨让孩子过个无聊暑假 2019-06-16
  • [微笑]原因很简单:房产的升值是由关联资源的增加形成的,跟房屋的产权人没有任何关系,肯定就不能让其从中获利! 2019-06-16
  • 范丞丞亮相快闪店秀抓娃娃功力 现场遭粉丝围堵 2019-06-16
  • 《金蝉脱壳2》曝光特辑 黄晓明打得一手漂亮的咏春 2019-06-15
  • 社长手记心无旁骛40年,谭旭光是致敬改革开放的绝佳样本 2019-06-15
  • 回复@大雨582:社会人不可能像自然人一样自由,你还得尊重别人的意愿!不然咱随便生产啥都强行让你要,咱是自由了,你呢? 2019-06-15
  • 成都与诗文中的“西楼” 2019-06-14
  • 民族宫观汉藏书画艺术展珍视历史 传承文化 彰显新时代风采 2019-06-14
  • 680| 832| 94| 203| 534| 399| 307| 276| 825| 786|