An open API service indexing awesome lists of open source software.

https://github.com/mal-tee/protector-js

POC script that can be deployed alongside (untrusted) third-party scripts to prevent unwanted changes of href-attributes.
https://github.com/mal-tee/protector-js

clickjacking javascript poc

Last synced: 12 months ago
JSON representation

POC script that can be deployed alongside (untrusted) third-party scripts to prevent unwanted changes of href-attributes.

Awesome Lists containing this project

README

          

# `Protector.js`

`Protector.js` is a proof-of-concept script that can be deployed alongside (untrusted) third-party scripts to prevent Click Interception via changed href-attributes of hyperlinks.

## Threat Model
This script only protects against unwanted changes to links which are made by third-party scripts.

## Usage
This script must be included before any third-party script.
```html


Shop



//This will be allowed by the regex
s.href = 'shop.html#cart';

```

## Idea
`protector.js` overwrites the href attribute setter of the link-prototype.
Now this setter is called on writes like `a.href = "http://b.ad"` and we can discard unwanted changes. This is only a proof of concept and does not protect against other kinds of Click Interception. But we assume that protection against other kinds, such as Interception with Event Handlers, can be implemented similarly.