domingo, 4 de junho de 2023

Linux Command Line Hackery Series - Part 6


Welcome back to Linux Command Line Hackery series, I hope you've enjoyed this series so far and would have learned something (at least a bit). Today we're going to get into user management, that is we are going to learn commands that will help us add and remove users and groups. So bring it on...

Before we get into adding new users to our system lets first talk about a command that will be useful if you are a non-root user.

Command: sudo
Syntax: sudo [options] command
Description: sudo allows a permitted user to execute a command as a superuser or another user.

Since the commands to follow need root privileges, if you are not root then don't forget to prefix these commands with sudo command. And yes you'll need to enter the root password in order to execute any command with sudo as root.

Command: useradd
Syntax: useradd [options] username
Description: this command is used for creating new user but is kinda old school.
Lets try to add a new user to our box.
[Note: I'm performing these commands as root user, you'll need root privileges to add a new user to your box. If you aren't root then you can try these commands by prefixing the sudo command at the very beginning of these command like this sudo useradd joe. You'll be prompted for your root password, enter it and you're good to go]

useradd joe

To verify that this command has really added a user to our box we can look at three files that store a users data on a Linux box, which are:

/etc/passwd -> this file stores information about a user separated by colons in this manner, first is login name, then in past there used to be an encrypted password hash at the second place however since the password hashes were moved to shadow file now it has a cross (x) there, then there is user id, after it is the user's group id, following it is a comment field, then the next field contains users home directory, and at last is the login shell of the user.

/etc/group  -> this file stores information about groups, that is id of the group and to which group an user belongs.

/etc/shadow -> this file stores the encrypted password of users.

Using our command line techniques we learned so far lets check out these files and verify if our user has been created:

cat /etc/passwd /etc/group /etc/shadow | grep joe



In the above screenshot you can notice an ! in the /etc/shadow, this means the password of this user has not been set yet. That means we have to set the password of user joe manually, lets do just that.

Command: passwd
Syntax: passwd [options] [username]
Description: this command is used to change the password of user accounts.
Note that this command needs root privileges. So if you are not root then prefix this command with sudo.

passwd joe



After typing this command, you'll be prompted password and then for verifying your password. The password won't show up on the terminal.
Now joe's account is up and running with a password.

The useradd command is a old school command, lets create a new user with a different command which is kinda interactive.

Command: adduser
Syntax: adduser [options] user
Description: adduser command adds a user to the system. It is more friendly front-end to the useradd command.

So lets create a new user with adduser.

adduser jane



as seen in the image it prompts for password, full name and many other things and thus is easy to use.

OK now we know how to create a user its time to create a group which is very easy.

Command: addgroup
Syntax: addgroup [options] groupname
Description: This command is used to create a new group or add an existing user to an existing group.

We create a new group like this

addgroup grownups



So now we have a group called grownups, you can verify it by looking at /etc/group file.
Since joe is not a grownup user yet but jane is we'll add jane to grownups group like this:

addgroup jane grownups



Now jane is the member of grownups.

Its time to learn how to remove a user from our system and how to remove a group from the system, lets get straight to that.

Command: deluser
Syntax: deluser [options] username
Description: remove a user from system.

Lets remove joe from our system

deluser joe

Yes its as easy as that. But remember by default deluser will remove the user without removing the home directory or any other files owned by the user. Removing the home directory can be achieved by using the --remove-home option.

deluser jane --remove-home

Also the --remove-all-files option removes all the files from the system owned by the user (better watch-out). And to create a backup of all the files before deleting use the --backup option.

We don't need grownups group so lets remove it.

Command: delgroup
Syntax: delgroup [options] groupname
Description: remove a group from the system.

To remove grownups group just type:

delgroup grownups



That's it for today hope you got something in your head.
Related links

Learning Web Pentesting With DVWA Part 1: Installation



In this tutorial series I'm going to walk you through the damn vulnerable web application (DVWA) which is damn vulnerable. Its main goal according to the creators is "to aid security professionals to test thier skills and tools in a legal environment, help web developers better understand the process of securing web applications and to aid both students & teachers to learn about web application security in a controlled class room environment."

I am going to install DVWA in docker so the prerequisite for this tutorial will be an installation of docker (Docker is not the only way to install DVWA but if you have docker already installed then it may be the easiest way to install DVWA).

To install DVWA in docker run your docker deamon if it's not running already and open a terminal or powershell and type:

docker rum --rm -it -p 8080:80 vulnerables/web-dvwa




It will take some time to pull the image from docker hub depending on your internet speed and after it is complete it will start the dvwa application. In the command we have mapped the image instance's port 80 to our hosts port 8080 so we should be able to access the web application from our host at http://localhost:8080

Now open your favorite web browser and go to http://localhost:8080
You should be prompted with a login screen like this:



login with these creds:
username: admin
password: password

After login you'll see a database setup page since this is our first run. Click on Create / Reset Database button at the bottom. It will setup database and redirect you to login page. Now login again and you'll see a welcome page.



Now click on DVWA Security link at the bottom of the page navigation and make sure the security level is set to Low. If it is not click on the dropdown, select Low and then click submit.




Now our setup is complete, so lets try a simple SQL attack to get a taste of whats about to come.

Click on SQL Injection in navigation menu.
You'll be presented with a small form which accepts User ID.
Enter a single quote (') in the User ID input field and click Submit.
You'll see an SQL error like this:



From the error message we can determine that the server has a MariaDB database and we can see the point of injection.
Since there are many quotes we are not able to determine the exact location of our injection. Lets add some text after our single quote to see exactly where our injection point is.
Now I am going to enter 'khan in the User ID field and click Submit.



Now we can see exactly where the point of injection is. Determining the point of injection is very important for a successful SQL injection and is sometimes very hard too, though it might not be that much useful here in this exercise.

Now lets try the very basic SQL Injection attack.
In the User ID field enter ' or 1=1-- - and click Submit.



We will explain what is going on here in the next article.


References:-
1. DVWA Official Website: http://www.dvwa.co.uk/

More information


sábado, 3 de junho de 2023

Hackerhubb.blogspot.com

Hackerhubb.blogspot.com
More info

  1. Pentest Tools Url Fuzzer
  2. Best Hacking Tools 2019
  3. Top Pentest Tools
  4. Physical Pentest Tools
  5. Pentest Tools Port Scanner
  6. Best Pentesting Tools 2018
  7. Hacker Tool Kit
  8. Pentest Automation Tools
  9. Hacking Tools For Mac
  10. Hacking Tools Kit
  11. Pentest Tools Bluekeep
  12. Hacker Tools For Mac
  13. Hack Tools Pc
  14. Tools Used For Hacking
  15. Hack Tool Apk
  16. Hacker Tools Mac
  17. What Are Hacking Tools
  18. Hack Tools For Games
  19. Hackers Toolbox
  20. Hacker Tools Windows
  21. Hack Tool Apk
  22. Hacker
  23. Hackrf Tools
  24. Android Hack Tools Github
  25. Hak5 Tools
  26. Pentest Tools For Mac
  27. Hacking Tools For Pc
  28. How To Install Pentest Tools In Ubuntu
  29. Hacker Techniques Tools And Incident Handling
  30. Android Hack Tools Github
  31. How To Make Hacking Tools
  32. Android Hack Tools Github
  33. Hak5 Tools
  34. Computer Hacker
  35. Hacking Tools For Windows Free Download
  36. Hacking Tools 2019
  37. Pentest Tools Tcp Port Scanner
  38. Hacker Tools 2019
  39. Beginner Hacker Tools
  40. Pentest Tools For Mac
  41. How To Hack
  42. Hack Tools For Ubuntu
  43. Hack Tools For Pc
  44. Hack And Tools
  45. Hack Tools For Windows
  46. Top Pentest Tools
  47. Black Hat Hacker Tools
  48. Hacker Security Tools
  49. What Are Hacking Tools
  50. Pentest Tools Tcp Port Scanner
  51. Tools 4 Hack
  52. Pentest Tools Android
  53. Hacking Tools For Windows
  54. Hack Website Online Tool
  55. Underground Hacker Sites
  56. Pentest Tools
  57. Hacking Tools For Mac
  58. Pentest Tools Apk
  59. Hack Tools Pc
  60. Hacking Tools Kit
  61. Pentest Tools Framework
  62. Underground Hacker Sites
  63. Hack Apps
  64. Hack Tool Apk
  65. Hacking Tools For Kali Linux
  66. Hack Tools Github
  67. Hack Tools For Pc
  68. Beginner Hacker Tools
  69. Hack Tool Apk No Root
  70. Pentest Tools Review
  71. Pentest Tools List
  72. Hacker Tools Github
  73. Hacker Tools
  74. Pentest Tools Linux
  75. Hacking Tools For Kali Linux
  76. Hacker Tools List
  77. Beginner Hacker Tools
  78. Black Hat Hacker Tools
  79. What Is Hacking Tools
  80. Hack Tools For Ubuntu
  81. Pentest Tools Free
  82. Hackrf Tools
  83. Hack Tools Online
  84. Top Pentest Tools
  85. Growth Hacker Tools
  86. Hacker Tools Github
  87. Pentest Tools Download
  88. What Are Hacking Tools
  89. Hacks And Tools
  90. Pentest Tools Linux
  91. Hacking Tools
  92. Pentest Tools Website Vulnerability
  93. Blackhat Hacker Tools
  94. Hacking Tools 2019
  95. Pentest Box Tools Download
  96. Hacker Tools Hardware
  97. Hacker Tools For Ios
  98. Hack Tool Apk No Root
  99. Top Pentest Tools
  100. Hacker Tool Kit
  101. Pentest Tools Url Fuzzer
  102. Hacker Tools Online
  103. Nsa Hack Tools
  104. Hacker Search Tools
  105. Hacker Hardware Tools
  106. Hackrf Tools
  107. Hacking Tools And Software
  108. What Is Hacking Tools
  109. Hacking Tools Name
  110. Pentest Tools Tcp Port Scanner
  111. World No 1 Hacker Software
  112. Hacking Tools Name
  113. Hack Tools For Mac
  114. Best Pentesting Tools 2018
  115. Hack Tools For Ubuntu
  116. Pentest Tools Free
  117. Best Pentesting Tools 2018
  118. Pentest Tools For Android
  119. Hacking Tools For Beginners
  120. Hak5 Tools
  121. How To Install Pentest Tools In Ubuntu
  122. Computer Hacker
  123. Hacking Tools Software
  124. Top Pentest Tools
  125. Hack Tools For Windows
  126. Hack Apps
  127. Hack Tools For Mac
  128. Pentest Tools For Windows
  129. Best Pentesting Tools 2018
  130. Github Hacking Tools
  131. Pentest Tools Open Source
  132. Hack Tools For Windows
  133. Hacker Security Tools
  134. Hacks And Tools
  135. Hacking Tools For Kali Linux
  136. Hacking Tools Usb
  137. Pentest Tools Open Source
  138. Hackers Toolbox
  139. Hack Tools For Games
  140. Pentest Tools Android
  141. Hacker Tools For Pc
  142. Nsa Hacker Tools
  143. Beginner Hacker Tools
  144. Hacker Security Tools
  145. Black Hat Hacker Tools
  146. Hacker Tool Kit
  147. Pentest Tools For Mac
  148. Pentest Tools Find Subdomains
  149. Ethical Hacker Tools
  150. Hacker Tools Free
  151. Hacker Search Tools
  152. Hacking Tools For Games