Ajout d’un outil d’usurpation d’identité de mail
This commit is contained in:
parent
662f0668a3
commit
9c18d03852
|
@ -108,11 +108,37 @@ post '/dkim-generator/sender' => sub {
|
||||||
};
|
};
|
||||||
|
|
||||||
get '/attacker/spoof' => sub {
|
get '/attacker/spoof' => sub {
|
||||||
|
my ($config, $status) = call_api(GET => 'attacker', '/config');
|
||||||
|
($status eq 200) or die "Could not get attacker’s configuration";
|
||||||
|
|
||||||
template 'attacker/spoof' => {
|
template 'attacker/spoof' => {
|
||||||
title => 'Usurpateur d’identité de courriel'
|
title => 'Usurpateur d’identité de courriel',
|
||||||
|
default_helo => $config->{default_helo},
|
||||||
|
my_mail_from => $config->{my_mail_from},
|
||||||
|
scenarios => $config->{templates}
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
post '/attacker/spoof' => sub {
|
||||||
|
my $scenario = body_parameters->get('scenario');
|
||||||
|
my $replace_mail_from = (body_parameters->get('rfc5321-mailfrom') eq 'replace');
|
||||||
|
my $helo = body_parameters->get('helo');
|
||||||
|
|
||||||
|
my %api_params = (
|
||||||
|
scenario => $scenario,
|
||||||
|
replace_mail_from => ($replace_mail_from ? JSON::true : JSON::false),
|
||||||
|
helo => $helo
|
||||||
|
);
|
||||||
|
|
||||||
|
my ($logs, $status) = call_api(POST => 'attacker', '/spoof', \%api_params);
|
||||||
|
|
||||||
|
deferred 'logs' => $logs;
|
||||||
|
deferred 'selected_scenario' => $scenario;
|
||||||
|
deferred 'replace_mail_from' => $replace_mail_from;
|
||||||
|
|
||||||
|
redirect '/attacker/spoof', 303;
|
||||||
|
};
|
||||||
|
|
||||||
get '/sender/send-email' => sub {
|
get '/sender/send-email' => sub {
|
||||||
my %template_params = (
|
my %template_params = (
|
||||||
title => 'Envoi de messages légitimes',
|
title => 'Envoi de messages légitimes',
|
||||||
|
|
|
@ -1 +1,107 @@
|
||||||
TODO
|
<style>
|
||||||
|
.log-entry-direction-in::before {
|
||||||
|
content: "← "; color: var(--bs-blue);
|
||||||
|
}
|
||||||
|
.log-entry-direction-out::before {
|
||||||
|
content: "→ "; color: var(--bs-yellow);
|
||||||
|
}
|
||||||
|
.log-entry-direction-comment::before {
|
||||||
|
content: "* "; color: var(--bs-gray-500);
|
||||||
|
}
|
||||||
|
|
||||||
|
.log-line-comment { color: var(--bs-gray-500); }
|
||||||
|
.log-line-comment::before { content: "("; }
|
||||||
|
.log-line-comment::after { content: ")"; }
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<div class="container">
|
||||||
|
<h1>Usurpateur d’identité de courriel</h1>
|
||||||
|
<div class="row mt-4 mb-4">
|
||||||
|
<div class="col-sm-12 col-lg-5">
|
||||||
|
<form method="POST">
|
||||||
|
<div class="card bg-light mb-5">
|
||||||
|
<div class="card-body pt-2">
|
||||||
|
<label for="scenario" class="form-label pt-1">Scénario</label>
|
||||||
|
<select class="form-select" id="scenario" name="scenario" aria-label="Choix du scénario" onchange="setEmailAddresses()">
|
||||||
|
[% FOR scenarios %]
|
||||||
|
<option value="[% id | html %]" data-mail-from-name="[% from_name | html %]" data-mail-from-address="[% from_address | html %]"[% IF id == deferred.selected_scenario %] selected[% END %]>[% name | html %]</option>
|
||||||
|
[% END %]
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="helo" class="form-label">HELO/EHLO</label>
|
||||||
|
<input type="text" id="helo" name="helo" class="form-control" value="[% default_helo | html %]">
|
||||||
|
<div class="form-text">Nom de machine sous lequel l’attaquant se présente auprès du système de courriels du destinataire.</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="mb-3">
|
||||||
|
<label class="form-label">Adresse RFC5321.MailFrom</label>
|
||||||
|
<select class="form-select" id="rfc5321-mailfrom" name="rfc5321-mailfrom">
|
||||||
|
<option id="original-rfc5322-from" value="keep"[% UNLESS deferred.replace_mail_from %] selected[% END %]>(Identique au RFC5322.From)</option>
|
||||||
|
<option value="replace"[% IF deferred.replace_mail_from %] selected[% END %]>[% my_mail_from | html %]</option>
|
||||||
|
</select>
|
||||||
|
<div class="form-text">Cette adresse est utilisée dans la commande SMTP « MAIL FROM ». C’est l’équivalent électronique de l’adresse écrite à l’arrière d’une enveloppe postale.</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="rfc5322-from" class="form-label">Adresse RFC5322.From</label>
|
||||||
|
<input type="text" id="rfc5322-from" class="form-control" value="(Sélectionner un scénario)" disabled readonly>
|
||||||
|
<div class="form-text">Cette adresse est utilisée dans l’en-tête « From » du courriel. C’est l’adresse affichée par les logiciels de courriels comme Thunderbird. C’est l’équivalent électronique de l’adresse figurant sur le papier à en-tête.</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<button class="mt-4 btn btn-primary">Envoyer le message frauduleux</button>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
[% IF deferred.logs %]
|
||||||
|
<div class="col-sm-12 col-lg-7">
|
||||||
|
<div class="border-top mt-4 mb-4 d-lg-none"></div>
|
||||||
|
[% SWITCH deferred.logs.outcome %]
|
||||||
|
[% CASE 'success' %]
|
||||||
|
<div class="alert alert-success">
|
||||||
|
<p>Le courriel a été <strong>accepté</strong> par le serveur SMTP.</p>
|
||||||
|
<a class="btn btn-outline-success" href="[% request.uri_base %]/recipient/webmail">Relever les courriels du destinataire</a>
|
||||||
|
</div>
|
||||||
|
[% CASE 'failure' %]
|
||||||
|
<div class="alert alert-danger">
|
||||||
|
Le courriel a été <strong>rejeté</strong> par le serveur SMTP.
|
||||||
|
</div>
|
||||||
|
[% END %]
|
||||||
|
<div id="logs" class="card w-100 text-bg-dark font-monospace">
|
||||||
|
<div class="card-body">
|
||||||
|
[% FOR deferred.logs.log %]
|
||||||
|
<div class="log-entry d-flex[% " mt-2" IF direction == 'out' %]">
|
||||||
|
<div class="log-entry-direction">
|
||||||
|
<span class="log-entry-direction-[% direction | html %]"></span>
|
||||||
|
</div>
|
||||||
|
<div class="log-lines flex-fill">
|
||||||
|
[% FOR lines ~%]
|
||||||
|
<span class="log-line-[% class | html %][% " text-danger text-decoration-underline" IF text.match('^550 ') %]">[% text | html %]</span><br>
|
||||||
|
[%~ END %]
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
[% END %]
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
[% END %]
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
function setEmailAddresses() {
|
||||||
|
var scenario = $("#scenario").val();
|
||||||
|
var option = $("#scenario").children().filter(
|
||||||
|
function() { return $(this).attr("value") == scenario; }
|
||||||
|
).each(function() {
|
||||||
|
var mailFromName = $(this).data('mail-from-name');
|
||||||
|
var mailFromAddress = $(this).data('mail-from-address');
|
||||||
|
|
||||||
|
$("#original-rfc5322-from").text(mailFromAddress);
|
||||||
|
$("input#rfc5322-from").val(mailFromName + " <" + mailFromAddress + ">");
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
setEmailAddresses();
|
||||||
|
</script>
|
||||||
|
|
Loading…
Reference in New Issue