Recent Posts
Archives

Archive for the ‘en-US’ Category

PostHeaderIcon [DefCon32] The XZ Backdoor Story: The Undercover Op That Set the Internet on Fire

In a riveting exploration of one of the most sophisticated cyberattacks in recent history, Thomas Roccia, a security researcher at Microsoft, unravels the intricate tale of the XZ backdoor. Discovered by Andres Freund in March 2024, this clandestine operation compromised the open-source XZ utility, specifically its liblzma library, threatening SSH servers worldwide. Thomas’s narrative dissects the attacker’s methods, the discovery’s serendipity, and the broader implications for open-source security, urging the community to remain vigilant.

The Discovery of the XZ Backdoor

Thomas begins by recounting the fortuitous discovery by Andres Freund, a Microsoft engineer, who noticed anomalies in the XZ utility. The backdoor, orchestrated by a mysterious maintainer named Jia Tan, was embedded in the liblzma library, a critical component for SSH operations. This breach could have granted attackers remote access to countless systems. Thomas highlights the mix of luck and expertise that led to the detection, emphasizing how close the internet came to a catastrophic compromise.

The Attacker’s Modus Operandi

Delving into the operation, Thomas outlines how Jia Tan infiltrated the XZ project by gaining trust over time. The attacker, potentially backed by a nation-state, employed sophisticated techniques to insert malicious code, exploiting the project’s open-source nature. By meticulously integrating the backdoor into legitimate updates, Jia Tan evaded scrutiny until Freund’s investigation. Thomas details the technical mechanics, including how the backdoor manipulated SSH authentication, underscoring the attacker’s deep understanding of Linux systems.

Lessons for Open-Source Security

The XZ incident exposes vulnerabilities in open-source ecosystems, where trust in contributors is paramount. Thomas advocates for enhanced vetting processes and automated code analysis to detect anomalies early. He stresses the importance of community awareness, as knowledge of such attacks is a key defense. The incident redefines what constitutes a sophisticated attacker, prompting a reevaluation of how open-source projects manage contributions and verify integrity.

Future Vigilance and Community Action

Concluding, Thomas poses a haunting question: how many other Jia Tans are embedding backdoors in open-source projects? He urges researchers to study the XZ case, leveraging blogs and technical write-ups from contributors like Freund. By fostering a culture of transparency and collaboration, the community can bolster defenses, ensuring that open-source software remains a pillar of trust rather than a vector for compromise.

Links:

PostHeaderIcon SpringBatch: How to have different schedules, per environment, for instance: keep the fixedDelay=60000 in prod, but schedule with a Cron expression in local dev?

Case

In SpringBatch, a batch is scheduled in a bean JobScheduler with

[java]
@Scheduled(fixedDelay = 60000)
void doSomeThing(){…}
[/java]

.
How to have different schedules, per environment, for instance: keep the fixedDelay=60000 in prod, but schedule with a Cron expression in local dev?

Solution

Add this block to the <JobScheduler:

[java]
@Value("${jobScheduler.scheduling.enabled:true}")
private boolean schedulingEnabled;

@Value("${jobScheduler.scheduling.type:fixedDelay}")
private String scheduleType;

@Value("${jobScheduler.scheduling.fixedDelay:60000}")
private long fixedDelay;

@Value("${jobScheduler.scheduling.initialDelay:0}")
private long initialDelay;

@Value("${jobScheduler.scheduling.cron:}")
private String cronExpression;

@Scheduled(fixedDelayString = "${jobScheduler.scheduling.fixedDelay:60000}", initialDelayString = "${jobScheduler.scheduling.initialDelay:0}")
@ConditionalOnProperty(name = "jobScheduler.scheduling.type", havingValue = "fixedDelay")
public void scheduleFixedDelay() throws Exception {
if ("fixedDelay".equals(scheduleType) || "initialDelayFixedDelay".equals(scheduleType)) {
doSomething();
}
}

@Scheduled(cron = "${jobScheduler.scheduling.cron:0 0 1 * * ?}")
@ConditionalOnProperty(name = "jobScheduler.scheduling.type", havingValue = "cron", matchIfMissing = false)
public void scheduleCron() throws Exception {
if ("cron".equals(scheduleType)) {
doSomething(); }
}
[/java]

In application.yml, add:

[xml]
jobScheduler:
# noinspection GrazieInspection
scheduling:
enabled: true
type: fixedDelay
fixedDelay: 60000
initialDelay: 0
cron: 0 0 1 31 2 ? # every 31st of February… which means: never
[/xml]

(note the cron expression: leaving it empty may prevent SpringBoot from starting)

In application.yml, add:

[xml]
jobScheduler:
# noinspection GrazieInspection
scheduling:
type: cron
cron: 0 0 1 * * ?
[/xml]

It should work now ;-).

PostHeaderIcon SnowFlake❄: Why does SUM() return NULL instead of 0?

🙋‍♀️🙋‍♂️ Question

I’m running a SUM() query on a Snowflake table, but instead of returning 0 when there are no matching rows, it returns NULL.

For example, I have this table:

CREATE OR REPLACE TABLE sales (
    region STRING,
    amount NUMBER
);

INSERT INTO sales VALUES 
    ('North', 100),
    ('South', 200),
    ('North', NULL),
    ('East', 150);

Now, I run the following query to sum the sales for a region that doesn’t exist:

SELECT SUM(amount) FROM sales WHERE region = 'West';
  • Expected output: 0
  • Actual output: NULL

Why is this happening, and how can I make Snowflake return 0 instead of NULL?

Answer

 First and basic approach: explicitly filter out NULL before aggregation:
SELECT SUM(CASE WHEN amount IS NOT NULL THEN amount ELSE 0 END) AS total_sales 
FROM sales 
WHERE region = 'West'; 

This method ensures that NULL does not interfere with the SUM calculation.

✅ Even better: Use COALESCE() to handle NULL.

By default, SUM() returns NULL if there are no rows that match the condition or if all matching rows contain NULL.

🔹 To return 0 instead of NULL, use COALESCE(), which replaces NULL with a default value:

SELECT COALESCE(SUM(amount), 0) AS total_sales 
FROM sales 
WHERE region = 'West'; 

🔹 This ensures that when SUM(amount) is NULL, it gets converted to 0.

 (copied to https://stackoverflow.com/questions/79524739/why-does-sum-return-null-instead-of-0 )

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: