Recent Posts
Archives

PostHeaderIcon A Tricky Java Question

Here’s a super tricky Java interview question that messes with developer intuition:

❓ Weird Question:

“What will be printed when executing the following code?”

import java.util.*;
public class TrickyJava {
 public static void main(String[] args) {
 List list = Arrays.asList("T-Rex", "Velociraptor", "Dilophosaurus");
 list.replaceAll(s -> s.toUpperCase());
 System.out.println(list);
 }
 }

The Trap:

At first glance, everything looks normal:

Arrays.asList(...) creates a List.
replaceAll(...) is a method in List that modifies elements using a function.
Strings are converted to uppercase.
Most developers will expect this output:

[T-REX, VELOCIRAPTOR, DILOPHOSAURUS]

But surprise! This code sometimes throws an UnsupportedOperationException.

 

✅ Correct Answer:

The output depends on the JVM implementation!

It might work and print:

[T-REX, VELOCIRAPTOR, DILOPHOSAURUS]

Or it might crash with:

Exception in thread "main" java.lang.UnsupportedOperationException
at java.util.AbstractList$Itr.remove(AbstractList.java:572)
at java.util.AbstractList.remove(AbstractList.java:212)
at java.util.AbstractList$ListItr.remove(AbstractList.java:582)
at java.util.List.replaceAll(List.java:500)

Why?

Arrays.asList(...) does not return a regular ArrayList, but rather a fixed-size list backed by an array.
The replaceAll(...) method attempts to modify the list in-place, which is not allowed for a fixed-size list.
Some JVM implementations optimize this internally, making it work, but it is not guaranteed to succeed.

Key Takeaways

Arrays.asList(...) returns a fixed-size list, not a modifiable ArrayList.
Modifying it directly (e.g., add(), remove(), replaceAll()) can fail with UnsupportedOperationException.
Behavior depends on the JVM implementation and internal optimizations.

How to Fix It?

To ensure safe modification, wrap the list in a mutable ArrayList:

List list = new ArrayList<>(Arrays.asList("T-Rex", "Velociraptor", "Dilophosaurus"));
list.replaceAll(s -> s.toUpperCase());
System.out.println(list); // ✅ Always works!

PostHeaderIcon [NDCOslo2024] Decades in the Machine: Meaning and Purpose in Technology – David Whitney

As circuits chronicle careers spanning scores, David Whitney, Director of Architecture at New Day and a prolific purveyor of programming tomes, confronts the crossroads of craft and chronology. A confessed creator of code and children’s chronicles, David delves into the dialectic of drudgery and delight, navigating the nebulous nexus of necessity and narrative in tech’s turbulent tapestry. His homily, heartfelt and humorous, harvests hard-won harmonies for enduring in an ephemeral enterprise.

David divulges dread: a talk trepidation-tinged, yet tendered to temper existential echoes. He heralds the hustle’s hollowness—monetary machinations versus meaningful makings—imploring identities intact amid instability. From fledgling forays to seasoned sojourns, David’s dispatch distills decades: delight in doing, despite detours.

Identity in the Interface: Crafting Careers Amid Chaos

Tech’s tumult tests tenacity: layoffs loom, languages lapse, yet purpose persists. David decries the drift—coding’s call versus climbing’s cachet—urging anchors in avocations: open-source odysseys, personal projects that pulse with passion.

He honors the hustle’s hybrid: salaried sustenance sustains side quests, where whimsy weaves worth. David’s dictum: diversify delights—write, teach, tinker—to transmute tenure into tapestry, resilient against redundancies.

Harmony in the Hustle: Balancing Billable with Beloved

The eternal equipoise: paid pursuits versus private passions. David dissects dilemmas—overtime’s overreach, burnout’s brink—beseeching boundaries: billable by day, beloved by dusk. His heuristic: harvest joy in journeyman jobs, channeling competence to causes cherished.

Mentorship mirrors meaning: guiding greenhorns gleans gratification, reciprocity in retrospectives. David’s dawn: embrace evolution—roles recede, relevance renews through relentless reinvention.

Optimism’s Odyssey: Growing Through the Grind

David’s denouement: optimism as ordinance. Persevere with patience—code’s camaraderie conquers crises, colleagues’ kindness kindles kinship. His litany: listen to users, laugh in logs, love the labor—error messages as endearments, PRs as partnerships.

His poem’s plea: prioritize presence—headphones in hives, grace for novices, green tickets for givers. In machines’ maw, meaning manifests in making—mindful, magnanimous, merry.

Links:

PostHeaderIcon [DefCon32] Troll Trapping Through TAS Tools – Exposing Speedrunning Cheaters

Allan Cecil, known as dwangoAC, a prominent figure in the speedrunning community and founder of TASBot, tackles the pervasive issue of cheating in video game speedrunning. By leveraging tool-assisted speedruns (TAS), Allan exposes fraudulent records, including a long-standing Diablo speedrun in the Guinness Book of World Records. His presentation, enriched with technical insights and community-driven investigations, champions transparency and integrity in competitive gaming.

The Challenge of Speedrunning Cheating

Allan introduces the concept of tool-assisted speedruns, where emulators enable frame-by-frame precision to achieve theoretically perfect gameplay. Cheaters misuse these tools to pass off TAS runs as human efforts, undermining leaderboards. Allan’s mission, sparked by his work with TASVideos.org, is to detect such deceptions, as seen in high-profile cases like Todd Rogers’ Dragster and Maciej Maselewski’s Diablo run.

Investigating the Diablo Record

Focusing on Maselewski’s 3-minute, 12-second Diablo record, Allan and his team, including Matthew Petroff, used TASBot to recreate the run. Their analysis revealed inconsistencies in software versions, missing frames, and item anomalies, suggesting tampering. By crafting a legitimate TAS run just one second faster, Allan demonstrated that human records could surpass the fraudulent time, restoring fairness to the Diablo community.

Tool-Assisted Detection Techniques

Allan details the technical prowess behind TAS, using emulators to record precise inputs and verify gameplay on real hardware. His TASBot, a robot mimicking controller inputs, has raised over $1.5 million for charity at events like Games Done Quick. By analyzing frame data and game mechanics, Allan identifies subtle signs of splicing or unauthorized modifications, empowering moderators to uphold leaderboard integrity.

Fostering Community Integrity

Concluding, Allan advocates for clear delineation between TAS and human speedruns to prevent misuse. His open-source approach, including a detailed document at diablo.tas.bot, invites community scrutiny and collaboration. By debunking fraudulent records, Allan not only protects speedrunning’s legitimacy but also inspires researchers to apply similar rigor to cybersecurity investigations, drawing parallels between game integrity and system security.

Links:

PostHeaderIcon [GoogleIO2024] What’s New in Android Development Tools: Enhancing Productivity and Quality

Jamal Eason, Tor Norbye, and Ryan McMorrow present updates in Android Studio and Firebase, focusing on AI integration, performance improvements, and debugging enhancements to streamline app creation.

Roadmap and AI-Driven Enhancements

Android Studio’s evolution includes Hedgehog’s vital insights, Iguana’s baseline support, and Jellyfish’s stable release. Koala preview introduces Gemini-powered features, expanding to over 200 regions with privacy controls.

Quality focus addressed 900+ bugs, improving memory and performance by 33%. Gemini aids code generation, explanations, and refactoring, fostering efficient workflows.

Advanced Editing and Integration Tools

Koala’s IntelliJ foundation offers sticky lines for context, improved code navigation, and enhanced Compose previews with device switching. Firebase integrations include Genkit for AI workflows and Crashlytics for issue resolution.

App quality insights aggregate crashes, aiding prioritization. Android device streaming enables real-device testing via Firebase.

Debugging and Release Process Innovations

Crashlytics’ diff feature pinpoints crash origins in version history. Device streaming reproduces issues on reserved hardware, ensuring wipes for security.

Release shifts to platform-first with feature drops, doubling stable updates for better stability and predictability.

Links:

PostHeaderIcon [DefCon32] Unlocking the Gates – Hacking a Secure Industrial Remote Access Solution

Moritz Abrell, a senior IT security consultant at Syss, exposes vulnerabilities in a widely deployed industrial VPN gateway critical to operational technology. By rooting the device, bypassing hardware security modules, and reverse-engineering firmware, Moritz demonstrates how attackers could hijack remote access sessions, threatening critical infrastructure worldwide. His findings underscore the fragility of industrial remote access solutions and the need for robust security practices.

Dissecting Industrial VPN Gateways

Moritz begins by outlining the role of VPN gateways in enabling secure remote access to industrial networks. These devices, often cloud-managed by vendors, connect service technicians to critical systems via VPN servers. However, their architecture presents a lucrative attack surface. Moritz’s analysis reveals how vulnerabilities in device firmware and authentication mechanisms allow attackers to gain root access, compromising entire networks.

Exploiting Firmware and Certificates

Through meticulous reverse engineering, Moritz uncovered methods to decrypt passwords and extract firmware-specific encryption keys. By forging valid VPN certificates, attackers could impersonate legitimate devices, redirecting user connections to malicious infrastructure. This scalability—potentially affecting over 500,000 devices—highlights the catastrophic potential of such exploits in energy plants, oil platforms, and other critical facilities.

Real-World Impact and Mitigation

Moritz’s attacks enabled eavesdropping on sensitive data, such as PLC programs, and disrupting legitimate connections. After responsibly disclosing these vulnerabilities, Syss prompted the vendor to patch the backend and release updated firmware. Moritz advises organizations to scrutinize cloud-based remote access solutions, verify third-party infrastructure, and implement strong authentication to mitigate similar risks.

Links:

PostHeaderIcon [DotAI2024] DotAI 2024: Armand Joulin – Elevating Compact Open Language Models to Frontier Efficacy

Armand Joulin, Research Director at Google DeepMind overseeing Gemma’s open iterations, chronicled the alchemy of accessible intelligence at DotAI 2024. Transitioning from Meta’s EMEA stewardship—nurturing LLaMA, DINO, and FastText—Joulin now democratizes Gemini’s essence, crafting lightweight sentinels that rival titans thrice their heft. Gemma 2’s odyssey, spanning 2B to 27B parameters, exemplifies architectural finesse and pedagogical pivots, empowering myriad minds with potent, pliable cognition.

Reforging Architectures for Scalable Savvy

Joulin queried Google’s open gambit: why divulge amid proprietary prowess? The rejoinder: ubiquity. Developers dwell in open realms; arming them fosters diversity, curbing monopolies while seeding innovations that loop back—derivatives surpassing progenitors via communal cunning.

Gemma 2’s scaffold tweaks transformers: rotary embeddings for positional poise, attention refinements curbing quadratic quagmires. Joulin spotlighted the 2B and 9B variants, schooled not in next-token clairvoyance but auxiliary pursuits—masked modeling, causal contrasts—honing discernment over divination.

These evolutions yield compacts that converse competently: multilingual fluency, coding camaraderie, safety sans shackles. Joulin lauded derivatives: Hugging Face teems with Gemma-spun specialists, from role-play virtuosos to knowledge navigators, underscoring open’s osmotic gains.

Nurturing Ecosystems Through Pervasive Accessibility

Deployment’s democracy demands pervasiveness: Gemma graces Hugging Face, NVIDIA’s bastions, even AWS’s arches—agnostic to allegiance. Joulin tallied 20 million downloads in half a year, birthing a constellation of adaptations that eclipse originals in niches, a testament to collaborative cresting.

Use cases burgeon: multilingual muses for global dialogues, role enactors for immersive interfaces, knowledge curators for scholarly scaffolds. Joulin envisioned this as empowerment’s engine—students scripting savants, enthusiasts engineering epiphanies—where AI pockets transcend privilege.

In closing, Joulin affirmed open’s mandate: not largesse, but leverage—furnishing foundations for futures forged collectively, where size yields to sagacity.

Links:

PostHeaderIcon [OxidizeConf2024] A Journey to Fullstack Mobile Game Development in Rust

From C# to Rust: A Transformative Journey

The mobile gaming industry, long dominated by Unity and C#, is witnessing a shift toward open-source technologies that promise enhanced performance and developer experience. Stefan Dilly, founder of RustUnit, shared his five-year journey of adopting Rust for mobile game development at OxidizeConf2024. Stefan, a seasoned developer and maintainer of the open-source GitUI, traced his progression from integrating Rust libraries in a Go backend and C# frontend to building fullstack Rust mobile games, culminating in the launch of Zoolitaire, a testament to Rust’s growing viability in gaming.

Initially, Stefan’s team at GameRiser in 2019 used Rust for AI calculations within a Go backend, interfacing with a Unity-based C# frontend via a cumbersome C FFI and JSON serialization. This approach, while functional, was verbose and slow, hampered by Go’s garbage collector and Unity’s long iteration times. The challenges prompted a pivot to a Rust-based backend in late 2019, leveraging the stabilization of async/await. Despite early hurdles, such as a buggy MongoDB driver, this transition yielded a more robust server for games like Wheelie Royale, a multiplayer motorcycle racing game.

Advancing Frontend Integration

The next phase of Stefan’s journey focused on improving frontend integration. By replacing JSON with Protocol Buffers (protobuf), his team streamlined communication between Rust and Unity, reducing memory overhead and improving performance. This allowed shared code between backend and frontend, enhancing maintainability. However, Unity’s limitations, such as slow reload times, spurred Stefan to explore fullstack Rust solutions. The advent of the Bevy game engine, known for its Entity Component System (ECS) and WebGPU rendering, marked a turning point, enabling native Rust game development without Unity’s constraints.

Stefan showcased Zoolitaire, a mobile game built entirely in Rust using Bevy, featuring deterministic game logic shared between client and server. This ensures fairness by validating gameplay on the server, a critical feature for competitive games. The open-source Bevy plugins developed by RustUnit, supporting iOS-specific features like in-app purchases and notifications, further demonstrate Rust’s potential to deliver a complete gaming ecosystem. These plugins, available on GitHub, empower developers to create feature-rich mobile games with minimal dependencies.

The Future of Rust in Gaming

Looking ahead, Stefan envisions Rust playing a significant role in game development, particularly as companies seek alternatives to Unity’s licensing model. The Bevy engine’s rapid growth and community support make it a strong contender, though challenges remain, such as limited console support and the learning curve for Rust’s borrow checker. Stefan’s experience onboarding junior developers suggests that Rust’s reputation for complexity is overstated, as its safety features and clear error messages facilitate learning, especially for those without preconceived coding habits.

The launch of a new racing game at OxidizeConf2024, playable via a browser, underscores Rust’s readiness for mobile gaming. Stefan’s call to action—inviting attendees to beat his high score—reflects the community-driven spirit of Rust development. By open-sourcing critical components and fostering collaboration through platforms like Discord, Stefan is paving the way for Rust to challenge established game engines, offering developers a performant, safe, and open-source alternative.

Links:

PostHeaderIcon [DefCon32] What History’s Greatest Heist Can Teach Us About Defense In Depth

Pete Stegemeyer, a seasoned security engineer and heist historian, draws parallels between the 2003 Antwerp Diamond Heist and cybersecurity’s defense-in-depth principles. By dissecting how thieves bypassed multiple security layers to steal millions in diamonds, gold, and cash, Pete illustrates the consequences of complacency and inadequate security practices. His narrative offers actionable lessons for fortifying digital defenses, blending historical intrigue with modern security insights.

Anatomy of the Antwerp Heist

Pete begins by recounting the audacious 2003 heist, where thieves used simple tools like hairspray and double-sided tape to defeat sophisticated vault security. The heist succeeded due to failures in physical security, such as outdated cameras and unmonitored access points. By mapping these lapses to cybersecurity, Pete underscores how neglected vulnerabilities—akin to unpatched software or weak access controls—can lead to catastrophic breaches.

Failures in Security Design

Delving deeper, Pete highlights how the vault’s reliance on single points of failure, like unsegmented keys, mirrored common cybersecurity oversights. The thieves exploited predictable patterns and lax enforcement, much like attackers exploit misconfigured systems or social engineering. Pete stresses that defense in depth requires layered protections, regular updates, and proactive monitoring to prevent such exploitation in digital environments.

Lessons for Cybersecurity

Drawing from the heist, Pete advocates for robust accountability mechanisms to combat complacency. Just as the vault’s operators failed to enforce key-splitting protocols, organizations often neglect security best practices. He recommends rigorous auditing, mandatory updates, and consequence-driven policies to ensure diligence. By treating data as valuable as diamonds, organizations can build resilient defenses against sophisticated threats.

Links:

  • None

PostHeaderIcon [DefCon32] AMD Sinkclose – Universal Ring2 Privilege Escalation

In the intricate landscape of system security, Enrique Nissim and Krzysztof Okupski, researchers from IOActive, uncover a critical vulnerability in AMD processors, dubbed Sinkclose. Their presentation delves into the shadowy realm of System Management Mode (SMM), a powerful x86 execution mode that operates invisibly to operating systems and hypervisors. By exposing a silicon-level flaw undetected for nearly two decades, Enrique and Krzysztof reveal a universal ring -2 privilege escalation exploit, challenging the robustness of modern CPU security mechanisms.

Understanding System Management Mode

Enrique opens by elucidating SMM, a privileged mode that initializes hardware during boot and resides in a protected memory region called SMRAM. Invisible to antivirus, endpoint detection and response (EDR) systems, and anti-cheat engines, SMM’s isolation makes it a prime target for attackers seeking to deploy bootkits or firmware implants. The researchers explain how AMD’s security mechanisms, designed to safeguard SMM, falter due to a fundamental design flaw, enabling unauthorized access to this critical layer.

Exploiting the Sinkclose Vulnerability

Krzysztof details the methodology behind exploiting Sinkclose, a flaw in a critical SMM component. By reverse-engineering AMD’s processor architecture, they crafted an exploit that achieves arbitrary code execution in ring -2, bypassing even hypervisor-level protections. Their approach leverages precise engineering to manipulate SMRAM, demonstrating how attackers could install persistent malware undetectable by conventional defenses. The vulnerability’s longevity underscores the challenges in securing silicon-level components.

Implications for Critical Systems

The impact of Sinkclose extends to devices like the PlayStation 5, though its hypervisor mitigates some risks by trapping specific register accesses. Enrique emphasizes that the exploit’s ability to evade kernel and hypervisor defenses poses significant threats to critical infrastructure, gaming platforms, and enterprise systems. Their findings, promptly reported to AMD, prompted microcode updates, though the researchers note the complexity of fully mitigating such deep-seated flaws.

Future Directions for CPU Security

Concluding, Krzysztof advocates for enhanced firmware validation and real-time monitoring of SMM interactions. Their work highlights the need for vendors to prioritize silicon-level security and for researchers to probe low-level components for hidden weaknesses. By sharing their exploit methodology, Enrique and Krzysztof empower the community to strengthen defenses against similar vulnerabilities, ensuring robust protection for modern computing environments.

Links:

PostHeaderIcon [DefCon32] Breaching AWS Through Shadow Resources

The complexity of cloud environments conceals subtle vulnerabilities, and Yakir Kadkoda, Michael Katchinskiy, and Ofek Itach from Aqua Security reveal how shadow resources in Amazon Web Services (AWS) can be exploited. Their research uncovers six critical vulnerabilities, ranging from remote code execution to information disclosure, enabling potential account takeovers. By mapping internal APIs and releasing an open-source tool, Yakir, Michael, and Ofek empower researchers to probe cloud systems while offering developers robust mitigation strategies.

Uncovering Shadow Resource Vulnerabilities

Yakir introduces shadow resources—services that rely on others, like S3 buckets, for operation. Their research identified vulnerabilities in AWS services, including CloudFormation, Glue, and EMR, where misconfigured buckets allowed attackers to assume admin roles. One severe flaw enabled remote code execution, potentially compromising entire accounts. By analyzing service dependencies, Yakir’s team developed a methodology to uncover these hidden risks systematically.

Mapping and Exploiting Internal APIs

Michael details their approach to mapping AWS’s internal APIs, identifying common patterns that amplify vulnerability impact. Their open-source tool, released during the talk, automates this process, enabling researchers to detect exposed resources. For instance, unclaimed S3 buckets could be hijacked, allowing attackers to manipulate data or escalate privileges. This methodical mapping exposed systemic flaws, highlighting the need for vigilant resource management.

Mitigation Strategies for Cloud Security

Ofek outlines practical defenses, such as using scoped IAM policies with resource account conditions to restrict access to trusted buckets. He recommends verifying bucket ownership with expected bucket owner headers and using randomized bucket names to deter hijacking. These measures, applicable to open-source projects, prevent dangling resources from becoming attack vectors. Ofek emphasizes proactive checks to ensure past vulnerabilities are addressed.

Future Research and Community Collaboration

The trio concludes by urging researchers to explore new cloud attack surfaces, particularly internal API dependencies. Their open-source tool fosters community-driven discovery, encouraging developers to adopt secure practices. By sharing their findings, Yakir, Michael, and Ofek aim to strengthen AWS environments, ensuring that shadow resources no longer serve as gateways for catastrophic breaches.

Links: