Skip to content
New issue

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

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

Already on GitHub? # to your account

Add mount commands and fstab entries with clear credentials #210

Merged
merged 5 commits into from
Oct 15, 2021

Conversation

PabloLec
Copy link
Contributor

Prerequisites

Why do we need this pull request?

  • Added support mount and mount.cifs commands with clear credentials as args. Can be found in various scripts. Complex commands with multiple arguments, flags and random arg order are supported.
  • Added similar support for fstab entries. Easily found vulnerability.
  • And fixed a typo in the test I wrote last evening 🤒

Copy / paste of output

pywhat "mount -o username=myuser,password=password"
Matched on: mount -o username=myuser,password=password
Name: Mount Command With Clear Credentialspywhat "cifs uid=1000,password=password,gid=1000,noperm,nofail,username=myuser"
Matched on: cifs uid=1000,password=password,gid=1000,noperm,nofail,username=myuser
Name: CIFS Fstab Entry With Clear Credentials

@@ -1026,6 +1026,30 @@
"Bug Bounty"
]
},
{
"Name": "Mount Command With Clear Credentials",
"Regex": "^(mount(.cifs)?[ ]+[^\\n]*(username=[^, \\n]+[^\\n ]*password=[^, \\n]+|password=[^, \\n]+[^\\n ]*username=[^, \\n]+))$",
Copy link

Choose a reason for hiding this comment

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

What[ ]+ is supposed to mean? Why not \s+?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

[ ]+ indeed does have the same meaning as \s+, I'll change it if it's more meaningful.

@PabloLec
Copy link
Contributor Author

Code seems to break with the change, let me check out why.

@PabloLec
Copy link
Contributor Author

PabloLec commented Oct 12, 2021

FIxed 😉

@codecov-commenter
Copy link

codecov-commenter commented Oct 13, 2021

Codecov Report

Merging #210 (74c386a) into main (e8aaaaa) will increase coverage by 0.03%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #210      +/-   ##
==========================================
+ Coverage   94.46%   94.50%   +0.03%     
==========================================
  Files          14       14              
  Lines        1717     1729      +12     
==========================================
+ Hits         1622     1634      +12     
  Misses         95       95              
Impacted Files Coverage Δ
tests/test_regex_formatting.py 100.00% <ø> (ø)
tests/test_regex_identifier.py 98.57% <100.00%> (+0.03%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e8aaaaa...74c386a. Read the comment docs.

@PabloLec
Copy link
Contributor Author

Windows tests failure are currently investigated by GitHub > https://www.githubstatus.com/

@PabloLec
Copy link
Contributor Author

Tests should now be able to run normally by the way 😉

@bee-san bee-san merged commit 2589780 into bee-san:main Oct 15, 2021
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants