Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index International Gentoo Users Polskie forum (Polish) Polish OTW
  • Search

Apache shell_exec php jako inny uzytkownik

Rozmowy nie związane ściśle z Gentoo

Moderator: SlashBeast

Post Reply
  • Print view
Advanced search
7 posts • Page 1 of 1
Author
Message
soban_
l33t
l33t
User avatar
Posts: 668
Joined: Wed Aug 27, 2008 1:30 pm
Location: /home/soban
Contact:
Contact soban_
Website

Apache shell_exec php jako inny uzytkownik

  • Quote

Post by soban_ » Wed Aug 31, 2011 6:58 pm

Mam nastepujacy problem, potrzebuje wywolac z shella jako inny uzytkownik pewien skrypt. Jednak nie mam pojecia jak bezpiecznie to zrobic, wiem ze z poziomu su moglbym, ale to chyba jednak za bardzo jest niebezpieczne? Tak przedstawia sie zawartosc nastepujacych plikow:

Code: Select all

cat /home/uzytkownik/panel/cos.php
<?php
$output = shell_exec('/home/uzytkownik/panel/skrypt.sh');
echo "<pre>$output</pre>";
?>
Oraz:

Code: Select all

cat /home/uzytkownik/panel/skrypt.sh
#!/bin/bash
whoami
I dostaje oczywiscie efekt, ze skrypt jest wywolany z poziomu uzytkownika "apache". Macie pomysl jak uruchomic ten skrypt z poziomu "uzytkownik"? Podaje jeszcze dodatkowe informacje:

Code: Select all

[I] www-servers/apache
     Available versions:  (2) 2.2.14-r1 2.2.15 2.2.16 ~2.2.16-r1 2.2.17
        {apache2_modules_actions apache2_modules_alias apache2_modules_asis apache2_modules_auth_basic apache2_modules_auth_digest apache2_modules_authn_alias apache2_modules_authn_anon apache2_modules_authn_dbd apache2_modules_authn_dbm apache2_modules_authn_default apache2_modules_authn_file apache2_modules_authz_dbm apache2_modules_authz_default apache2_modules_authz_groupfile apache2_modules_authz_host apache2_modules_authz_owner apache2_modules_authz_user apache2_modules_autoindex apache2_modules_cache apache2_modules_cern_meta apache2_modules_cgi apache2_modules_cgid apache2_modules_charset_lite apache2_modules_dav apache2_modules_dav_fs apache2_modules_dav_lock apache2_modules_dbd apache2_modules_deflate apache2_modules_dir apache2_modules_disk_cache apache2_modules_dumpio apache2_modules_env apache2_modules_expires apache2_modules_ext_filter apache2_modules_file_cache apache2_modules_filter apache2_modules_headers apache2_modules_ident apache2_modules_imagemap apache2_modules_include apache2_modules_info apache2_modules_log_config apache2_modules_log_forensic apache2_modules_logio apache2_modules_mem_cache apache2_modules_mime apache2_modules_mime_magic apache2_modules_negotiation apache2_modules_proxy apache2_modules_proxy_ajp apache2_modules_proxy_balancer apache2_modules_proxy_connect apache2_modules_proxy_ftp apache2_modules_proxy_http apache2_modules_proxy_scgi apache2_modules_reqtimeout apache2_modules_rewrite apache2_modules_setenvif apache2_modules_speling apache2_modules_status apache2_modules_substitute apache2_modules_unique_id apache2_modules_userdir apache2_modules_usertrack apache2_modules_version apache2_modules_vhost_alias apache2_mpms_event apache2_mpms_itk apache2_mpms_peruser apache2_mpms_prefork apache2_mpms_worker debug doc ldap selinux ssl static suexec threads}
     Installed versions:  2.2.17(2)(12:07:50 24.04.2011)(apache2_modules_actions apache2_modules_alias apache2_modules_auth_basic apache2_modules_authn_alias apache2_modules_authn_anon apache2_modules_authn_dbm apache2_modules_authn_default apache2_modules_authn_file apache2_modules_authz_dbm apache2_modules_authz_default apache2_modules_authz_groupfile apache2_modules_authz_host apache2_modules_authz_owner apache2_modules_authz_user apache2_modules_autoindex apache2_modules_cache apache2_modules_cgi apache2_modules_cgid apache2_modules_dav apache2_modules_dav_fs apache2_modules_dav_lock apache2_modules_deflate apache2_modules_dir apache2_modules_disk_cache apache2_modules_env apache2_modules_expires apache2_modules_ext_filter apache2_modules_file_cache apache2_modules_filter apache2_modules_headers apache2_modules_include apache2_modules_info apache2_modules_log_config apache2_modules_logio apache2_modules_mem_cache apache2_modules_mime apache2_modules_mime_magic apache2_modules_negotiation apache2_modules_rewrite apache2_modules_setenvif apache2_modules_speling apache2_modules_status apache2_modules_unique_id apache2_modules_userdir apache2_modules_usertrack apache2_modules_vhost_alias ssl threads -apache2_modules_asis -apache2_modules_auth_digest -apache2_modules_authn_dbd -apache2_modules_cern_meta -apache2_modules_charset_lite -apache2_modules_dbd -apache2_modules_dumpio -apache2_modules_ident -apache2_modules_imagemap -apache2_modules_log_forensic -apache2_modules_proxy -apache2_modules_proxy_ajp -apache2_modules_proxy_balancer -apache2_modules_proxy_connect -apache2_modules_proxy_ftp -apache2_modules_proxy_http -apache2_modules_proxy_scgi -apache2_modules_reqtimeout -apache2_modules_substitute -apache2_modules_version -apache2_mpms_event -apache2_mpms_itk -apache2_mpms_peruser -apache2_mpms_prefork -apache2_mpms_worker -debug -doc -ldap -selinux -static -suexec)
     Homepage:            http://httpd.apache.org/
     Description:         The Apache Web Server.
Oraz

Code: Select all

[I] dev-lang/php
     Available versions:
        (5.2)   [M]5.2.17
        (5.3)   5.3.6 ~5.3.6-r1 [M]~5.3.7_rc5
        (5.4)   [M]~5.4.0_alpha3
        {adabas apache2 bcmath berkdb birdstep bzip2 calendar cdb cgi cjk +cli crypt +ctype curl curlwrappers db2 dbase dbmaker debug discard-path doc embed empress empress-bcs enchant esoob exif fdftk +fileinfo +filter firebird flatfile force-cgi-redirect fpm frontbase ftp gd gd-external gdbm gmp +hash +iconv imap inifile interbase intl iodbc ipv6 +json kerberos kolab ldap ldap-sasl libedit mhash msql mssql mysql mysqli mysqlnd ncurses nls oci8 oci8-instant-client odbc pcntl +pcre pdo +phar pic +posix postgres qdbm readline recode reflection sapdb +session sharedext sharedmem +simplexml snmp soap sockets solid spell spl sqlite sqlite3 ssl suhosin sybase-ct sysvipc threads tidy +tokenizer truetype unicode wddx xml xmlreader xmlrpc xmlwriter xpm xsl zip zlib}
     Installed versions:  5.3.6(5.3)(10:57:38 30.06.2011)(apache2 berkdb bzip2 cgi cli crypt ctype curl fileinfo filter ftp gd gdbm hash iconv json mysql mysqli nls pdo phar posix postgres readline session simplexml snmp sockets spell sqlite ssl threads tokenizer truetype unicode xml zip zlib -adabas -bcmath -birdstep -calendar -cdb -cjk -curlwrappers -db2 -dbmaker -debug -doc -embed -empress -empress-bcs -enchant -esoob -exif -firebird -flatfile -fpm -frontbase -gd-external -gmp -imap -inifile -interbase -intl -iodbc -ipv6 -kerberos -kolab -ldap -ldap-sasl -libedit -mhash -mssql -mysqlnd -oci8 -oci8-instant-client -odbc -pcntl -pic -qdbm -recode -sapdb -sharedext -sharedmem -soap -solid -sqlite3 -sybase-ct -sysvipc -tidy -wddx -xmlreader -xmlrpc -xmlwriter -xpm -xsl)
     Homepage:            http://php.net/
     Description:         The PHP language runtime engine: CLI, CGI, FPM/FastCGI, Apache2 and embed SAPIs.
Jeszcze zeby troche utrudnic sprawe to powiem ze folder ze strona znajduje sie w /home/strona/www/panel jest podlinkowany tam panel z poziomu roota do /home/uzytkownik/panel, no ale chyba to nie problem.
gg: 525600
Top
SlashBeast
Retired Dev
Retired Dev
User avatar
Posts: 2922
Joined: Tue May 23, 2006 11:50 am
Contact:
Contact SlashBeast
Website

  • Quote

Post by SlashBeast » Wed Aug 31, 2011 8:19 pm

Masz php odpalane z userem apache i pozwalasz na shell_exec? Przeciez to jest strzal w stope i proszenie sie o wlamanie. Poczytaj o suphp, suexec i odpalaniu php per-vhost.

Tak czy inaczej, jezeli naprawde musisz z php odpalic skrypt szelowy - cos jest bardzo nie tak.
Top
soban_
l33t
l33t
User avatar
Posts: 668
Joined: Wed Aug 27, 2008 1:30 pm
Location: /home/soban
Contact:
Contact soban_
Website

  • Quote

Post by soban_ » Wed Aug 31, 2011 8:22 pm

A jak bys zaproponowal to zrobic? Tak potrzebuje z shella sie dostac, bo musze dac innym mozliwsc zresetowania uslugi, zatrzymania jej itp. Chyba ze masz inny pomysl na zrealizowanie czegos takiego. No oczywiscie dostep do tego bedzie na haslo i niewiele osob bedzie wiedzialo o tym i mialo do tego dostep (tylko administratorzy - wiec jakies 3 osoby).
gg: 525600
Top
SlashBeast
Retired Dev
Retired Dev
User avatar
Posts: 2922
Joined: Tue May 23, 2006 11:50 am
Contact:
Contact SlashBeast
Website

  • Quote

Post by SlashBeast » Wed Aug 31, 2011 8:27 pm

Sposobow jest wiele, napisanie sobie jakiegos deamona ktory po unix socketcie bedzie odbieral zdania, autoryzowal i wykonywal, to jeden z przykladow.
Top
soban_
l33t
l33t
User avatar
Posts: 668
Joined: Wed Aug 27, 2008 1:30 pm
Location: /home/soban
Contact:
Contact soban_
Website

  • Quote

Post by soban_ » Wed Aug 31, 2011 8:35 pm

No ale z htaccess tez chyba uzyskam jakis stopien autoryzacji do tego. A pisanie nowej aplikacji to tez niezla mysl, tylko zastanawiam sie czy to rzeczywiscie bedzie mialo sens przy wykonaniu 3-4 polecen z szela...
gg: 525600
Top
SlashBeast
Retired Dev
Retired Dev
User avatar
Posts: 2922
Joined: Tue May 23, 2006 11:50 am
Contact:
Contact SlashBeast
Website

  • Quote

Post by SlashBeast » Wed Aug 31, 2011 8:48 pm

Whoa, ja tylko mam nadzieje, ze nie jestes kolejnym sprzedawca watpliwych VPSow, bo jak widze, ze chcesz do 2-3 polecen robic jakis dziwny panel w php, z shell_exec, przy czym nie masz pojecia nawet jakie to niesie za soba dziury, to az sie boje.
Top
soban_
l33t
l33t
User avatar
Posts: 668
Joined: Wed Aug 27, 2008 1:30 pm
Location: /home/soban
Contact:
Contact soban_
Website

  • Quote

Post by soban_ » Wed Aug 31, 2011 9:22 pm

E nie, ja to tylko robie pod testowy panel - ktory i tak zniknie pod server gry mc. A jest to potrzebne, ze wzgledu na sprawdzanie pluginow, ktore po skonfigurowaniu wymagaja przeladowania serwera/uslugi. Nic to z VPSami nie ma wspolnego. A nie chce dawac pelnego dostepu po ssh do konta.
gg: 525600
Top
Post Reply
  • Print view

7 posts • Page 1 of 1

Return to “Polish OTW”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy

 

 

magic