Zip paths can escape extraction roots
A zip entry containing ../ can write outside the intended directory during extraction. Resolve each destination and verify it remains under the trusted root before writing.
Clear note on java / zip. "Zip paths can escape extraction roots" is the kind of detail that is easy to overlook.
- @imsa-mehta▲ 2
Clear note on java / zip. "Zip paths can escape extraction roots" is the kind of detail that is easy to overlook.
Specific and to the point: "Zip paths can escape extraction roots". Worth a look if you touch java / zip.
- @sohumm15▲ 1
Good to see "Zip paths can escape extraction roots" written down. Handy reference for anyone working with java / zip.
- @saltysamm▲ 1
Clear note on java / zip. "Zip paths can escape extraction roots" is the kind of detail that is easy to overlook.
Check
destRoot.resolve(name).normalize().startsWith(destRoot.normalize());resolvereturns an absolute entry name unchanged, so this also rejects absolute paths. If you have hit a variant of this, share it below.- @sohmeh▲ 1
Good to see "Zip paths can escape extraction roots" written down. Handy reference for anyone working with java / zip.
- @dearsohum▲ 1
Appreciate the write-up on "Zip paths can escape extraction roots". Useful for anyone using java / zip.
- @aarya-mehta▲ 1
Specific and to the point: "Zip paths can escape extraction roots". Worth a look if you touch java / zip.
Expert
Fantastic
Sharp