CVE-2026-128082: AutoMapper: Uncontrolled Recursion with Constructor Parameters
AutoMapper before 15.1.4, and 16.x before 16.3.0, do not enforce MaxDepth when recursion goes through constructor parameters, such as positional records. A deeply nested input overflows the stack and terminates the process. This bypasses the CVE-2026-32933 mitigation. Upgrade to 15.1.4 or 16.3.0.
Published Nov 13, 2026 · Analysis Nov 16, 2026
What an attacker can do
AutoMapper counted type depth only after the destination object was created. Constructor parameters, including child objects of the same type, are mapped during creation. Each level therefore recursed before its parent was counted, and the depth check never tripped. It affects an explicit MaxDepth(n), the default limit of 64, and ConstructUsing that maps recursively through context.Mapper.
The reporter's test set MaxDepth(10) and still mapped a 100-level chain to all 100 levels. On a 1 MB stack, the Windows default, the process crashed between 1,000 and 2,000 levels. A StackOverflowException cannot be caught, so the process dies.
An attacker needs to feed deeply nested data into an application that maps it to a constructor-built destination with a recursive member. Setting MaxDepth as advised for CVE-2026-32933 does not protect these mappings. The impact is availability: one request can crash a service.
Who is affected
Affected: AutoMapper on NuGet below 15.1.4, and 16.0.0 up to but not including 16.3.0, for destination types built through constructor parameters, including positional records, that have a self-referencing member.
Check the version:
dotnet list package --include-transitive | grep AutoMapperReview maps whose destination is a record or a class with a constructor taking its own type.
AutoMapper
- Ecosystem
- NuGet
- Affected
- >= 16.0.0, < 16.3.0
- Fixed in
- 16.3.0
- Check
dotnet list package --include-transitive
AutoMapper
- Ecosystem
- NuGet
- Affected
- < 15.1.4
- Fixed in
- 15.1.4
- Check
dotnet list package --include-transitive
How to fix it
Upgrade to AutoMapper 15.1.4 or 16.3.0:
dotnet add package AutoMapper --version 15.1.4The depth is now counted before the destination is created, so constructor mapping stops at the same depth as property mapping.
Workaround: if the destination has a parameterless constructor and settable properties, cfg.DisableConstructorMapping() makes AutoMapper map through properties, where MaxDepth is enforced. Positional records have no workaround other than limiting input depth before mapping, or upgrading.
How to tell if you were hit
The sign is a .NET process exit from a stack overflow, with a long repeating AutoMapper frame sequence in the crash output, and a service restart right after a request that carried deeply nested data. Check request logs near each crash for large nested bodies.
You can also test your own mappers: build a chain of a few thousand nested objects of the destination type and map it in a test run.
Original advisory
From the GitHub Advisory Database (CC BY 4.0).
Summary
MaxDepth, whether set explicitly or applied by default (64) to self-referential type maps, was not enforced when the recursion goes through constructor parameters. Mapping a deeply nested source to a destination built through its constructor, such as a positional record, recurses without bound and throws a StackOverflowException. That exception can't be caught and terminates the process. This bypasses the mitigation for CVE-2026-32933.
Details
The type depth used by MaxDepth was incremented only after the destination object was created. Constructor parameters, including child objects of the same type, are mapped while the destination is created, so each level recursed before its parent was counted, and the depth check never tripped.
Affected:
- destination types mapped through constructor parameters, including positional records
- both an explicit
MaxDepth(n)and the default limit of 64 ConstructUsingthat maps recursively throughcontext.Mapper
With MaxDepth(10), a 100-level chain was mapped to all 100 levels. On a 1 MB stack (the Windows default), the process crashed at between 1,000 and 2,000 levels.
PoC
The type only has a constructor with positional arguments, and MaxDepth is set to 10:
using AutoMapper;
// Setup configuration - with MaxDepth set
var mapper = new MapperConfiguration(cfg =>
{
cfg.CreateMap<CircularClass, CircularClass>().MaxDepth(10);
})
.CreateMapper();
// Create a deeply nested object (28,000+ levels)
var root = new CircularClass(null);
var current = root;
for (int i = 0; i < 30000; i++)
{
current.Next = new CircularClass(null);
current = current.Next;
}
// STACK OVERFLOW even though the max depth is set
var mappedRoot = mapper.Map<CircularClass>(root);
public class CircularClass
{
public CircularClass(CircularClass? Next)
{
this.Next = Next;
}
public CircularClass? Next { get; set; }
}Impact
Any application that maps attacker-influenced, deeply nested data to a destination type built through a constructor, with a recursive member, can be crashed. Setting MaxDepth as recommended for CVE-2026-32933 doesn't protect these mappings.
Patches
Fixed in 16.3.0 and 15.1.4. The depth is now counted before the destination is created, so constructor mapping stops at the same depth as property mapping.
Workarounds
If the destination type has a parameterless constructor and settable properties, cfg.DisableConstructorMapping() makes AutoMapper map through the properties, where MaxDepth is enforced. Positional records have no workaround other than limiting input depth before mapping, or upgrading.
Credits
Reported by @mcambria, who found it while writing a test to confirm their MaxDepth mitigation for CVE-2026-32933.
Related
- CVE-2026-32933 (GHSA-rvv3-g6hj-g44x)
- GHSA-gpwp-5797-mjff: other paths that bypassed
MaxDepth(polymorphic maps, runtime-typed members, dictionary and dynamic sources, recursive type converters), fixed in the same releases.
Credited to mcambria.
Questions
- Does setting MaxDepth protect me?
Not for constructor-mapped destinations before the fix. Each level recursed before it was counted, so a MaxDepth(10) map still mapped 100 levels in the reporter's test.
- Which destination types are affected?
Types built through constructor parameters, including positional records, and ConstructUsing that maps recursively through context.Mapper.
- Is there a workaround that avoids upgrading?
For classes with a parameterless constructor and settable properties, use cfg.DisableConstructorMapping(). Positional records need an input depth limit or the upgrade.
- Is it exploited in the wild?
The advisory does not say so, and the entry has no CISA KEV data. Its EPSS score is 0.0066.
References
Read for this analysis:
- https://github.com/LuckyPennySoftware/AutoMapper/security/advisories/GHSA-6vhm-j9h7-f9gh
- https://github.com/LuckyPennySoftware/AutoMapper/releases/tag/v15.1.4
- https://github.com/LuckyPennySoftware/AutoMapper/commit/4d51a4b8125b4d2302f2f1f455747c9648ad1acb
- https://github.com/LuckyPennySoftware/AutoMapper/commit/639c2748cb9d3d07df8b86879ba7bcf211675c86
- https://github.com/LuckyPennySoftware/AutoMapper/releases/tag/v16.3.0
- https://github.com/advisories/GHSA-6vhm-j9h7-f9gh
How this page is made: the data panel comes from the GitHub Advisory Database, CISA’s KEV catalog, the NVD and FIRST EPSS, and updates twice a day. The analysis is written by an AI model from the sources listed above and checked by automated rules before it is published. Check versions against the vendor's advisory before you act. Methodology
