Skip to content
This repository has been archived by the owner on Oct 6, 2020. It is now read-only.

Latest commit

 

History

History
34 lines (22 loc) · 993 Bytes

DUO126.md

File metadata and controls

34 lines (22 loc) · 993 Bytes

DUO126

This linter searches for use of the popen2 module.

Use of the popen2 module commonly allows for arbitrary code execution bugs when combined with user input.

Problematic code

import popen2

Correct code

Instead of using the popen2 module to execute commands, prefer to use the subprocess module while ensuring shell=False.

See Replacing Older Functions with the subprocess Module.

Rationale

Arbitrary code execution allows an attacker to perform any action within the context of the system the bug is found. E.g. open a reverse shell to a system of their choosing, install malware by downloading and running a payload, silently log actions performed on the victim system, etc.

Arbitrary code execution bugs are effectively the keys to the castle. We'd like to avoid using the above function because it commonly allows for these types of bugs.

Exceptions

None