2020-06-29 23:07:16 -06:00
|
|
|
# Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
2021-03-03 22:12:11 -09:00
|
|
|
# or more contributor license agreements. Licensed under the Elastic License
|
|
|
|
|
# 2.0; you may not use this file except in compliance with the Elastic License
|
|
|
|
|
# 2.0.
|
2020-06-29 23:07:16 -06:00
|
|
|
|
|
|
|
|
# Name: Reading sensitive files
|
|
|
|
|
# RTA: linux_discovery_sensitive_files.py
|
|
|
|
|
# Description: Uses built-in commands for *nix operating systems to read known sensitive
|
|
|
|
|
# files, such as etc/shadow and etc/passwd
|
|
|
|
|
from . import common
|
2022-09-08 12:50:39 -04:00
|
|
|
from . import RtaMetadata
|
2020-06-29 23:07:16 -06:00
|
|
|
|
|
|
|
|
|
2022-09-08 12:50:39 -04:00
|
|
|
metadata = RtaMetadata(uuid="82358d3d-6f04-42d0-a182-db37cf98294e", platforms=["linux"], endpoint=[], siem=[], techniques=[])
|
|
|
|
|
|
|
|
|
|
|
2023-10-03 10:47:58 -04:00
|
|
|
@common.requires_os(*metadata.platforms)
|
2020-06-29 23:07:16 -06:00
|
|
|
def main():
|
|
|
|
|
common.log("Reading sensitive files", log_type="~")
|
|
|
|
|
|
|
|
|
|
# Launch an interactive shell with redirected stdin, to simulate interactive shell access
|
2022-09-08 12:50:39 -04:00
|
|
|
common.execute(
|
|
|
|
|
"/bin/sh",
|
|
|
|
|
stdin="""
|
2020-06-29 23:07:16 -06:00
|
|
|
cat /etc/sudoers
|
|
|
|
|
cat /etc/group
|
|
|
|
|
cat /etc/passwd
|
|
|
|
|
cat /etc/shadow
|
2022-09-08 12:50:39 -04:00
|
|
|
""",
|
|
|
|
|
)
|
2020-06-29 23:07:16 -06:00
|
|
|
|
|
|
|
|
|
2022-09-08 12:50:39 -04:00
|
|
|
if __name__ == "__main__":
|
2020-06-29 23:07:16 -06:00
|
|
|
main()
|