Skip to content

do not follow symlinks when deleting axis2 temp directories - #1335

Open
kali834x wants to merge 1 commit into
apache:masterfrom
kali834x:temp-cleanup-nofollow
Open

kali834x wants to merge 1 commit into
apache:masterfrom
kali834x:temp-cleanup-nofollow

Conversation

@kali834x

Copy link
Copy Markdown
Contributor

the static initializer of TempFileManager, which runs the first time an aar or mar carrying lib/.jar is deployed (Utils.getURLsForAllJars via Utils.createTempFile), deletes every axis2-tmp- entry in java.io.tmpdir that has no .lck file, and both its filter and recursiveDelete use File.isDirectory, which follows symbolic links. a local user who creates /tmp/axis2-tmp-x pointing at a directory the axis2 account can write (the services repository, the webapp) gets that directory emptied by the server on its next such deployment (CWE-59). ConfigurationContext.deleteTempFiles, run from terminate() over the artifacts dir that falls back to the shared java.io.tmpdir/_axis2, has the same problem for a link placed inside it. all three checks now use Files.isDirectory with NOFOLLOW_LINKS, so a link is removed or skipped rather than descended into, and stale temp dirs are still cleaned up. TempFileManagerTest and ConfigurationContextTempCleanupTest fail before the change (the link target is emptied) and pass after, and the kernel module verify run is green.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant