mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2026-11-21 15:41:54 +00:00
Adding cross-DBMS security configuration audit (--audit)
This commit is contained in:
parent
6530184e2c
commit
d0ad9b2e34
43 changed files with 1236 additions and 3 deletions
33
plugins/dbms/postgresql/audit.py
Normal file
33
plugins/dbms/postgresql/audit.py
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
"""
|
||||
Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org)
|
||||
See the file 'LICENSE' for copying permission
|
||||
"""
|
||||
|
||||
from lib.core.enums import DBMS
|
||||
from plugins.generic.audit import Audit as GenericAudit
|
||||
|
||||
|
||||
class Audit(GenericAudit):
|
||||
dbms = DBMS.PGSQL
|
||||
queries = (("identity", ("audit_identity",)), ("configuration", ("audit_configuration",)),
|
||||
("privileges", ("audit_privileges",)))
|
||||
flags = dict((key, ("yes", "no")) for key in ("superuser", "bypass RLS", "pg_read_server_files", "pg_write_server_files", "pg_execute_server_program"))
|
||||
|
||||
def explain(self, groups):
|
||||
privileges = groups.get("privileges") or {}
|
||||
superuser = privileges.get("superuser") == "1"
|
||||
result = []
|
||||
if superuser or privileges.get("pg_read_server_files") == "1":
|
||||
result.append("File read: server-file privilege granted; use --file-read with a server-side path")
|
||||
if superuser and self._auditCanExecute():
|
||||
result.append("File write: superuser and statement execution available; use --file-write and --file-dest")
|
||||
if superuser or privileges.get("pg_execute_server_program") == "1":
|
||||
if self._auditCanExecute():
|
||||
result.append("Command execution: COPY FROM PROGRAM privilege granted; use --os-cmd or --os-shell")
|
||||
else:
|
||||
result.append("Command execution: COPY FROM PROGRAM privilege granted; no statement execution route identified")
|
||||
if superuser or privileges.get("bypass RLS") == "1":
|
||||
result.append("Row security: current role bypasses row-level security")
|
||||
return result
|
||||
Loading…
Add table
Add a link
Reference in a new issue