Guest User

aa

a guest
Feb 9th, 2011
564
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 8.22 KB | None | 0 0
  1. The challenge to solve:
  2.  
  3. This is the code we know is on the server:
  4.  
  5. <?php
  6. define('SYS_CON', 'dc877c9decfce360db824b8b2a385500816030be6e33dc770d77dffbf25addfe');
  7. define('SYS_VER', 'b9e39ffdadb649289db6e601dc1e1f642cf6673c8908cdd24181a657cc68db8e');
  8. define('SYS_AUT', '05a4d9e259fc3d11d997e521addb6be1cb8752e7f99339324f02d74f50f0254c');
  9. //include("includes/anti_rfi.php"); //rfi is forbidden!!!!!
  10. function x___1_k($l){$s=array();for($i=0;$i< strlen($l);$i++){array_push($s,substr($l,$i,1));}return $s;}
  11. function x__3_h($k){$m="";foreach($k AS $x){$m.=$x;}return $m;}
  12. $inc = $_GET['file'];
  13. require_once(x__3_h(x___1_k($inc)).'.html');
  14. ?>
  15.  
  16. That is all we know. We are trying to accomplish Remote Code Execution. Using RFI or LFI to accomplish it is not allowed.
  17.  
  18. We also have a sample php.ini code that is installed on remote server:
  19.  
  20. ;;;;;;;;;;;;;;;;
  21. ; File Uploads ;
  22. ;;;;;;;;;;;;;;;;
  23.  
  24. ; Whether to allow HTTP file uploads.
  25. ; http://php.net/file-uploads
  26. file_uploads = On
  27.  
  28. ; Temporary directory for HTTP uploaded files (will use system default if not
  29. ; specified).
  30. ; http://php.net/upload-tmp-dir
  31. ;upload_tmp_dir =
  32.  
  33. ; Maximum allowed size for uploaded files.
  34. ; http://php.net/upload-max-filesize
  35. upload_max_filesize = 2M
  36.  
  37. ;;;;;;;;;;;;;;;;;;
  38. ; Fopen wrappers ;
  39. ;;;;;;;;;;;;;;;;;;
  40.  
  41. ; Whether to allow the treatment of URLs (like http:// or ftp://) as files.
  42. ; http://php.net/allow-url-fopen
  43. allow_url_fopen = On
  44.  
  45. ; Whether to allow include/require to open URLs (like http:// or ftp://) as files.
  46. ; http://php.net/allow-url-include
  47. allow_url_include = On
  48.  
  49. ; Define the anonymous ftp password (your email address). PHP's default setting
  50. ; for this is empty.
  51. ; http://php.net/from
  52.  
  53. ; Define the User-Agent string. PHP's default setting for this is empty.
  54. ; http://php.net/user-agent
  55. ;user_agent="PHP"
  56.  
  57. ; Default timeout for socket based streams (seconds)
  58. ; http://php.net/default-socket-timeout
  59. default_socket_timeout = 60
  60.  
  61. ; If your scripts have to deal with files from Macintosh systems,
  62. ; or you are running on a Mac and need to deal with files from
  63. ; unix or win32 systems, setting this flag will cause PHP to
  64. ; automatically detect the EOL character in those files so that
  65. ; fgets() and file() will work regardless of the source of the file.
  66. ; http://php.net/auto-detect-line-endings
  67. ;auto_detect_line_endings = Off
  68.  
  69. ;;;;;;;;;;;;;;;;;;;;;;
  70. ; Dynamic Extensions ;
  71. ;;;;;;;;;;;;;;;;;;;;;;
  72.  
  73. ; If you wish to have an extension loaded automatically, use the following
  74. ; syntax:
  75. ;
  76. ;   extension=modulename.extension
  77. ;
  78. ; For example, on Windows:
  79. ;
  80. ;   extension=msql.dll
  81. ;
  82. ; ... or under UNIX:
  83. ;
  84. ;   extension=msql.so
  85. ;
  86. ; ... or with a path:
  87. ;
  88. ;   extension=/path/to/extension/msql.so
  89. ;
  90. ; If you only provide the name of the extension, PHP will look for it in its
  91. ; default extension directory.
  92. ;
  93. ; Windows Extensions
  94. ; Note that ODBC support is built in, so no dll is needed for it.
  95. ; Note that many DLL files are located in the extensions/ (PHP 4) ext/ (PHP 5)
  96. ; extension folders as well as the separate PECL DLL download (PHP 5).
  97. ; Be sure to appropriately set the extension_dir directive.
  98. ;
  99. ;extension=php_bz2.dll
  100. ;extension=php_curl.dll
  101. ;extension=php_dba.dll
  102. ;extension=php_exif.dll
  103. ;extension=php_fileinfo.dll
  104. ;extension=php_gd2.dll
  105. ;extension=php_gettext.dll
  106. ;extension=php_gmp.dll
  107. ;extension=php_intl.dll
  108. ;extension=php_imap.dll
  109. ;extension=php_interbase.dll
  110. ;extension=php_ldap.dll
  111. ;extension=php_mbstring.dll
  112. ;extension=php_ming.dll
  113. ;extension=php_mssql.dll
  114. ;extension=php_mysql.dll
  115. ;extension=php_mysqli.dll
  116. ;extension=php_oci8.dll      ; Use with Oracle 10gR2 Instant Client
  117. ;extension=php_oci8_11g.dll  ; Use with Oracle 11g Instant Client
  118. ;extension=php_openssl.dll
  119. ;extension=php_pdo_firebird.dll
  120. ;extension=php_pdo_mssql.dll
  121. ;extension=php_pdo_mysql.dll
  122. ;extension=php_pdo_oci.dll
  123. ;extension=php_pdo_odbc.dll
  124. ;extension=php_pdo_pgsql.dll
  125. ;extension=php_pdo_sqlite.dll
  126. ;extension=php_pgsql.dll
  127. ;extension=php_phar.dll
  128. ;extension=php_pspell.dll
  129. ;extension=php_shmop.dll
  130. ;extension=php_snmp.dll
  131. ;extension=php_soap.dll
  132. ;extension=php_sockets.dll
  133. ;extension=php_sqlite.dll
  134. ;extension=php_sqlite3.dll
  135. ;extension=php_sybase_ct.dll
  136. ;extension=php_tidy.dll
  137. ;extension=php_xmlrpc.dll
  138. ;extension=php_xsl.dll
  139. ;extension=php_zip.dll
  140.  
  141. extension="zip.so"
  142.  
  143. extension="sqlite.so"
  144.  
  145. extension="radius.so"
  146.  
  147. extension="pgsql.so"
  148.  
  149. ; disabled in XAMPP 1.7.2 because incompatible with PHP 5.3.0
  150. ;extension="dbx.so"
  151.  
  152. extension="ming.so"
  153.  
  154. ;extension="dio.so"
  155.  
  156. ;extension="interbase.so"
  157.  
  158. ; disabled in XAMPP 1.7.2 because incompatible with PHP 5.3.0
  159. ;extension="eaccelerator.so"
  160. ;eaccelerator.shm_size="16"
  161. ;eaccelerator.cache_dir="/opt/lampp/tmp/eaccelerator"
  162. ;eaccelerator.enable="1"
  163. ;eaccelerator.optimizer="1"
  164. ;eaccelerator.check_mtime="1"
  165. ;eaccelerator.debug="0"
  166. ;eaccelerator.filter=""
  167. ;eaccelerator.shm_max="0"
  168. ;eaccelerator.shm_ttl="0"
  169. ;eaccelerator.shm_prune_period="0"
  170. ;eaccelerator.shm_only="0"
  171. ;eaccelerator.compress="1"
  172. ;eaccelerator.compress_level="9"
  173.  
  174. ;oci8mark
  175.  
  176.  
  177. ;;;;;;;;;;;;;;;;;;;
  178. ; Module Settings ;
  179. ;;;;;;;;;;;;;;;;;;;
  180.  
  181. [Date]
  182. ; Defines the default timezone used by the date functions
  183. ; http://php.net/date.timezone
  184. date.timezone = Europe/Berlin
  185.  
  186. ; http://php.net/date.default-latitude
  187. ;date.default_latitude = 31.7667
  188.  
  189. ; http://php.net/date.default-longitude
  190. ;date.default_longitude = 35.2333
  191.  
  192. ; http://php.net/date.sunrise-zenith
  193. ;date.sunrise_zenith = 90.583333
  194.  
  195. ; http://php.net/date.sunset-zenith
  196. ;date.sunset_zenith = 90.583333
  197.  
  198. [filter]
  199. ; http://php.net/filter.default
  200. ;filter.default = unsafe_raw
  201.  
  202. ; http://php.net/filter.default-flags
  203. ;filter.default_flags =
  204.  
  205. [iconv]
  206. ;iconv.input_encoding = ISO-8859-1
  207. ;iconv.internal_encoding = ISO-8859-1
  208. ;iconv.output_encoding = ISO-8859-1
  209.  
  210. [intl]
  211. ;intl.default_locale =
  212.  
  213. [sqlite]
  214. ; http://php.net/sqlite.assoc-case
  215. ;sqlite.assoc_case = 0
  216.  
  217. [sqlite3]
  218. ;sqlite3.extension_dir =
  219.  
  220. [Pcre]
  221. ;PCRE library backtracking limit.
  222. ; http://php.net/pcre.backtrack-limit
  223. ;pcre.backtrack_limit=100000
  224.  
  225. ;PCRE library recursion limit.
  226. ;Please note that if you set this value to a high number you may consume all
  227. ;the available process stack and eventually crash PHP (due to reaching the
  228. ;stack size limit imposed by the Operating System).
  229. ; http://php.net/pcre.recursion-limit
  230. ;pcre.recursion_limit=100000
  231.  
  232. [Pdo]
  233. ; Whether to pool ODBC connections. Can be one of "strict", "relaxed" or "off"
  234. ; http://php.net/pdo-odbc.connection-pooling
  235. ;pdo_odbc.connection_pooling=strict
  236.  
  237. ;pdo_odbc.db2_instance_name
  238.  
  239. [Pdo_mysql]
  240. ; If mysqlnd is used: Number of cache slots for the internal result set cache
  241. ; http://php.net/pdo_mysql.cache_size
  242. pdo_mysql.cache_size = 2000
  243.  
  244. ; Default socket name for local MySQL connects.  If empty, uses the built-in
  245. ; MySQL defaults.
  246. ; http://php.net/pdo_mysql.default-socket
  247. pdo_mysql.default_socket=
  248.  
  249. [Phar]
  250. ; http://php.net/phar.readonly
  251. ;phar.readonly = On
  252.  
  253. ; http://php.net/phar.require-hash
  254. ;phar.require_hash = On
  255.  
  256. ;phar.cache_list =
  257.  
  258. [Syslog]
  259. ; Whether or not to define the various syslog variables (e.g. $LOG_PID,
  260. ; $LOG_CRON, etc.).  Turning it off is a good idea performance-wise.  In
  261. ; runtime, you can define these variables by calling define_syslog_variables().
  262. ; http://php.net/define-syslog-variables
  263. define_syslog_variables  = Off
  264.  
  265. [mail function]
  266. ; For Win32 only.
  267. ; http://php.net/smtp
  268. SMTP = localhost
  269. ; http://php.net/smtp-port
  270. smtp_port = 25
  271.  
  272. ; For Win32 only.
  273. ; http://php.net/sendmail-from
  274. ;sendmail_from = [email protected]
  275.  
  276. ; For Unix only.  You may supply arguments as well (default: "sendmail -t -i").
  277. ; http://php.net/sendmail-path
  278. ;sendmail_path =
  279.  
  280. ; Force the addition of the specified parameters to be passed as extra parameters
  281. ; to the sendmail binary. These parameters will always replace the value of
  282. ; the 5th parameter to mail(), even in safe mode.
  283. ;mail.force_extra_parameters =
  284.  
  285. ; Add X-PHP-Originating-Script: that will include uid of the script followed by the filename
  286. mail.add_x_header = On
  287.  
  288. ; Log all mail() calls including the full path of the script, line #, to address and headers
  289. ;mail.log =
  290.  
  291.  
  292.  
  293.  
  294.  
  295.  
  296.  
  297.  
  298.  
  299.  
  300. /////////////
  301.  
  302.  
  303.  
  304.  
  305. End of php.ini file. The answer to the challenge is supposed to be in it...
Advertisement
Add Comment
Please, Sign In to add comment