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

Fixed bug in prototypejs #3003

Merged
merged 2 commits into from
Feb 2, 2023
Merged

Fixed bug in prototypejs #3003

merged 2 commits into from
Feb 2, 2023

Conversation

fballiano
Copy link
Contributor

Everything is explain in prototypejs/prototype#356

I'm not publishing too many details on this PR since it's a delicate matter, but we should merge it ASAP

@elidrissidev
Copy link
Member

If I try the regex on the string <strong>Hello World</strong>, the new one doesn't match the closing tag. Is that intended?

@theroch
Copy link
Contributor

theroch commented Feb 1, 2023

The PR is a little bit different from prototypejs/prototype#349
We've tested only the PR349 successfully.

Why is this PR public?

@elidrissidev
Copy link
Member

Yes, the solution proposed in prototypejs/prototype#349 seems to be working fine.

@fballiano
Copy link
Contributor Author

fballiano commented Feb 1, 2023

@elidrissidev switched the PR to the code used in prototypejs/prototype#349

@theroch cause it's public on prototype repo since 2021, also, if we merge it quick we can release it quick

@theroch
Copy link
Contributor

theroch commented Feb 1, 2023

@theroch cause it's public on prototype repo since 2021, also, if we merge it quick we can release it quick

It's an argument ;)

Copy link
Member

@elidrissidev elidrissidev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Regex works fine, but untested since I don't know how to replicate the issue.

@kiatng
Copy link
Contributor

kiatng commented Feb 2, 2023

I found an attack script, but not sure how to test it. If someone can test if the fix really works?

@theroch
Copy link
Contributor

theroch commented Feb 2, 2023

I found an attack script, but not sure how to test it. If someone can test if the fix really works?

We've tested with this script and we can confirm that this fixed the issue.

Sorry I was very busy, so I only now get to answer you again.
Yesterday I sent an email to [email protected] with all this information. Did none of you receive this mail?

@elidrissidev
Copy link
Member

Yesterday I sent an email to [email protected] with all this information. Did none of you receive this mail?

/cc @Flyingmana

@Flyingmana
Copy link
Contributor

Flyingmana commented Feb 2, 2023

I found an attack script, but not sure how to test it. If someone can test if the fix really works?

We've tested with this script and we can confirm that this fixed the issue.

Sorry I was very busy, so I only now get to answer you again.
Yesterday I sent an email to [email protected] with all this information. Did none of you receive this mail?

I did and forwarded it internally, where @fballiano got it and volunteered to take care of it.

(there are currently 3 or 4 people behind the security contact address)

@fballiano
Copy link
Contributor Author

@theroch that's the info I left out intentionally :-D

Copy link
Contributor

@kiatng kiatng left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested. Add the following in any page

<script>
function build_attack(n) {
	var ret = "hello <span> <a "
	for (var i = 0; i < n; i++) {
		ret += "'"
	}

	return ret+"!";
}
function attack() {
    for(var i = 1; i <= 50000; i++) {
        var time = Date.now();
        var attack_str = build_attack(i)
        attack_str.stripTags()
        var time_cost = Date.now() - time;
        console.log("attack_str.length: " + attack_str.length + ": " + time_cost+" ms")
    }
}
</script>

Then execute the attack in browser console. The page became unresponsive without this PR.

@fballiano fballiano merged commit 9af7115 into OpenMage:1.9.4.x Feb 2, 2023
@fballiano fballiano deleted the prototype_redos branch February 2, 2023 10:00
@fballiano
Copy link
Contributor Author

merged and ported to v20

@kiatng @elidrissidev @Flyingmana do you think we should do another hotfix release?

@elidrissidev
Copy link
Member

Anything blocking a full release?

@Flyingmana
Copy link
Contributor

merged and ported to v20

@kiatng @elidrissidev @Flyingmana do you think we should do another hotfix release?

as its related to a CVE, its probably preferred by users to have another release

@theroch
Copy link
Contributor

theroch commented Feb 2, 2023

How is it with the version number in prototype.js. Is it possible to increase it to 1.7.4 or 1.7.3.1.
External auditors looks only for the versions numbers and and would find fault with or comment on that.

@fballiano
Copy link
Contributor Author

I wouldn't change the prototype version as prototype itself didn't do anything about it.

as per ZF1, we apply patches but don't change their version number.

@fballiano
Copy link
Contributor Author

@Flyingmana I'll prepare another hotfix

@fballiano
Copy link
Contributor Author

I've prepared the 2 hotfix branches with version bump and this commit, could you just do a quick check for me before actually tagging the release? thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
JavaScript Relates to js/* security
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants