Skip to content

Bug: /tx/pending endpoint lacks maximum limit, memory DoS risk #1999

@RavMonSOL

Description

@RavMonSOL

Severity: Low (5 RTC)

Description

list_pending in node/rustchain_tx_handler.py accepts a limit query parameter (default 100) and forwards it to tx_pool.get_pending_transactions(limit) without an upper bound. If a client requests a very large limit, the node may attempt to serialize and transmit a huge number of pending transactions, consuming memory and CPU.

Code

@app.route('/tx/pending', methods=['GET'])
def list_pending():
    try:
        limit = request.args.get('limit', 100, type=int)
        pending = tx_pool.get_pending_transactions(limit)
        return jsonify({"count": len(pending), "transactions": [...]})

Fix

Cap the limit to a reasonable maximum (e.g., 200). Return 400 if exceeded.


Bug report for bounty #305. Wallet: RTC3fcd93a4ec68cfd6b59d1b41c4872c5c239c4ad8

Metadata

Metadata

Assignees

No one assigned

    Labels

    securitySecurity-related change

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions