Skip to main content
Ben Nadel at CF Summit West 2026 (Las Vegas) with: Yasir Shaukat
Ben Nadel at CF Summit West 2026 (Las Vegas) with: Yasir Shaukat

Custom Tag AttributeCollection Corruption In Adobe ColdFusion 2025

By
Published in — Comments (1)

I'm working on a recursive algorithm using ColdFusion custom tags and I ran into a strange bug. It seems that in Adobe ColdFusion 2025 (update 14 at the time of this writing), if you use attributeCollection to "spread" a struct into a custom tag with no other data attributes, any changes made to the attributes scope internally to the custom tag get applied directly to the passed-in struct. This means that mutations to the attributes scope can leak into the calling context.

To demonstrate, let's create a ColdFusion custom tag - myTag.cfm - that does nothing but add two keys to the attributes scope:

<cfscript>

	// Mutate attributes via indirect param.
	param name="attributes.addedViaParam" type="string" default="Leak";

	// Mutate attributes via direct assignment.
	attributes.addedViaAssignment = "Leak";

</cfscript>

Now, let's invoke this custom tag twice using the attributeCollection semantics. In the first invocation, we'll pass nothing but the given scope. In the second invocation, we'll pass the given scope plus an additional attribute:

<cfscript>

	structA = {};
	structB = {};

	// ------------------------------------------------------------------------------- //
	// ------------------------------------------------------------------------------- //

	// AttributeCollection is the ONLY input to the custom tag.
	cfmodule(
		template = "./myTag.cfm",
		attributeCollection = structA,
	);

	// AttributeCollection is ONE OF the inputs to the custom tag.
	cfmodule(
		template = "./myTag.cfm",
		attributeCollection = structB,
		otherAttribute = "[content]"
	);

	// ------------------------------------------------------------------------------- //
	// ------------------------------------------------------------------------------- //

	writeDump( structA );
	writeDump( structB );

</cfscript>

In both cases, we'd expect the writeDump() to result in an empty struct. However, when we run this CFML code, we get the following output:

CFDump of both structs showing that one has been mutated.

As you can see, the two attributes scope mutations in the first invocation have leaked out of the custom tag context and into the struct that was used to provide the custom tag attributes. But, as we can see from the second invocation, this only happens when the attributeCollection is the only mechanics for providing attribute data.

Want to use code from this post? Check out the license.

Reader Comments

Post A Comment — I'd Love To Hear From You!

I believe in love. I believe in compassion. I believe in human rights. I believe that we can afford to give more of these gifts to the world around us because it costs us nothing to be decent and kind and understanding. And, I want you to know that when you land on this site, you are accepted for who you are, no matter how you identify, what truths you live, or whatever kind of goofy shit makes you feel alive! Rock on with your bad self!
— Ben Nadel
Managed ColdFusion hosting services provided by:
xByte Cloud Logo