


Securityoverridehacking challenge Summary of problem-solving ideas——Advanced
Continuing the work of summarizing problem-solving ideas for the securityoverridehacking challenge in the previous article, this time I have completed Advanced. This mainly involves some attack methods about PHP, which can be used as a basis for an in-depth understanding.
3 The ultimate goal is to make $input=="0000". This is easy to handle. In PHP, any numeric string will eventually be converted into a number for comparison, so input can be any number of 0s. However, Filter finally added a regular judgment preg_match
(
"/^[d]{1,}$/D"<span></span>
, <span></span>
$input<span></span>
) <span></span>. This means that it cannot be a pure number. It is also relatively simple, just use the characteristics of 0 (elementary school knowledge: 0 is equal to the negative number of 0), so just enter -0.
<span></span>PS: About PHP’s weak class judgment rules
http://php.net/manual/en/types.comparisons.php
<span></span>
3.2 Obfuscated PHP:
Examine whether the code logic can be sorted out under the premise of obfuscation. There is no shortcut for this problem, manual cleaning is required. After clearing the comments and semicolons, the amount of code is actually not much. Then, by decoding some parts that should be decoded and directly replacing those that should be returned by the function, the code logic can be clarified. After finishing, the code logic is as follows:
session_start(); $_u=array();
$_u[0]='SERVER_ADDQUERY_STRINGREQUEST_METHODHTTP_ACCEPT'; //A string$_u[1] ='substr'; // substr function $_u[2]='base64_decode'; // decode method $_§§§§§§§ =preg_split('/(?!\##$$$uu) =/',_SERVER['QUERY_STRING']); // It can be simply understood as dividing by =
${"_g_1"} = urldecode($_§§§§§§§[0]); // key $ {"_g_2"} = _GET[${"_g_1"}]; // value if(LEVENSHTEIN(${"_g_1"},${"_g_2"})==0){// Key and value of parameters Must be the same i Validate_result ($ {"_ g_2"});
}; phpinfo();'){
$_SESSION["solved_advanced_2"] = true; '> ;Back to thechallenges main page.
Please note that you will only get feedback if you solve this challenge. Wrong attempts do not generateany output at all.< ;hr/>";
Highlight_file('code.php');
?>
It's very simple after that, just construct a url that meets the requirements.
3.3 Upload bypass
requires you to bypass the filter program and upload a php script. General ideas: 1 Directly upload the .php file (failed). 2 Upload the .php file, but change the contentType in the post content to image/jpg (failed). 3 Upload a normal jpg file and hide the php script (Linux command cattest.php>>image.jpg or use a tool to add comments. Try to keep the image simple or solid color to avoid certain image characters interfering with PHP parsing). Through the third step, this problem is solved.一下 Then I also studied the problem of how to perform the PHP script in JPG. After consulting the information and the test of my own, there are basically only these two methods that are more feasible:
include('images/' . $_GET['test.jpg']);require('images/' . $_GET['test.jpg']);
include( 'images/' . $_POST['test.jpg']);include('images/' . $_POST['test.jpg']);include('test.jpg');require('test .jpg');
?>· Set the jpg format interpreter to php in /etc/apache2/mods-available/php5.conf
Since the title has mentioned the existence of the local file inclusiong vulnerability, it is very simple to use the first method to execute the php script. It is roughly to use the injection method to control the variables in the include or require, so that the script can be executed. . 3.4 Local File Inclusion/WAF Bypass Okay, the research on 3.3 has worked, 3.4 requires the execution of the uploaded file (the file path has been given when the upload is successful in 3.3 , mine is /challenges/advanced/uploads/Ac3sk9j.jpg, I don’t know if it is the same for everyone). As mentioned in 3.3, if there are functions such as include or require in PHP, they can be used to execute the PHP code in jpg. Entering 3.4, after observation, I found that the url has the parameter page. I tried to modify it at will, and sure enough, an error message was given: test.phpcannot be found. Then the goal is very clear, modify the page parameters and specify the path to the jpg file. In the utilization path, .. represents the upper-level folder, and it is easy to write the relative path to ../uploads/Ac3sk9j.jpg. Attempt to request, the result is: uploads/Ac3sk9j.jpg.phpcannot
be found. There are two unsatisfactory points: 1) ../ is filtered out; 2) the file name is Ac3sk9j.jpg.php instead of Ac3sk9j.jpg. So we looked for solutions respectively: · For situations where a specific string is filtered, the simplest one is string replace. The corresponding cracking method is very simple, just piece together a string similar to aabb. After the middle ab is filtered, a new ab will be generated. Just write it here as….//. So the filtering method of stringreplace is the same as none. · .php suffix problem. Apparently the website adds a .php suffix to any request path. Google searched for bypass strategies, and there are two main types: 1) Using the maximum file path length of 4096 bytes, and then constructing an ultra-long file path by adding any number of /. After thinking about it, it is estimated that such a long URL will be intercepted by the server and return 414, so I did not try it; 2) Use the string terminator in C and add the terminator before .php to indicate truncation. It is common to use %00 as an example, but I tried it but failed. Later, I found it in an example
The above introduces the summary of security override hacking challenge problem-solving ideas - Advanced, including aspects of the content, I hope it will be helpful to friends who are interested in PHP tutorials.

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

PHP 8.4 brings several new features, security improvements, and performance improvements with healthy amounts of feature deprecations and removals. This guide explains how to install PHP 8.4 or upgrade to PHP 8.4 on Ubuntu, Debian, or their derivati

If you are an experienced PHP developer, you might have the feeling that you’ve been there and done that already.You have developed a significant number of applications, debugged millions of lines of code, and tweaked a bunch of scripts to achieve op

Visual Studio Code, also known as VS Code, is a free source code editor — or integrated development environment (IDE) — available for all major operating systems. With a large collection of extensions for many programming languages, VS Code can be c

JWT is an open standard based on JSON, used to securely transmit information between parties, mainly for identity authentication and information exchange. 1. JWT consists of three parts: Header, Payload and Signature. 2. The working principle of JWT includes three steps: generating JWT, verifying JWT and parsing Payload. 3. When using JWT for authentication in PHP, JWT can be generated and verified, and user role and permission information can be included in advanced usage. 4. Common errors include signature verification failure, token expiration, and payload oversized. Debugging skills include using debugging tools and logging. 5. Performance optimization and best practices include using appropriate signature algorithms, setting validity periods reasonably,

A string is a sequence of characters, including letters, numbers, and symbols. This tutorial will learn how to calculate the number of vowels in a given string in PHP using different methods. The vowels in English are a, e, i, o, u, and they can be uppercase or lowercase. What is a vowel? Vowels are alphabetic characters that represent a specific pronunciation. There are five vowels in English, including uppercase and lowercase: a, e, i, o, u Example 1 Input: String = "Tutorialspoint" Output: 6 explain The vowels in the string "Tutorialspoint" are u, o, i, a, o, i. There are 6 yuan in total

This tutorial demonstrates how to efficiently process XML documents using PHP. XML (eXtensible Markup Language) is a versatile text-based markup language designed for both human readability and machine parsing. It's commonly used for data storage an

Static binding (static::) implements late static binding (LSB) in PHP, allowing calling classes to be referenced in static contexts rather than defining classes. 1) The parsing process is performed at runtime, 2) Look up the call class in the inheritance relationship, 3) It may bring performance overhead.

What are the magic methods of PHP? PHP's magic methods include: 1.\_\_construct, used to initialize objects; 2.\_\_destruct, used to clean up resources; 3.\_\_call, handle non-existent method calls; 4.\_\_get, implement dynamic attribute access; 5.\_\_set, implement dynamic attribute settings. These methods are automatically called in certain situations, improving code flexibility and efficiency.
