@@ -17,19 +17,28 @@ use solana_lints::{paths, utils::visit_expr_no_bodies};
17
17
dylint_linting:: declare_late_lint! {
18
18
/// **What it does:**
19
19
///
20
+ /// This lint checks that for each account referenced in a program, that there is a
21
+ /// corresponding owner check on that account. Specifically, this means that the owner
22
+ /// field is referenced on that account.
23
+ ///
20
24
/// **Why is this bad?**
21
25
///
22
- /// **Known problems:** None.
26
+ /// The missing-owner-check vulnerability occurs when a program uses an account, but does
27
+ /// not check that it is owned by the expected program. This could lead to vulnerabilities
28
+ /// where a malicious actor passes in an account owned by program `X` when what was expected
29
+ /// was an account owned by program `Y`. The code may then perform unexpected operations
30
+ /// on that spoofed account.
31
+
32
+ /// For example, suppose a program expected an account to be owned by the SPL Token program.
33
+ /// If no owner check is done on the account, then a malicious actor could pass in an
34
+ /// account owned by some other program. The code may then perform some actions on the
35
+ /// unauthorized account that is not owned by the SPL Token program.
36
+ ///
37
+ /// **Known problems:**
23
38
///
24
- /// **Example:**
39
+ /// Key checks can be strengthened. Currently, the lint only checks that the account's owner
40
+ /// field is referenced somewhere, ie, `AccountInfo.owner`.
25
41
///
26
- /// ```rust
27
- /// // example code where a warning is issued
28
- /// ```
29
- /// Use instead:
30
- /// ```rust
31
- /// // example code that does not raise a warning
32
- /// ```
33
42
pub MISSING_OWNER_CHECK ,
34
43
Warn ,
35
44
"using an account without checking if its owner is as expected"
0 commit comments