Skip to content

CPP: Add query for CWE-377 Insecure Temporary File#6947

Merged
MathiasVP merged 11 commits into
github:mainfrom
ihsinme:ihsinme-patch-077
Nov 11, 2021
Merged

CPP: Add query for CWE-377 Insecure Temporary File#6947
MathiasVP merged 11 commits into
github:mainfrom
ihsinme:ihsinme-patch-077

Conversation

@ihsinme

@ihsinme ihsinme commented Oct 25, 2021

Copy link
Copy Markdown
Contributor

Our request is looking for situations of unsafe work with files. use validation functions in the first place without guaranteeing that the file will not be created later. in the second case, he looks for places to work with the file, when his name is predictable and there are no restrictions on access rights.

CVE-2012-0786
CVE-2018-6198
CVE-2007-5936

links to real work results, I will add later. I am currently working on them with developers.

@ihsinme ihsinme requested a review from a team as a code owner October 25, 2021 11:30
@MathiasVP MathiasVP self-assigned this Oct 25, 2021

@MathiasVP MathiasVP left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for another contribution, @ihsinme. Here is my first round of comments.

Comment thread cpp/ql/src/experimental/Security/CWE/CWE-377/InsecureTemporaryFile.ql Outdated
Comment thread cpp/ql/src/experimental/Security/CWE/CWE-377/InsecureTemporaryFile.ql Outdated
Comment thread cpp/ql/src/experimental/Security/CWE/CWE-377/InsecureTemporaryFile.ql Outdated
@MathiasVP

MathiasVP commented Oct 26, 2021

Copy link
Copy Markdown
Contributor

It looks like our CI is failing with a couple of errors:

  • First:
File "ql/cpp/ql/src/experimental/Security/CWE/CWE-377/InsecureTemporaryFile.ql" contains a non-ASCII character at the location marked with `|` in:
2021-10-26T10:38:41.8453269Z ```
2021-10-26T10:38:41.8454787Z etTarget().hasGlobalOrStdName("chmod")
2021-10-26T10:38:41.8455619Z   ) and
2021-10-26T10:38:41.8456395Z   msg =
2021-10-26T10:38:41.8456832Z     "|
2021-10-26T10:38:41.8457197Z ```

Sounds like there's a hidden non-ASCII character around line 94.

  • Second:
ql/cpp/ql/src/experimental/Security/CWE/CWE-377/InsecureTemporaryFile.qhelp:8:3: The element type "overview" must be terminated by the matching end-tag "</overview>".

@ihsinme

ihsinme commented Oct 27, 2021

Copy link
Copy Markdown
Contributor Author

Good afternoon.
thanks for your comments.
I apologize for the delay in my response.
I will try to answer in the coming days.

@ihsinme

ihsinme commented Nov 4, 2021

Copy link
Copy Markdown
Contributor Author

Good afternoon @MathiasVP.

Please tell me what the error is during the assembly. (I fixed the previous error)

@MathiasVP

Copy link
Copy Markdown
Contributor

It's still complaining about a non-ASCII character:

File "ql/cpp/ql/src/experimental/Security/CWE/CWE-377/InsecureTemporaryFile.ql" contains a non-ASCII character at the location marked with `|` in:
2021-11-04T21:45:50.6626257Z ```
2021-11-04T21:45:50.6626999Z etTarget().hasGlobalOrStdName("chmod")
2021-11-04T21:45:50.6627647Z   ) and
2021-11-04T21:45:50.6628063Z   msg =
2021-11-04T21:45:50.6628482Z     "|
2021-11-04T21:45:50.6628881Z ```

@ihsinme

ihsinme commented Nov 5, 2021

Copy link
Copy Markdown
Contributor Author

It's still complaining about a non-ASCII character:

File "ql/cpp/ql/src/experimental/Security/CWE/CWE-377/InsecureTemporaryFile.ql" contains a non-ASCII character at the location marked with `|` in:
2021-11-04T21:45:50.6626257Z ```
2021-11-04T21:45:50.6626999Z etTarget().hasGlobalOrStdName("chmod")
2021-11-04T21:45:50.6627647Z   ) and
2021-11-04T21:45:50.6628063Z   msg =
2021-11-04T21:45:50.6628482Z     "|
2021-11-04T21:45:50.6628881Z ```

please run the checks again.

@MathiasVP MathiasVP left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM!

@MathiasVP MathiasVP merged commit bf9b8cf into github:main Nov 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants