ajenti / ajenti

Audit: Starting a process with a partial executable path BAN-B607
Security
Minor
3 months ago4 years old
Starting a process with a partial executable path
152        return subprocess.check_output(['uname', '-mrs']).strip().decode()
153    except FileNotFoundError:
154        logging.warning('Please install lsb_release to detect the platform!')
155        return subprocess.check_output(['uname', '-mrs']).strip().decode()156
157
158def init():
Starting a process with a partial executable path
149    try:
150        return subprocess.check_output(['lsb_release', '-sd']).strip().decode()
151    except subprocess.CalledProcessError as e:
152        return subprocess.check_output(['uname', '-mrs']).strip().decode()153    except FileNotFoundError:
154        logging.warning('Please install lsb_release to detect the platform!')
155        return subprocess.check_output(['uname', '-mrs']).strip().decode()
Starting a process with a partial executable path
147
148def detect_platform_string():
149    try:
150        return subprocess.check_output(['lsb_release', '-sd']).strip().decode()151    except subprocess.CalledProcessError as e:
152        return subprocess.check_output(['uname', '-mrs']).strip().decode()
153    except FileNotFoundError:
Starting a process with a partial executable path
131
132    if dist == '':
133        try:
134            dist = subprocess.check_output(['strings', '-4', '/etc/issue']).split()[0].strip().decode()135        except subprocess.CalledProcessError as e:
136            dist = 'unknown'
137
Starting a process with a partial executable path
194    def check_sudo_password(self, username, password):
195        if not aj.config.data['auth'].get('allow_sudo', False):
196            return False
197        sudo = subprocess.Popen(198            ['sudo', '-S', '-k', '-u', username, '--', 'ls'],199            stdin=subprocess.PIPE,200            stdout=subprocess.PIPE,201            stderr=subprocess.PIPE,202        )203        o, e = sudo.communicate(password.encode('utf-8') + b'\n')
204        if sudo.returncode != 0:
205            raise SudoError((o + e).decode('utf-8').splitlines()[-1].strip())