Screenshots Cannot Show Sanitizers: Measuring and Forecasting Security Regressions in Visual-to-Code Synthesis

When a vision-language model turns a screenshot of a webpage or a mini-app into working front-end code, every property it must reproduce is either visible in the pixels or invisible. Layout, color, and text are visible; input escaping, sandbox flags, credential handling, and dependency hygiene are not. A model asked to rebuild a login page from an image gets no pixel-level evidence about whether the original escaped user input, so it must supply such properties from memory — and its memory is training data scraped from an ecosystem in which copied code is systematically insecure: 97.9% of Android apps that reused Stack Overflow security snippets inherited at least one insecure one (Stack Overflow Considered Harmful? The Impact of Copy&Paste on Android Application Security), and flawed development templates seeded 84,491 credential leaks across 54,728 mini-apps (The Skeleton Keys: A Large Scale Analysis of Credential Leakage in Mini-apps). Meanwhile, the benchmarks that drive progress in visual-to-code synthesis score only what a screenshot can show. No reported result found on Lacuna for any security audit of visual-to-code output, and no existing benchmark in this literature measures whether generated code reproduces known vulnerabilities or silently strips safeguards.

This proposal makes that gap measurable and, in a second step, anticipates its consequences. The core mechanism is visual-to-code synthesis; hallucination taxonomy supplies the diagnostic lens; vulnerability propagation via code reuse supplies the threat model and the audit targets; and multimodal time series forecasting — prediction of numeric sequences conditioned on accompanying text — turns the field's retrospective propagation graphs into a forward-looking instrument. The through-line is a single claim: visual-to-code models have become a new propagation vector for old vulnerabilities, and neither current evaluation metrics nor current propagation trackers can see it.

Core Claim

First, leading visual-to-code models will reproduce known vulnerable code patterns and omit security safeguards at a measurable rate, even while scoring well on every visual fidelity metric in current use, because security properties are absent from the input image and under-represented (in secure form) in the training distribution. Second, these regressions are diagnosable with a security-extended failure taxonomy and catchable by an online process judge adapted from software-agent course correction. Third, the ecosystem consequences of such regressions are forecastable: temporal clone-relation data, paired with security advisory text through lightweight multimodal fusion, can predict which vulnerable patterns will persist and spread into future release cycles, where purely retrospective graph tracking cannot.

Research Program

The first component builds an audited benchmark, which we call SanitizerBench. We start from real front-end code with known, CVE-matched flaws, using the matching methodology pioneered by CVMan: A Framework for Clone-Incurred Vulnerability Management, which mapped 299 CVEs across 310 files in Ubuntu by relating patched functions to their clones. We render the vulnerable pages to screenshots, present them to visual-to-code models, and audit the generated code on two axes: reproduction (does the output contain a vulnerable clone of a known flaw, detected with the few-shot relation-network approach of Vul-Mirror: A Few-Shot Learning Method for Discovering Vulnerable Code Clone, which reaches 95.7% accuracy and F1 0.941 on its 15,774-clone corpus) and omission (does the output drop a safeguard present in the reference that the screenshot could not display). Omission is the harder and more original target, because an omission leaves no code clone to detect — it is an absence, which is exactly the failure shape that current clone detectors are structurally blind to. Credential handling is audited with the semantic-graph matching of KeyMagnet from The Skeleton Keys, since pattern matching fails outright on dynamically used credentials there.

The second component extends the hallucination-taxonomy tradition to security. The precedent is strong in both directions: Benchmarking Multimodal Mathematical Reasoning with Explicit Visual Dependency showed that roughly 62% of multimodal failures are pure perception errors, and When Agents go Astray: Course-Correcting SWE Agents with PRMs showed that a three-family error taxonomy plus a process reward model raised agent resolution from 40.0% to 50.6% on SWE-bench Verified. We define four security-relevant failure categories for visual-to-code output — safeguard omission, vulnerable idiom reproduction, security-degrading simplification (the dark side of the "clean-up effect," where human evaluators preferred AI-generated pages over originals in 64% of cases in Design2Code), and confabulated dependencies — and train an online judge that inspects the generation trajectory and intervenes, SWE-PRM style. This deliberately enters an unresolved tension: verbal intermediate feedback helped agents in When Agents go Astray, but chain-of-thought prompting degraded performance in FractalBench: Diagnosing Visual-Mathematical Reasoning Through Recursive Program Synthesis, where verbalizing spatial logic corrupted numeric coordinates. Our judge operates on code and security semantics rather than coordinates, and we test directly whether that distinction matters.

The third component makes propagation predictive. CVMan's Temporal Clone-Relation Graph over eight Ubuntu versions (870,914 nodes, 5,073,824 edges, with 60% of vulnerable clones persisting across all eight versions) is a retrospective instrument: it records that flaws persisted, but cannot anticipate the next release. We convert per-pattern clone counts into multivariate time series and condition forecasting on the accompanying text stream of security advisories and USN notices, following the causal-anchoring result of Time-MMD: Multi-Domain Multimodal Dataset for Time Series Analysis, where LLM-filtered text cut mean squared error by over 20% on average and multimodal beat unimodal in 95% of more than 1,000 experiments. Given the demonstrated scaling paradox — larger language backbones did not help, and the cross-modality projection is the bottleneck — we use a lightweight TRACE-style retriever and projection (TRACE: Grounding Time Series in Context for Multimodal Embedding and Retrieval, which activates only 0.12M parameters and cut forecasting error by 4.55%) rather than a heavy generative foundation model. Formally, for each vulnerable pattern $p$ and release index $t$, we forecast $v_{p,t+1} = f(v_{p,\le t},\, c_{\le t})$, where $v_{p,t}$ is the number of surviving clone instances of pattern $p$ at release $t$ and $c_{\le t}$ is the encoded advisory text up to $t$; the unimodal baseline sets $c$ to nothing.

Baselines

The naive reference point is the status quo: trust the visual metrics that current benchmarks report. On Design2Code, GPT-4o achieves a 93.0 Block-Match score on the standard set (56.6 on the hard subset), and on ChartMimic it reaches 81.2 on Direct Mimic with a 93.2% execution success rate — numbers that say nothing about security. Beating this baseline is not a race but a dissociation: we must show that outputs scoring near the top of these metrics still reproduce vulnerabilities or omit safeguards at a substantial rate. If high-fidelity outputs were systematically secure, the proposal's premise would fail.

The strongest competitor for the audit task is Vul-Mirror (Vul-Mirror), which reports 95.7% accuracy and an F1 of 0.941 on vulnerable-clone detection, far above VUDDY's 0.754, VulPecker's 0.182, and VulDeePecker's 0.093, supplemented by KeyMagnet at 95.04% precision and 85.56% recall for credential leaks. We will run both on our generated-code corpus with their published configurations and the same tuning budget given to our audit pipeline. Beating them means higher recall of security regressions in generated code at matched precision — in particular on safeguard omissions and Type-3-style refactorings, where clone detectors have documented blind spots. This baseline is a genuine threat on the reproduction axis, and we expect it to remain strong there; our contribution should be judged mostly on the omission and attribution axes.

For the forecasting task, the baselines are the unimodal numerical models from the MM-TSFlib suite (PatchTST, DLinear, iTransformer) run on the same clone-count series, releases, and rolling-origin splits, with identical compute and hyperparameter search. The reference scale for what multimodal conditioning buys comes from Time-MMD, which reports over 20% average MSE reduction from text, and from Aurora: Towards Universal Generative Multimodal Time Series Forecasting, which reports a 27.0% zero-shot MSE reduction over Sundial on TimeMMD. Beating the unimodal baselines means a statistically significant MSE reduction on held-out future Ubuntu versions; matching Time-MMD's 20% margin would be a strong result, not a requirement.

Two ablations isolate the proposal's key ingredients. First, the process judge runs either with the screenshot alongside the code or with code alone; if the visual input adds nothing to security judging, the "security-invisible" framing is wrong and the gap is purely a code-distribution problem. Second, the forecaster runs with and without the advisory text channel; the difference directly measures whether security text carries forecasting signal for code telemetry, the untested converse of Time-MMD's finding for weather and health text.

Why not just…?

Why not just run existing static analyzers and linters on the generated code? This is the most serious alternative and we treat it as a baseline rather than an objection. The propagation literature itself documents why it falls short: deterministic tools collapsed on renamed and modified clones (VulPecker F1 0.182, VulDeePecker 0.093 in Vul-Mirror), and pure pattern matching failed on dynamically used credentials until KeyMagnet introduced semantic graph matching (The Skeleton Keys). More fundamentally, static analysis cannot detect an omission — a missing sanitizer leaves no artifact to analyze — and cannot attribute failures to perceptual causes or connect them to propagation trajectories. If static analyzers match our audit recall on the reproduction axis, we will report that plainly; the omission axis and the taxonomy are where the proposal must earn its keep.

Why not just fine-tune the generator on secure code? Possibly the right long-term fix, but it presupposes the measurement this proposal provides, and the transfer evidence is discouraging: math-tuned models trained on symbolic text scored only 25%–29% on visual-dependent reasoning in VCBench, showing that text-only training does not transfer to perceptual grounding. Secure-code fine-tuning under screenshot conditioning may hit the same wall. We include a fine-tuning probe as a decisive check: if a security-fine-tuned model eliminates regressions on SanitizerBench, the benchmark has done its job even if the taxonomy and forecasting components stand alone.

Why not just extract text and layout with OCR and use a text-to-code LLM? Design2Code already tried text-augmented prompting; it helped transcription but spatial synthesis still fell to 56.6 Block-Match on hard cases. More to the point, security properties are absent from the extracted text just as they are absent from the pixels, so the security-invisible gap is unchanged by this route, and FractalBench shows that verbal intermediaries can actively degrade visual-to-program mapping.

Why not just use unimodal time series models for the propagation forecast? Time-MMD's evidence says text helps when it is causally relevant to the numeric shifts, and security advisories are the paradigm case of causally relevant text — but this is exactly what must be tested rather than assumed, since Time-MMD also shows text without causal link pollutes forecasts. The unimodal baselines are run head-to-head under identical conditions; if advisory text adds nothing for code telemetry, that is a publishable negative result and the third component collapses to a measurement contribution.

Decisive Checks

Three results decide the proposal. First, on SanitizerBench, a dissociation between visual fidelity and security: a non-trivial vulnerability reproduction rate and safeguard omission rate among outputs whose Block-Match and execution metrics would pass current benchmarks, with per-model and per-category breakdowns under the taxonomy. Second, an online judge that catches a substantial fraction of security regressions that final-outcome evaluation misses, with the screenshot-conditioned versus code-only ablation settling whether visual context helps security auditing and, indirectly, whether the FractalBench chain-of-thought degradation extends to security semantics. Third, a rolling-origin forecast on the CVMan Ubuntu corpus in which advisory-text conditioning significantly reduces MSE versus PatchTST, DLinear, and iTransformer on held-out release versions, and a closing loop in which the forecast plus taxonomy feed a generation-time guardrail that measurably lowers the reproduction rate. We note as a limitation that we rely on the file's reported figures throughout — including the unexplained discrepancy between ChartMimic's GPT-4o score of 81.2 and JanusCoder's report of 60.9 for the same benchmark (JanusCoder: Towards a Foundational Visual-Programmatic Interface for Code Intelligence) — which itself argues for standardized, security-aware evaluation protocols for visual-to-code synthesis.