Domanda Jobs e sessions Metasploit

TheWorm91

Helper
31 Marzo 2022
428
49
204
317
Sto approfondendo la conoscenza del framework Metasploit su HTB academy, sono arrivato alla sezione sessions & jobs ma non ho ben chiaro la funzione dei jobs e che differenza ci sia con le sessions.
Per quello che ho capito e dalle prove che ho fatto le sessions sono utili in caso di post exploitation, ad esempio mettendo in background una shell meterpreter ed eseguire un modulo post per fare privilege escalation o altro mantenendo la connessione con l'host vittima.
Ho provato anche a lanciare un exploit con il comando exploit -j ma non viene creato il job infatti eseguendo jobs -l non risultano jobs attivi, non ho potuto quindi vedere come possono essere applicati in pratica.

Non ho chiaro questo passaggio:​
If, for example, we are running an active exploit under a specific port and need this port for a different module, we cannot simply terminate the session using [CTRL] + [C]. If we did that, we would see that the port would still be in use, affecting our use of the new module. So instead, we would need to use the jobs command to look at the currently active tasks running in the background and terminate the old ones to free up the port. Other types of tasks inside sessions can also be converted into jobs to run in the background seamlessly, even if the session dies or disappears.​
Perchè se termino la sessione la porta dovrebbe essere ancora in uso?​
 
Premetto che è parecchio che non smanetto, quindi non ricordo molte cose. Le "sessions" sono semplicemente delle connessioni attive che il tuo computer stabilisce con la macchina vittima, una volta che quest'ultima è stata compromessa. I "Jobs", invece, sono attività/processi che vengono eseguiti in background, sempre sulla macchina vittima. A volte può capitare che più di un processo utilizzi la medesima porta: in questo caso, anche terminando la sessione, la porta rimane in uso perché sei andato a killare solo uno dei diversi programmi che girano su quella porta. Quando lanci il comando "exploit -j" devi verificare che l'exploit sia compatibile con il target, altrimenti sarà impossibile l'esecuzione del task sottobanco.
 
  • Grazie
Reazioni: TheWorm91