Maushish Yadav
DeFi Security Researcher | Auditor | Founder @Paystream Labs
Analysis Overview
This report details the results of a static analysis conducted on the Paystream DeFi lending protocol using the tools X-Ray (v0.0.6) and Radar.Our audit spanned three primary program modules:
drift_optimizer, lib, and Paystream-v1.The primary objective was to identify unsafe patterns, missing validations, and account mismanagement across Solana smart contracts that constitute the core protocol.
Tooling & Methodology
- Tools Used: X-Ray v0.0.6, Radar
 - Techniques:
- IR file analysis
 - Instruction graph traversal
 - Owner/signer validation
 - Unsafe 
AccountInfopattern detection - Collateral access audits
 
 - Scope: Drift Optimizer, Core Lending Program, Utility Libraries
 
Findings
Drift Optimizer
- Vulnerability: Missing 
ownercheck onspot_marketaccount - Location: 
get_apys.rs, line 26 - Risk: Unauthorized account manipulation; deserialization of arbitrary data
 - Mitigation: Add explicit owner validation matching expected protocol program
 
Lib Module
- Vulnerabilities: None
 - Status: All logic modules and dependencies passed pointer and transformation analysis cleanly.
 
Core Protocol (Paystream-v1)
- Total Detected: 33 vulnerabilities
 - Patterns Observed:
- Repeated absence of signer/owner checks on critical account inputs
 - Unsafe use of unchecked 
AccountInfo<'info>underCHECK:macros - Multiple validator bypass risks in borrow, repay, and withdraw flows
 
 
High-Risk Locations
deposit.rs: No signer validation onprotocol_vault_authoritylend.rs: Improper validation of protocol and vault accountsborrow.rs: Data leakage and injection risks due to unchecked accountswithdraw.rs: Deserialization ofcollateral_marketwithout secure constraintsliquidate_by_ltv.rs: Direct liquidatee access without auth constraints
Recommendations
- Apply 
.is_signerand.owner == expected_program_idchecks across all cross-program andCHECK:inputs - Replace unchecked 
AccountInfofields with validatedAccountorInterfaceAccountwhere feasible - For all 
#[account(...)]constraints, enforce explicit runtime assertions - Protect 
dangerously_mutate_*functions with hardcoded access lists or role-based checks 
Security References
Conclusion
While Paystream demonstrates significant innovation in on-chain lending and liquidity optimization, security hardening remains crucial before scaling further.Patching signer and owner validation gaps should be prioritized to mitigate protocol-level risks, particularly around token streaming and borrowing logic.
A formal verification of economic invariants and runtime constraints is recommended before public audits.
Disclaimer: This report is a static report which is very different from a manual audit. This is done for initial security analysis.