mirror of
https://github.com/carlospolop/hacktricks
synced 2024-11-15 01:17:36 +00:00
GitBook: [#3123] No subject
This commit is contained in:
parent
5c433b43ae
commit
321f5ea7ea
1 changed files with 14 additions and 0 deletions
|
@ -139,6 +139,20 @@ something.constructor.prototype.sayHey = function(){console.log("Hey!")}
|
|||
|
||||
After executing that code, **each JS object will be able to execute the function `sayHey`**.
|
||||
|
||||
### Array elements pollution
|
||||
|
||||
Note that as you can pollute attributes of objects in JS, if you have access to pollute an array you can also **pollute values of the array** accessible **by indexes** (note that you cannot overwrite values, so you need to pollute indexes that are somehow used but not written).
|
||||
|
||||
```javascript
|
||||
c = [1,2]
|
||||
a = []
|
||||
a.constructor.prototype[1] = "yolo"
|
||||
b = []
|
||||
b[0] //undefined
|
||||
b[1] //"yolo"
|
||||
c[1] // 2 -- not
|
||||
```
|
||||
|
||||
## Examples
|
||||
|
||||
### Basic Example
|
||||
|
|
Loading…
Reference in a new issue