Ícone do Lab

Hack the Login

Muito Fácil Atualizado em 31 jan. 2026 Acesso Gratuito Solução Disponível

Inicie a máquina, hackeie o sistema e encontre as flags escondidas para completar este desafio e ganhar pontos!

1
Flags
5
Pontos
56%
Taxa de Sucesso
Comece Seu Desafio

Inicie sua máquina dedicada para começar a hackear

~1-2 min de configuração
Servidor dedicado
Instância privada
Padrão da indústria
Esta solução é para o Modo Flags

Este guia explica como hackear o lab e capturar as flags. Para ajuda com as perguntas do Modo de Aprendizado, use o botão Solicitar Dica ao lado de cada pergunta.

Muito Fácil

Hack the Login - Solution

Objective: Bypass client-side authentication to retrieve the flag.
Step 1: Access the Target

Navigate to the target URL in your browser. You'll see a simple login form asking for username and password.

https://lab.hdna.me/52-hack-the-login
Step 2: Open Developer Tools

Press F12 to open browser Developer Tools. This gives you access to all client-side resources including HTML, CSS, and JavaScript files.

Navigate to the Sources tab (Chrome/Edge) or Debugger tab (Firefox) to view the JavaScript files.

Step 3: Analyze the JavaScript

Click on script.js to view the authentication logic. The code reveals a critical vulnerability:

if (username === "admin" && password === "SecretPassword123!") {
    // Authentication successful
    fetch('7d9f3b2e1c8a5f6d4e0/flag.txt')
        .then(response => response.text())
        .then(flag => {
            messageDiv.textContent = `Success! Flag: ${flag}`;
        });
}

The credentials are hardcoded in plain text:

  • Username: admin
  • Password: SecretPassword123!
Step 4: Login with Discovered Credentials

Return to the login form and enter the discovered credentials:

  1. Username: admin
  2. Password: SecretPassword123!
  3. Click the Login button

The page will display the flag after successful authentication.

Alternative Method: Direct File Access

The JavaScript also reveals the flag file location. You can access it directly without logging in:

https://lab.hdna.me/52-hack-the-login/7d9f3b2e1c8a5f6d4e0/flag.txt

This works because there's no server-side authentication protecting the file - security through obscurity alone.

Step 5: Submit the Flag

Copy the UUID displayed on the page and submit it as your flag.

Key Takeaways
  • Never implement authentication in client-side JavaScript - users can read all client-side code
  • Authentication must happen server-side - where code is hidden from users
  • Security through obscurity is not security - hidden directories can be discovered through code analysis
  • Sensitive files need access controls - not just obfuscated paths

Pronto para hackear este lab?

Crie uma conta gratuita para iniciar seu próprio servidor dedicado, enviar flags e ganhar pontos no ranking.

Começar a Hackear Grátis
Junte-se a 5.000+ hackers aprendendo cibersegurança com labs práticos. Criar Conta