dfinity / invoice-canister

Providing an example and simplified experience for accepting payments in smart contracts
Apache License 2.0
44 stars 13 forks source link

[SEC-F13] Missing Input Validation #15

Closed krpeacock closed 2 years ago

krpeacock commented 2 years ago

Observation

In several places arbitrary inputs can be passed to the canister, e.g.

create_invoice

Risk Description

The create_invoice parameters are stored in the canister storage forever (see also F18). These arguments can be so big that they use the maximum ingress message size and with this it is easy to fill up the canister storage, resulting in denial of service. Also, the canister will no longer be able to upgrade (F19).

Unvalidated data in the invoice (e.g. the details) could also lead to injection attacks in some frontend if the data is displayed and not properly escaped there.

Recommendations: