Advertisement
Guest User

ikiiokukyty

a guest
Feb 19th, 2015
604
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.76 KB | None | 0 0
  1. Bir neçə dəfə qarşıma bəzi serverlər çıxıb ki,serverdəki hər hansı sayta girişib shell atmağa qədər nail olmuşam.
  2. Lakin upload edilən shell heç bir halda code executiona gətirməyib.Əvəzinə hər dəfə İnternal server error almışam.
  3. Özü də onu deyim ki,eyni serverdə müxtəlif növ /müxtəlif cms-li saytlara qarşı eyni problem davam edib.
  4. Səbəbi araşdırdıqda bəlli olduki bu suphp-dən qaynaqlanır.Çox kiçik trick etməklə server admin serverə shell girməsinin qarşısını almağa çalışıb.
  5. Tam qarantlı metod deyil bu lakin onu deyim ki,attackeri yorandır və attacker daha çox əziyyət çəkməli olur.Müəyyən qədər olsa da attackerin müvəffəqiyyətli code execution almasının qarşısını alır.
  6.  
  7.  
  8.  
  9. Test etdiyim configurasiya:
  10.  
  11. [code]
  12.  
  13. [root@ html]# httpd -V
  14. Server version: Apache/2.4.10 (Fedora)
  15. Server built: Sep 3 2014 14:49:30
  16. Server's Module Magic Number: 20120211:36
  17. Server loaded: APR 1.5.1, APR-UTIL 1.5.4
  18. Compiled using: APR 1.5.1, APR-UTIL 1.5.3
  19. Architecture: 64-bit
  20. Server MPM: prefork
  21. threaded: no
  22. forked: yes (variable process count)
  23. Server compiled with....
  24. -D APR_HAS_SENDFILE
  25. -D APR_HAS_MMAP
  26. -D APR_HAVE_IPV6 (IPv4-mapped addresses enabled)
  27. -D APR_USE_SYSVSEM_SERIALIZE
  28. -D APR_USE_PTHREAD_SERIALIZE
  29. -D SINGLE_LISTEN_UNSERIALIZED_ACCEPT
  30. -D APR_HAS_OTHER_CHILD
  31. -D AP_HAVE_RELIABLE_PIPED_LOGS
  32. -D DYNAMIC_MODULE_LIMIT=256
  33. -D HTTPD_ROOT="/etc/httpd"
  34. -D SUEXEC_BIN="/usr/sbin/suexec"
  35. -D DEFAULT_PIDLOG="/run/httpd/httpd.pid"
  36. -D DEFAULT_SCOREBOARD="logs/apache_runtime_status"
  37. -D DEFAULT_ERRORLOG="logs/error_log"
  38. -D AP_TYPES_CONFIG_FILE="conf/mime.types"
  39. -D SERVER_CONFIG_FILE="conf/httpd.conf"
  40.  
  41.  
  42.  
  43. [root@ html]# umask -S
  44. u=rwx,g=rx,o=rx
  45. [root@ html]# cat /etc/suphp.conf|grep -i -A 5 -B 5 "0013"
  46.  
  47. ;PATH environment variable
  48. env_path=/bin:/usr/bin
  49.  
  50. ;Umask to set, specify in octal notation
  51. umask=0013
  52. ;#kohne umask=0077
  53.  
  54. ;#0011 test
  55.  
  56. ; Minimum UID
  57. [/code]
  58.  
  59. Fikir verdinizsə umask burada 0013 vermişəm.
  60. Məhz attackerin içini çətinləşdirən də umask 0013 -dür.
  61.  
  62.  
  63.  
  64.  
  65. [img]http://s020.radikal.ru/i701/1502/61/212438b50822.png[/img]
  66.  
  67.  
  68.  
  69.  
  70.  
  71.  
  72. [img]http://s009.radikal.ru/i307/1502/90/9a308cfd811e.png[/img]
  73.  
  74.  
  75.  
  76.  
  77. [img]http://s019.radikal.ru/i632/1502/2e/610f01ed5f29.png[/img]
  78.  
  79.  
  80. [root@ html]# cat codeexec.php
  81. <?php
  82.  
  83. die('<h1>isleyir?');
  84. ?>
  85.  
  86.  
  87. [root@ html]# php -l codeexec.php
  88. No syntax errors detected in codeexec.php
  89.  
  90.  
  91. [root@ html]# tail -f /var/log/httpd/error_log
  92.  
  93. [Fri Feb 20 00:38:03.042739 2015] [:error] [pid 7839] [client 127.0.0.1:39862] SoftException in Application.cpp:262: File "/var/www/html/codeexec.php" is writeable by group
  94. [Fri Feb 20 00:38:03.042806 2015] [core:error] [pid 7839] [client 127.0.0.1:39862] End of script output before headers: codeexec.php
  95. [Fri Feb 20 00:38:05.387049 2015] [:error] [pid 7862] [client 127.0.0.1:39863] SoftException in Application.cpp:262: File "/var/www/html/codeexec.php" is writeable by group
  96. [Fri Feb 20 00:38:05.387137 2015] [core:error] [pid 7862] [client 127.0.0.1:39863] End of script output before headers: codeexec.php
  97. [Fri Feb 20 00:38:16.060319 2015] [:error] [pid 7835] [client 127.0.0.1:39865] SoftException in Application.cpp:262: File "/var/www/html/codeexec.php" is writeable by group
  98. [Fri Feb 20 00:38:16.060372 2015] [core:error] [pid 7835] [client 127.0.0.1:39865] End of script output before headers: codeexec.php
  99.  
  100.  
  101.  
  102.  
  103. Bir daha qeyd edirəm ki,bu metod remote shell upload tipli vulnlarda xüsusilə uploaddan sonra faylın üzərində skript tərəfindən chmod əməliyyatı aparılmayan attack vektorlarına qarşı effektivdir.
  104.  
  105.  
  106. Ümüdvaram çox adamın işinə yarıyar.Xüsusilə server adminlərin işinə.
  107. (c) Anti-armenia.ORG Team
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement