# Stackoverflow, the vulnerability marketplace

- Speaker: [Danny Grander](/wiki/speakers/danny-grander.md)
- Event: [Reversim Summit 2018](/wiki/years/2018.md)
- Video: https://www.youtube.com/watch?v=rx_zK-MIkvA
- Transcript: [/transcripts/2018/38-rx_zK-MIkvA.md](/transcripts/2018/38-rx_zK-MIkvA.md)
- Language: Hebrew · Type: talk · Level: intermediate
- Topics: [Software Engineering](/wiki/topics/software-engineering.md), [Security](/wiki/topics/security.md), [Java](/wiki/topics/java.md), [Open Source](/wiki/topics/open-source.md)

> Written by an LLM from machine transcripts. It can contain errors. Check the transcript before you quote it.

## Summary

The speaker discusses a security vulnerability known as Zip Slip, which allows malicious actors to overwrite files and achieve remote code execution through archive extraction functions. The speaker explains how this vulnerability was discovered in popular open-source projects like Jenkins and various plugins by examining how file paths are constructed from archive entries. Furthermore, the speaker demonstrates how developers often copy-paste vulnerable code snippets directly from online developer forums without realizing the security implications. Finally, the audience learns best practices for safely handling archive files, validating file paths, and avoiding common pitfalls associated with code reuse.

## Key points

- [1:25](https://www.youtube.com/watch?v=rx_zK-MIkvA&t=85s) Researchers found a security vulnerability in the code of Jenkins and several plugins related to handling archive files.
- [4:32](https://www.youtube.com/watch?v=rx_zK-MIkvA&t=272s) The vulnerability occurs when extracting archive files because the file name entry from the archive is directly concatenated into the destination path without validation.
- [5:48](https://www.youtube.com/watch?v=rx_zK-MIkvA&t=348s) An attacker can manipulate the archive entry to include directory traversal sequences like dot-dot-slash, allowing files to be written outside the intended target directory.
- [7:07](https://www.youtube.com/watch?v=rx_zK-MIkvA&t=427s) Overwriting arbitrary files can lead to remote code execution, modified configuration files, or compromised SSH credentials.
- [8:44](https://www.youtube.com/watch?v=rx_zK-MIkvA&t=524s) Using BigQuery to scan public GitHub code repositories revealed a massive amount of open-source projects containing this exact vulnerability.
- [10:05](https://www.youtube.com/watch?v=rx_zK-MIkvA&t=605s) An analysis of Q and A threads on Stack Overflow showed that the vast majority of code examples provided for extracting archives in Java were vulnerable.
- [16:04](https://www.youtube.com/watch?v=rx_zK-MIkvA&t=964s) Copying code snippets from online forums is risky because the most popular answers prioritize getting code to work quickly over security, and copied code cannot easily receive security updates.

## Takeaways

- Always validate and sanitize file paths derived from untrusted archive entries to prevent directory traversal attacks.
- Be cautious when copy-pasting code snippets from online developer forums, as popular answers may contain security flaws.
- Keep open-source dependencies and libraries updated to the latest patched versions to automatically benefit from security fixes.

## Questions this talk answers

- What is the Zip Slip vulnerability and how does it allow attackers to execute arbitrary code?
- How can developers safely extract archive files in Java without risking path traversal?
- Why are code snippets copied from Stack Overflow often insecure, and how can developers mitigate this risk?

## Technologies

Jenkins, Java, Python, AWS, BigQuery, Git, GitHub

## Tags

best practices, code review, java, open source, security, vulnerabilities
