freepbx-helper-scripts icon indicating copy to clipboard operation
freepbx-helper-scripts copied to clipboard

SQL Injection in CM to Yealink

Open snatella opened this issue 4 months ago • 0 comments

Hello,

I was having a look through ContactManager_to_Yealink_AddressBook/cm_to_yl_ab.php to look for some inspiration on feeding freepbx data to Yealink, and noticed that unsanitised $_GET data is fed directly into an SQL string.

On line 33:

$contact_manager_group = isset($_GET['cgroup']) ? $_GET['cgroup'] : "SomeName"; // <-- Edit "SomeName" to make your own default

Is then used on line 55:

$sql = "SELECT ... WHERE cg.name = '$contact_manager_group') ...;";

Then prepared/executed on lines 58/59.

I'd suggest minimally using the ? placeholder and bind_param() to prevent SQL string manipulation.

snatella avatar Apr 04 '24 14:04 snatella