Sunday, November 8, 2026
HomeJavaScriptExploring ColdFusion's Undocumented FORM.getPartsArray() Methodology

Exploring ColdFusion’s Undocumented FORM.getPartsArray() Methodology


Just lately, I have been seeing a couple of errors in my ColdFusion logs for malicious requests which might be making an attempt to publish file uploads with a kind area named, add[]. The [] notation is Lucee CFML’s manner of grouping like-named fields into an array (versus the standard comma-delimited listing). It is a implausible function; and for the previous few years in Adobe ColdFusion, I have been utilizing a polyfill to supply that very same habits in my purposes.

However I solely examined my polyfill with URL-encoded kind submissions. And it appears that evidently as soon as you alter the shape’s enctype to multipart/form-data, the polyfill breaks. To get round this, we are able to use an undocumented function of Adobe ColdFusion — the kind.getPartsArray() methodology.

I’ve by no means seen this methodology earlier than; and there is solely a handful of references to it on Google, none of which explains the place the writer study it:

Warning: the next paragraph is Claude Code’s finest guess as to what this methodology is and when it was launched to Adobe ColdFusion. I’ve not been capable of confirm these information.

Apparently, ColdFusion has been utilizing Jason Hunter‘s com.oreilly.servlet (COS) library and its MultipartParser since possibly ColdFusion MX (ie, ACF 6, some 20 years in the past). When a kind is submitted with multipart/form-data, this parser kicks in and exposes its outcomes on the kind.getPartsArray() methodology; which returns a set that accommodates a mix of “param” and “file” elements:

When there is not any kind submission, or when the shape has been submitted with URL-encoded parameters, the kind.getPartsArray() methodology returns null.

Since I’ve by no means used this undocumented methodology earlier than, I needed to place collectively a bit proof-of-concept (POC) earlier than I tried to weave it into my current polyfill. On this POC, I’ve three <kind> tags that every submit a unique kind of request:

  1. methodology="GET"
  2. methodology="POST"
  3. methodology="POST" with enctype="multipart/form-data"

Every kind submits most of its information utilizing [] bracket notation to group like-named fields into an array. And every kind submission features a v (“model”), which let’s me isolate the completely different contexts for server-side processing. However let me present you the HTML earlier than we have a look at the ColdFusion processing:

<cfscript>

	// ... in separate code block later ...

</cfscript>

<!doctype html>
<html>
<head>
	<meta charset="utf-8">
	<title>ColdFusion's FORM.getPartsArray() Methodology</title>
	<hyperlink rel="stylesheet" kind="textual content/css" href="https://www.bennadel.com/weblog/./kinds.css">
</head>
<physique>

	<!--- V(1) - URL solely. --->
	<!--- Warning: FORM[GET] will drop search parameters within the ACTION attribute. --->
	<kind methodology="get" motion="./index.cfm">
		<enter kind="hidden" identify="v" worth="1" />
		<enter kind="hidden" identify="ids[]" worth="1" />
		<enter kind="hidden" identify="ids[]" worth="2" />
		<enter kind="hidden" identify="ids[]" worth="3" />
		<button kind="submit">
			URL ONLY
		</button>
	</kind>

	<!--- V(2) - FORM + URL, url-encoded parameters. --->
	<kind methodology="publish" motion="./index.cfm?v=2&ids[]=1&ids[]=2&ids[]=3">
		<enter kind="hidden" identify="type[]" worth="4" />
		<enter kind="hidden" identify="type[]" worth="5" />
		<enter kind="hidden" identify="type[]" worth="6" />
		<button kind="submit">
			URL + FORM
		</button>
	</kind>

	<!--- V(3) - FORM + URL, multipart-encoded parameters. --->
	<kind
		methodology="publish"
		motion="./index.cfm?v=3&ids[]=1&ids[]=2&ids[]=3"
		enctype="multipart/form-data">

		<enter kind="hidden" identify="type[]" worth="4" />
		<enter kind="hidden" identify="type[]" worth="5" />
		<enter kind="hidden" identify="type[]" worth="6" />

		<enter kind="file" identify="filename[]" />
		<enter kind="file" identify="filename[]" />
		<enter kind="file" identify="filename[]" />

		<button kind="submit">
			URL + FORM / Multipart
		</button>
	</kind>

	<cfdump label="URL Scope" var="#url#" />
	<cfdump label="FORM Scope" var="#kind#" />

</physique>
</html>

Observe that on the backside of the web page, I am dumping-out the url and kind scopes. These scopes are going to be modified by the ColdFusion server-side processing primarily based on the v worth that’s submitted. Let’s stroll by every v individually.

As you possibly can see, we translated the ids[] kind fields right into a url.ids entry, as an array, much less the [] suffix.

As you possibly can see, we translated the ids[] kind fields and the type[] kind fields right into a url.ids entry and a kind.type entry, every as an array, much less the [] suffix.

As you possibly can see, we translated the ids[], type[], and filename[] kind fields all into their array-based counterparts, much less the [] suffix. And since we have already forgone the usage of fileUpload(), I’ve determined to make the “file add end result” constructions a bit extra strong, utilizing a number of the information that kind.getPartsArray() has supplied.

Processing the add then turns into a matter of performing any desired safety test (reminiscent of mime-type validation) after which utilizing fileMove() to maneuver the file from the half.filepath short-term location into the everlasting location for my utility.

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments