Skip to content

archive extraction hardening #4

Description

@rabarbra
  • Symlinks, hardlinks, and FIFOs are silently dropped. extractTar switches only on TypeDir and TypeReg, so a tarball containing symlinks extracts to an incomplete tree with no warning at all. Silent data loss is worse than an error.
  • Setuid/setgid bits are preserved from the archive. Modes are applied raw via os.FileMode(header.Mode) with no masking. Mask with 0o777.
  • Directory modes come from the archive too — a 0o400 dir entry makes every subsequent write into that directory fail. Create dirs 0o755 and chmod afterward.
  • No decompression-bomb limit. io.Copy is unbounded, so a 42.zip-style archive fills the disk. Wrap in io.LimitReader with a total-size cap.
  • The websocket DialContext response body is never closed (animated_svg.go:426).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions