Fileshares
- SMB / NFS / FTP / TFTP / SFTP -
- with cloud adoption, third parties are popular like Dropbox, Gdrive, Onedrive, sharepoint --- or s3 and s3 equivalents
SMB
- Common on windows
- WIN+R (run dialog) and type file share location:
\\192.168.1.1\Foldername - No auth logon - auth requested
Powershell and CMD file location examples
The command net use connects a computer from a shared resource or displays info about computer connections. You can connect to a file share and map its content to a drive such as below:
net use n: \\192.168.220.129\Finance- Checking files in shared folder:
dir n: /a-d /s /b | find /c ":\"- dir - basically ls
- n: - directory/drive
- /a-d - /a is attribute; -d means Not Directories
- /s - display files in specified directory / all subdirs
- /b - use bare format (no heading info / summary)
Findstr examples: https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/findstr#examples
Important distinction between cmd and ps
- We can run both Windows commands and PowerShell cmdlets in PowerShell, but the Command shell can only run Windows commands and not PowerShell cmdlets.
Get-ChildItem \\192.168.220.129\Finance\
and instead of net use
New-PSDrive -Name "N" -Root "\\192.168.220.129\Finance" -PSProvider "FileSystem"
To provide a username/pw we use PSCredential objects
$username = 'plaintext'
$password = 'Password123'
$secpassword = ConvertTo-SecureString $password -AsPlainText -Force
$cred = New-Object System.Management.Automation.PSCredential $username, $secpassword
gci == Get-ChildItem
-Include parameter to find specific items from the directory specified by Path parameter
Get-ChildItem -Recurse -Path N:\ -Include *cred* -File
```bash
`Select-String` cmdlet uses regular expression matching for searching text patterns - similar to grep
Get-ChildItem -Recurse -Path N:\ | Select-String "cred" -List
---
# Linux - Mounting shares
Requires `cifs-utils`
sudo mkdir /mnt/Finance sudo mount -t cifs -o username=plaintext,password=Password123,domain=. //192.168.220.129/Finance /mnt/Finance
We can also use a credential file
mount -t cifs //192.168.220.129/Finance /mnt/Finance -o credentials=/path/credentialfile
structured like so:
username=plaintext password=Password123 domain=.
---
# Linux - Email
https://wiki.gnome.org/Apps/Evolution
sudo apt-get install evolution
Note: If an error appears when starting evolution indicating "bwrap: Can't create file at ...", use this command to start evolution `export WEBKIT_FORCE_SANDBOX=0 && evolution`.
Setup video
https://www.youtube.com/watch?v=xelO2CiaSVs
---
# Database
3 common ways:
- mysql or sqsh
- gui application (mysql workbench, sql management studio, heidisql)
- programming languages
**MSSQL**
- `sqsh` or `sqlcmd` used with windows
- sqsh is friendlier
sqsh -S 10.129.20.13 -U username -P Password123
`sqlcmd` lets you enter transact-SQL stmts, system procs, and script files through various methods
- https://learn.microsoft.com/en-us/sql/tools/sqlcmd/sqlcmd-use-utility?view=sql-server-ver16
- cmd prompt
- query editor in sqlcmd mode
- windows script file
- OS job step of a sql server agent job
sqlcmd -S 10.129.20.13 -U username -P Password123
**MySQL**
LINUX mysql -u username -pPassword123 -h 10.129.20.13
Similar in windows
mysql.exe -u username -pPassword123 -h 10.129.20.13
---
# Overview of common tools

Some reasons why we may not have access to a resource:
- Authentication
- Privileges
- Network Connection
- Firewall Rules
- Protocol Support
---
# Conceptual overview of attacks

The concept is based on four categories that occur for each vulnerability. First, we have a Source that performs the specific request to a Process where the vulnerability gets triggered. Each process has a specific set of Privileges with which it is executed. Each process has a task with a specific goal or Destination to either compute new data or forward it. However, the individual and unique specifications under these categories may differ from service to service.
Every task and piece of information follows a specific pattern, a cycle, which we have deliberately made linear. This is because the Destination does not always serve as a Source and is therefore not treated as a source of a new task.
For any task to come into existence at all, it needs an idea, information (Source), a planned process for it (Processes), and a specific goal (Destination) to be achieved. Therefore, the category of Privileges is necessary to control information processing appropriately.
**SOURCE** performs request to PROCESS where vuln is triggered.
PROCESS has set of PRIVILEGES with which it is executed
PROCESS has task with specific goal / or DESTINATION to either compute or forward data
**SOURCE** can be defined as:
- Code
- Libraries
- Config
- APIs
- User input
In the case of log4j, it is a `library` - used to log application messages in Java / other prog langs.
**PROCESS** can be defined as accessing information forwarded from the source:
- PID (processid started or already running)
- Input
- Data Processing
- Variables
- Logging
`most of the vulnerabilities lie in the program code executed by the process.`
In log4j - process to log user-agent as a string using a function and store it somewhere - the vulnerability here, is the misinterpretation of the string, leading to execution of a request instead of simply logging the event and user-agent
**PRIVILEGES** are present in any system that controls PROCESSES. comprable to a bus ticket.
- SYSTEM - highest priv
- USER - assigned to specific user
- GROUPS - self-explanatory
- POLICIES - determine execution of application-specific commands which can apply to indiv/grouped users + their actions
- RULES - perms to perform actions handled from within the applications themselves
In log4j - The danger came from the privileges the implementation brought. Logs are considered sensitive because they can contain data about the svc. Logs stored in locations no regular user should be able to access. Thus - Applications with log4j were run with the privileges of an administrator. The process itself exploited the library by manipulating the user-agent
**DESTINATION** - Every task has atleast one purpose / goal to fulfill. Destination is `where the changes will be made`. The result of tasks are either stored, or sent somewhere else. Can be local or remote. At a local level - files/records may be modified by the process, or forwarded to other local services.
- Local - System's environment where the process occurred - Results and outcomes of a task are either processed further or storage
- Network - Network area mainly a matter of forwarded the results of a process to a remote interface. Can be a specific IP, or entire networks.