Hi Antonio, Thanks for putting this on the list before preparing a PR. Answers to your three questions below.
1. Regression tests The direction is welcome, with three conditions on scope. First, a correction to the premise: the changes behind the recent bulletins did land together with tests. They are named after the behaviour they pin rather than after a bulletin number, so they are not easy to find by searching for "S2-". The gap you describe is real mainly for the older OGNL bulletins (S2-045, S2-057, S2-059, S2-061 and similar). The conditions: - Only bulletins that are already published, and only payloads that are already public. - Name the tests by behaviour, which is the convention in the suite today. A test pins what the framework does; a bulletin is a document with a different purpose, so the tests should not point at one. - Each test has to pin one specific control. On 7.x a historic payload is refused by several layers at once: the allowlist, the excluded classes and packages, and the node guard. A test that only asserts "refused on the default configuration" stays green when one of those layers regresses, so it does not give the guarantee you are after. Please isolate the layer under test, for example by relaxing the others in the test configuration, and assert on the reason for the refusal, not just on the outcome. Please start with a small first PR, two or three bulletins, so we can agree on the shape before you write the rest. 2. Sibling packages Please check the list against core/src/main/resources/struts-excluded-classes.xml on main. Entries in struts.excludedPackageNames cover their sub-packages as well, and the default value already contains: - sun.misc - javax, which covers javax.script That leaves java.lang.ref and jdk.internal. For each of them I would like to see a concrete path before adding it: which object reachable from the value stack on a default configuration hands out an instance from that package, and what an expression can do with it that the current configuration allows. Precedence in other frameworks is not enough on its own, every entry in that list is something we have to maintain and explain to users. If you have such a path, describe the mechanics in the ticket and add the test next to the existing ones in StrutsExcludedClassesTest. Please keep this separate from the regression tests: two tickets, two PRs. A change to the defaults and a test-only change are reviewed differently, and one should not wait for the other. 3. Ongoing work in this area WW-5326 (upgrade to OGNL 3.5, draft PR #1654) touches the same area and is targeted at 8.0.0. It does not make either proposal premature. Tests written against the public entry points (ValueStack, ParametersInterceptor, the tags) should survive it; tests that reach into OGNL internals will not, so please stay on the public entry points. Next step: open a Jira ticket for the regression tests (type Improvement, component "Core") and send the first PR against main with the title "WW-XXXX <description>". Regards Łukasz On Thu, Dec 03, 2026 07:28 PM, Antonio Cuervo <[email protected]> wrote: > Hi all, > > I have been reviewing the OGNL guard area in main — the refactor from > WW-5880/5881, SecurityMemberAccess, the StrutsNodeGuard default, and the > test suite under core/src/test/java/org/apache/struts2/ognl/ — against the > public record of OGNL bypass research (the S2 bulletins and the 2023 GitHub > Security Lab write-up on OGNL sandboxes). > > Two observations came out of this. I would like to put both on the list > before preparing any PR, so the team can tell me which direction (if any) > is welcome and how to scope it. > > --- > > Observation 1 — regression tests against public CVE payloads > > The current test suite validates guard mechanics (node-type exclusion, bean > selection, DI wiring, member access rules) thoroughly, but does not include > executable regression tests built from the payloads behind the published S2 > bulletins or the public research. For example, there is no test that pins > "payload X from S2-061 is refused on a default configuration" — the > guarantee lives in the code and in reviewers' memory, not in the suite. > > Proposal: add a new regression test class under > core/src/test/java/org/apache/struts2/ognl/ that iterates one test per > documented public payload, feeding it through the appropriate entry point > (ValueStack.findValue, ParametersInterceptor, tag attributes), and > asserting that the current default configuration refuses the evaluation. If > any payload is found not to be refused today, I would stop and report it > privately per SECURITY.md before proposing a fix. > > Benefit: a future refactor that unintentionally reopens a known vector > fails a test rather than fails a bulletin. All referenced payloads come > from public advisories or published research — this is proposed as > hardening, not disclosure. > > --- > > Observation 2 — sibling packages worth excluding, following WW-5838 > > WW-5838 recently added java.beans, java.lang.reflect, and java.lang.invoke > to the excluded packages in SecurityMemberAccess. That choice is well > motivated — each of those packages gives a path to class-loader or > method-handle primitives that break the allowlist assumption. > > Several siblings follow the same reasoning and are not excluded in main > today. The candidates I have in mind, with the rationale: > > - java.lang.ref — WeakReference / SoftReference reachability primitives > that have been used as covert channels in restricted VMs. > - jdk.internal.* — internal JDK APIs that applications must not reach > through OGNL under any configuration. Precedent: Spring, Dropwizard, > Jackson all block these explicitly. > - sun.misc.* — sun.misc.Unsafe is the canonical visibility bypass; reaching > it through OGNL defeats the member-access model entirely. > - javax.script — reaching a ScriptEngine (Nashorn, Rhino, GraalJS) from > OGNL is an RCE primitive and has been reported as such in Jackson and > Spring expression languages. > > Proposal: a PR titled "WW-XXXX Extend WW-5838 to sibling packages with the > same escape primitives", adding these to the default excludedPackageNames, > together with a test per package showing the same shape of assertion the > WW-5838 commit used. > > If the team prefers a narrower subset — for example excluding only > jdk.internal and sun.misc because they are the strictest "never reachable" > cases — I will scope the PR accordingly. > > --- > > How the two observations connect > > If Observation 2 is accepted and the sibling packages are excluded, the > regression tests from Observation 1 become the verification that the > exclusion actually refuses the payloads it is meant to refuse. The two land > as one coherent change — the exclusion plus the proof — rather than as two > unrelated PRs. > > If only Observation 1 is accepted, the regression layer stands on its own: > it pins current behaviour, independent of any blocklist change. > > If only Observation 2 is accepted, I will add the targeted tests for that > change without the broader regression layer. > > --- > > Before I open a Jira ticket or prepare a PR, I would like to confirm: > > 1. Is the regression-test direction (Observation 1) welcome, and if so, is > the preferred naming by S2-bulletin number or by behaviour description? > 2. Of the sibling packages listed under Observation 2, which ones the team > considers in-scope for a WW-5838-style exclusion? > 3. Is there a current internal refactor of this area that would make either > proposal premature? > > I have read SECURITY.md, THREAT_MODEL.md, CLAUDE.md and AGENTS.md before > writing this. Both proposals are framed as hardening per the control test > in SECURITY.md — no undisclosed vulnerability is involved; every payload > and every package referenced is from a public advisory, a published > research artifact, or an established industry precedent. If during > implementation anything looks like it crosses into a real bypass of a > current control, I will stop and follow the private process. > > Thanks for the time, > > Antonio Cuervo >
