Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A tag unnormal output #63

Closed
aimuz opened this issue May 5, 2018 · 0 comments
Closed

A tag unnormal output #63

aimuz opened this issue May 5, 2018 · 0 comments

Comments

@aimuz
Copy link

aimuz commented May 5, 2018

	p := bluemonday.UGCPolicy()
	//p.AllowAttrs("src").Matching(regexp.MustCompile(`(?i)mailto|https?`)).OnElements("img")
	centents := []string{
		`<script>alert(/xss/);</script>;`,
		`<script src="http://xxx.xx/xx.js"></script>`,
		`<body onload=alert('test1')>`,
		`<b onmouseover=alert('Wufff!')>click me</b>;`,
		`<b onmouseover=alert('Wufff!')>click me!</b>`,
		`<a href="http://www.google.com/"><img src="https://ssl.gstatic.com/accounts/ui/logo_2x.png"/></a>`,
		`<a href="javascript:alert('XSS1')" onmouseover="alert('XSS2')">XSS<a>`,
		`<a href="http://www.google.com/" onmouseover="alert('XSS2')">XSS<a>`,
	}

	for _, v := range centents {
		t.Log(p.Sanitize(v))
	}

<a href="http://www.google.com/" onmouseover="alert('XSS2')">XSS<a>
ouput
<a href="http://www.google.com/" rel="nofollow">XSS

@aimuz aimuz closed this as completed May 5, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant