BomAle 434 Posted May 10, 2018 Share Posted May 10, 2018 In seguito a una segnalazione di un cliente per la chiusura ripetuta del suo sito per spam ELEVATO ho voluto approfondire la questione, e sono riuscito a individuare l'origine dello spam. Ho iniziato a prendere di mira i file /admin/sources/handlers/han_email.php /ips_kernel/classEmail.php responsabili della gestione e invio delle email del software. Modificandoli come segue il server smtp non veniva inizializzato e le email venivano semplicemente archiviate nella cartella "_mail", a questo punto è bastato vedere il trace generato per trovare il modulo utilizzato dai bot per inviare spam. #han_email.php linea 178-197 ATTIVO DEBUG, cambiare => ... in => '1' public function init() { $this->header = $this->settings['email_header'] ? $this->settings['email_header'] : ''; $this->footer = $this->settings['email_footer'] ? $this->settings['email_footer'] : ''; $classToLoad = IPSLib::loadLibrary( IPS_KERNEL_PATH . 'classEmail.php', 'classEmail' ); $this->emailer = new $classToLoad( array( 'debug' => '1', 'debug_path' => DOC_IPS_ROOT_PATH . '_mail', 'smtp_host' => $this->settings['smtp_host'] ? $this->settings['smtp_host'] : 'localhost', 'smtp_port' => intval($this->settings['smtp_port']) ? intval($this->settings['smtp_port']) : 25, 'smtp_user' => $this->settings['smtp_user'], 'smtp_pass' => $this->settings['smtp_pass'], 'smtp_helo' => $this->settings['smtp_helo'], 'method' => $this->settings['mail_method'], 'wrap_brackets' => $this->settings['mail_wrap_brackets'], 'extra_opts' => $this->settings['php_mail_extra'], 'charset' => IPS_DOC_CHAR_SET, 'html' => $this->html_email ) ); } #classEmail line 665 sostituirla come segue, lo 0 serve per non includere l'oggetto ed avere un responso ridotto, se volete più informazioni rimuovetelo. $debug = $this->subject . "\n------------\n" . $this->rfc_headers . "\n\n" . $this->message ."\n------------\n" . print_r( debug_backtrace(0), TRUE ); #all'interno dei file generati nella cartella "_mail" veniva riportato questo trace in ogni file Array ( [0] => Array ( [file] => ...\admin\sources\handlers\han_email.php [line] => 292 [function] => sendMail [class] => classEmail [type] => -> [args] => Array ( ) ) [1] => Array ( [file] => ...\admin\applications\forums\modules_public\extras\forward.php [line] => 258 [function] => sendMail [class] => hanEmail [type] => -> [args] => Array ( ) ) [2] => Array ( [file] => ...\admin\applications\forums\modules_public\extras\forward.php [line] => 187 [function] => _sendEmail [class] => public_forums_extras_forward [type] => -> [args] => Array ( ) ) [3] => Array ( [file] => ...\admin\sources\base\ipsController.php [line] => 306 [function] => doExecute [class] => public_forums_extras_forward [type] => -> [args] => Array ( [0] => ipsRegistry Object ( [templateStriping] => Array ( ) ) ) ) [4] => Array ( [file] => ...\admin\sources\base\ipsController.php [line] => 120 [function] => execute [class] => ipsCommand [type] => -> [args] => Array ( [0] => ipsRegistry Object ( [templateStriping] => Array ( ) ) ) ) [5] => Array ( [file] => ...\admin\sources\base\ipsController.php [line] => 65 [function] => handleRequest [class] => ipsController [type] => -> [args] => Array ( ) ) [6] => Array ( [file] => ...\index.php [line] => 25 [function] => run [class] => ipsController [type] => :: [args] => Array ( ) ) ) In precedenza avevo disattivato lo sharelink email che attivava il modulo forward, pertanto ho creato un file per visualizzare la variabile e ho scoperto il problema, nel mio caso la "cache" del software non è stata aggiornata come ci si aspettava. #file test.php in allegato <?php require_once( 'initdata.php' ); require_once( CP_DIRECTORY.'/sources/base/ipsRegistry.php' ); $registry = ipsRegistry::instance(); $registry->init(); $member = $registry->member()->fetchMemberData(); echo'<pre>'; print_r($registry->cache()->getCache('sharelinks')['email']);exit; test.php Perciò è bastato andare in AdminCP > Cache Management > cerca sharelink e cliccare sul tasto refresh a fine riga. Per conferma ho ricontrollato il file test.php per vedere se il valore era "0", e cosi non si sono registrate nuove mail spam. In futuro se volete abilitare lo sharelink email prestate attenzione che funzioni correttamente e che scegliate gruppi di utenti iscritti e affidabili, inoltre per controllare come viene utilizzato controllate in mysql la seguente query in AdminCP > Support > SQL Management > SQL Toolbox SELECT *,FROM_UNIXTIME(log_date) FROM ibf_core_share_links_log WHERE log_share_key="email"; se volete sapere se ci sono online bot che stanno tentando di accedere al modulo forward usate questa query SELECT * FROM ibf_sessions where current_section="forward"; cosi potete bannare gli ip e ridurre il carico sul sito. Link to post Share on other sites
BomAle 434 Posted May 10, 2018 Author Share Posted May 10, 2018 Quindi gli spammer usavano il tasto sharelink email rappresentato in figura per utilizzare il modulo per inviare ad un "amico" il contenuto presente nell'editor https://invisionita.com/topic/6299-risolvere-problemi-di-spam/?do=email ed essendo visitatori potevano specificare l'email a cui inviare il contenuto. il captcha è stato migliorato in IPS 4.3, per chi è in 3.4.x non potrà utilizzare il captcha v1 poichè è stato chiuso. Link to post Share on other sites
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now