Skip to content

Java: Add query for leaking sensitive data through a ResultReceiver #11713

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
Feb 1, 2023

Conversation

joefarebrother
Copy link
Contributor

Part of CWE-927.

Covers cases in which a ResultReceiver is obtained from some untrusted source, and then sensitive data is sent through it.

@github-actions github-actions bot added the Java label Dec 15, 2022
Comment on lines +47 to +49
super.allowImplicitRead(node, c)
or
this.isSink(node)

Check warning

Code scanning / CodeQL

Var only used in one side of disjunct.

The [variable c](1) is only used in one side of disjunct.
@github-actions
Copy link
Contributor

github-actions bot commented Jan 11, 2023

QHelp previews:

java/ql/src/Security/CWE/CWE-927/SensitiveResultReceiver.qhelp

Leaking sensitive information through a ResultReceiver

If a ResultReceiver is obtained from an untrusted source, such as an Intent received by an exported component, do not send it sensitive data. Otherwise, the information may be leaked to a malicious application.

Recommendation

Do not send sensitive data to an untrusted ResultReceiver.

Example

In the following (bad) example, sensitive data is sent to an untrusted ResultReceiver.

// BAD: Sensitive data is sent to an untrusted result receiver 
void bad(String password) {
    Intent intent = getIntent();
    ResultReceiver rec = intent.getParcelableExtra("Receiver");
    Bundle b = new Bundle();
    b.putCharSequence("pass", password);
    rec.send(0, b); 
}

References

  • Common Weakness Enumeration: CWE-927.

@joefarebrother joefarebrother changed the title [Draft] Java: Add query for leaking sensitive data through a ResultReceiver Java: Add query for leaking sensitive data through a ResultReceiver Jan 12, 2023
@joefarebrother joefarebrother force-pushed the sensitive-result-receiver branch from 1caa60d to e12febf Compare January 12, 2023 11:45
@joefarebrother joefarebrother marked this pull request as ready for review January 12, 2023 11:45
@joefarebrother joefarebrother requested a review from a team as a code owner January 12, 2023 11:45
@atorralba
Copy link
Contributor

I think this is ready for docs review 👍

@joefarebrother joefarebrother added the ready-for-doc-review This PR requires and is ready for review from the GitHub docs team. label Jan 27, 2023
Copy link
Contributor

@sabrowning1 sabrowning1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@joefarebrother, hi from Docs 👋🏼 I've just suggested a couple small changes below, then this is looking good 👍🏼 thanks for your work on the documentation!

Co-authored-by: Sam Browning <106113886+sabrowning1@users.noreply.github.com>
sabrowning1
sabrowning1 previously approved these changes Feb 1, 2023
Copy link
Contributor

@sabrowning1 sabrowning1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for making those changes @joefarebrother! Once @atorralba's updated the wording in that .ql file, this is good to go for docs 🚀

Copy link
Contributor

@atorralba atorralba left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉

@joefarebrother joefarebrother merged commit 97b2e85 into github:main Feb 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Java ready-for-doc-review This PR requires and is ready for review from the GitHub docs team.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants