Module: Msf::Exploit::Remote::HTTP::Gitea::Login

Included in:
Msf::Exploit::Remote::HTTP::Gitea
Defined in:
lib/msf/core/exploit/remote/http/gitea/login.rb

Instance Method Summary collapse

Instance Method Details

#gitea_login(user, pass, timeout = 20) ⇒ Rex::Proto::Http::Response, AuthenticationError

performs a gitea login

Parameters:

  • user (String)

    Username

  • pass (String)

    Password

  • timeout (Integer) (defaults to: 20)

    The maximum number of seconds to wait before the request times out

Returns:

Raises:



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/msf/core/exploit/remote/http/gitea/login.rb', line 14

def (user, pass, timeout = 20)
  res = send_request_cgi({
    'uri' => ,
    'keep_cookies' => true
  }, timeout)
  return nil unless res

  csrf = gitea_get_csrf(res)
  raise Msf::Exploit::Remote::HTTP::Gitea::Error::CsrfError.new unless csrf

  res = send_request_cgi(
    'method' => 'POST',
    'uri' => ,
    'vars_post' => (user, pass, csrf),
    'keep_cookies' => true
  )

  raise Msf::Exploit::Remote::HTTP::Gitea::Error::AuthenticationError.new if res&.code != 302

  store_valid_credential(user: user, private: pass)
  return res
end