#1153489 arj: directory traversal via ".." components inside member paths (not covered by CVE-2015-0557)

Package:
arj
Source:
arj
Description:
archiver for .arj files
Submitter:
Mario Fetka
Date:
2026-11-09 22:17:01 UTC
Severity:
normal
Tags:
#1153489#5
Date:
2026-11-09 05:29:51 UTC
From:
To:
Dear Maintainer,

"arj x" still writes files outside the target directory when a member name
contains ".." after an ordinary first component. This was reported privately
to the Debian Security Team first, who asked for a public bug report.

Affected:
- arj 3.10.22-28 on trixie (amd64)
- arj 3.10.22-29 built from the current sid source package

security-traversal-dir.patch (the CVE-2015-0557 fix) makes validate_path()
strip only a leading drive spec, leading "../" and leading separators. A
member name whose first component is ordinary is passed through unchanged:

  stored name              "arj x" in <target> writes
  ../evil1.txt             <target>/evil1.txt          (stripped, OK)
  a/../../evil2.txt        <target>/../evil2.txt       ESCAPES
  a/b/../../../evil4.txt   <target>/../evil4.txt       ESCAPES
  a/./../../evil6.txt      <target>/../evil6.txt       ESCAPES

Every further ".." climbs one more level, so a crafted archive decides how
far above the extraction directory a file is written, for example into the
home directory when extracting under ~/Downloads/x. "arj t" reports such an
archive as OK. CVE-2015-0556 covers symlinks and CVE-2015-0557 leading
separators; I found no existing CVE or bug for this case.

Reproduction (the attached arj_rename_member.py rewrites the first member's
stored name and recomputes the basic header CRC):

  mkdir -p /tmp/t/one/two/out && cd /tmp/t
  echo PAYLOAD > payload.txt
  arj a base.arj payload.txt
  python3 arj_rename_member.py base.arj evil.arj 'a/../../evil.txt'
  arj t evil.arj                 # tests OK
  cd /tmp/t/one/two/out && arj x -y /tmp/t/evil.arj
  ls /tmp/t/one/two/evil.txt     # one level above the target

The attached security-traversal-dotdot.patch applies on top of the
3.10.22-29 series. Before anything is written, it checks the stored part of
the output name (after the target directory): a leading separator or any
".." component makes the member be reported as skipped and counted as an
error, like other refused members. It is deliberately strict: a name such
as "ok/../inside.txt", which would stay inside the target, is refused too.

Tested on sid with the rebuilt 3.10.22-29 package: all three escaping names
above are skipped and arj exits with status 1; "../evil1.txt" is still
stripped and extracted inside the target as before; an ordinary archive with
a subdirectory extracts unchanged with "x", "e" and an explicit target
directory.

Regards
Mario Fetka