Module: kamailio
Branch: master
Commit: f81f0e77c5ab67431af1f62f0e027379a3445951
URL: https://github.com/kamailio/kamailio/commit/f81f0e77c5ab67431af1f62f0e02737…
Author: Sandro Gauci <sandro(a)enablesecurity.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2023-01-23T14:18:44+01:00
exec: docs - added security warning
- Added warning about potential for OS Command Injection
- Updated invalid examples
previous example gives the following error:
pv_parse_spec2(): error searching pvar "rU.txt"
---
Modified: src/modules/exec/doc/exec_admin.xml
---
Diff: https://github.com/kamailio/kamailio/commit/f81f0e77c5ab67431af1f62f0e02737…
Patch: https://github.com/kamailio/kamailio/commit/f81f0e77c5ab67431af1f62f0e02737…
---
diff --git a/src/modules/exec/doc/exec_admin.xml b/src/modules/exec/doc/exec_admin.xml
index fd0d88f4f5..93ea78cd87 100644
--- a/src/modules/exec/doc/exec_admin.xml
+++ b/src/modules/exec/doc/exec_admin.xml
@@ -77,6 +77,23 @@
Otherwise they will be evaluated as &kamailio; pseudo-variables,
throwing errors.
</para>
+ <para>
+ WARNING: if the exec functions are passed variables that might include
+ malicious input, then remote attackers may abuse the exec functions to
+ execute arbitrary code. Specifically, this may result in OS command injection.
+ In such cases, input validation is required to prevent the vulnerability.
+ The following is an example of how input validation and exec module
+ functions may be used together to prevent exploitation:
+ </para>
+ <programlisting format="linespecific">
+...
+if !($rU =~ "^[0-9]{1,15}$") {
+ xlog("Malformed R-URI username: '$rU'\n");
+ exit;
+}
+exec_msg("echo TEST >> /tmp/$(rU).txt");
+...
+ </programlisting>
</section>
<section>
@@ -186,7 +203,7 @@ modparam("exec", "time_to_kill", 20)
<programlisting format="linespecific">
...
exec_dset("echo TEST > /tmp/test.txt");
-exec_dset("echo TEST > /tmp/$rU.txt");
+exec_dset("echo TEST > /tmp/$(rU).txt");
...
</programlisting>
</example>
@@ -225,7 +242,7 @@ exec_dset("echo TEST > /tmp/$rU.txt");
<programlisting format="linespecific">
...
exec_msg("echo TEST > /tmp/test.txt");
-exec_msg("echo TEST > /tmp/$rU.txt");
+exec_msg("echo TEST > /tmp/$(rU).txt");
...
</programlisting>
</example>
@@ -300,7 +317,7 @@ exec_avp("echo TEST", "$avp(s:test)");
<programlisting format="linespecific">
...
exec_cmd("echo TEST > /tmp/test.txt");
-exec_cmd("echo TEST > /tmp/$rU.txt");
+exec_cmd("echo TEST > /tmp/$(rU).txt");
...
</programlisting>
</example>
@@ -315,4 +332,3 @@ exec_cmd("echo TEST > /tmp/$rU.txt");
</para>
</section>
</chapter>
-
https://www.kamailio.org/docs/modules/devel/modules/dialog#dialog.p.dlg_fil… says for dialog.dlg_filter_mode (int)
> Set dialog fitering mode, which can specify what dialogs are processed. Its value can be a combination (the sum) of following flags:
>
> 1 - do not send keepalives and do not execute timeout function if dialog is not local (if the associated bind address is not a local socket).
>
> Default value is “0”.
As you can see, the definition of 1 is a double negation and there is no definition for 0. What means 0:
- do not send keepalives and do not execute timeout function if dialog is local
- send keepalives and execute timeout function if dialog is not local
- send keepalives and execute timeout function if dialog is local
Please document the meaning of the default value 0.
--
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/3336
You are receiving this because you are subscribed to this thread.
Message ID: <kamailio/kamailio/issues/3336(a)github.com>
Call ID mask with a key similar to topoh insted of swaping with new ID. Call ID masking is dome when a message is received from the upstream and unmasked before sending towords upstream.
<!-- Kamailio Pull Request Template -->
<!--
IMPORTANT:
- for detailed contributing guidelines, read:
https://github.com/kamailio/kamailio/blob/master/.github/CONTRIBUTING.md
- pull requests must be done to master branch, unless they are backports
of fixes from master branch to a stable branch
- backports to stable branches must be done with 'git cherry-pick -x ...'
- code is contributed under BSD for core and main components (tm, sl, auth, tls)
- code is contributed GPLv2 or a compatible license for the other components
- GPL code is contributed with OpenSSL licensing exception
-->
#### Pre-Submission Checklist
<!-- Go over all points below, and after creating the PR, tick all the checkboxes that apply -->
<!-- All points should be verified, otherwise, read the CONTRIBUTING guidelines from above-->
<!-- If you're unsure about any of these, don't hesitate to ask on sr-dev mailing list -->
- [x] Commit message has the format required by CONTRIBUTING guide
- [ ] Commits are split per component (core, individual modules, libs, utils, ...)
- [ ] Each component has a single commit (if not, squash them into one commit)
- [ ] No commits to README files for modules (changes must be done to docbook files
in `doc/` subfolder, the README file is autogenerated)
#### Type Of Change
- [ ] Small bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds new functionality)
- [ ] Breaking change (fix or feature that would change existing functionality)
#### Checklist:
<!-- Go over all points below, and after creating the PR, tick the checkboxes that apply -->
- [ ] PR should be backported to stable branches
- [ ] Tested changes locally
- [ ] Related to issue #XXXX (replace XXXX with an open issue number)
#### Description
<!-- Describe your changes in detail -->
You can view, comment on, or merge this pull request online at:
https://github.com/kamailio/kamailio/pull/3323
-- Commit Summary --
* topos: added Call-ID mask support
-- File Changes --
M src/modules/topos/doc/topos_admin.xml (54)
M src/modules/topos/topos_mod.c (13)
A src/modules/topos/tps_mask.c (189)
A src/modules/topos/tps_mask.h (36)
M src/modules/topos/tps_msg.c (174)
M src/modules/topos/tps_msg.h (3)
-- Patch Links --
https://github.com/kamailio/kamailio/pull/3323.patchhttps://github.com/kamailio/kamailio/pull/3323.diff
--
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/3323
You are receiving this because you are subscribed to this thread.
Message ID: <kamailio/kamailio/pull/3323(a)github.com>
Module: kamailio
Branch: master
Commit: a45f4d901371e3ecdfad1652603a761ca30ac05e
URL: https://github.com/kamailio/kamailio/commit/a45f4d901371e3ecdfad1652603a761…
Author: Kamailio Dev <kamailio.dev(a)kamailio.org>
Committer: Kamailio Dev <kamailio.dev(a)kamailio.org>
Date: 2023-01-20T12:31:20+01:00
modules: readme files regenerated - topoh ... [skip ci]
---
Modified: src/modules/topoh/README
---
Diff: https://github.com/kamailio/kamailio/commit/a45f4d901371e3ecdfad1652603a761…
Patch: https://github.com/kamailio/kamailio/commit/a45f4d901371e3ecdfad1652603a761…
---
diff --git a/src/modules/topoh/README b/src/modules/topoh/README
index 2bb18d89d2..2fa0f4fd39 100644
--- a/src/modules/topoh/README
+++ b/src/modules/topoh/README
@@ -38,6 +38,7 @@ Daniel-Constantin Mierla
3.11. uri_prefix_checks (integer)
3.12. event_callback (str)
3.13. event_mode (int)
+ 3.14. use_mode (int)
4. Event Routes
@@ -59,8 +60,9 @@ Daniel-Constantin Mierla
1.11. Set uri_prefix_checks parameter
1.12. Set event_callback parameter
1.13. Set event_mode parameter
- 1.14. Usage of event_route[topoh:msg-outgoing]
- 1.15. Usage of event_route[topoh:msg-sending]
+ 1.14. Set use_mode parameter
+ 1.15. Usage of event_route[topoh:msg-outgoing]
+ 1.16. Usage of event_route[topoh:msg-sending]
Chapter 1. Admin Guide
@@ -87,6 +89,7 @@ Chapter 1. Admin Guide
3.11. uri_prefix_checks (integer)
3.12. event_callback (str)
3.13. event_mode (int)
+ 3.14. use_mode (int)
4. Event Routes
@@ -141,6 +144,7 @@ Chapter 1. Admin Guide
3.11. uri_prefix_checks (integer)
3.12. event_callback (str)
3.13. event_mode (int)
+ 3.14. use_mode (int)
3.1. mask_key (str)
@@ -322,6 +326,19 @@ end
modparam("topoh", "event_mode", 2)
...
+3.14. use_mode (int)
+
+ Control how the module is initialized. If set to 1, the module is only
+ initialized to be used as a library via inter-module API functions. If
+ set to 0, the module is initialized for SIP messages processing.
+
+ Default value is 0 (to process SIP messages).
+
+ Example 1.14. Set use_mode parameter
+...
+modparam("topoh", "use_mode", 1)
+...
+
4. Event Routes
4.1. event_route[topoh:msg-outgoing]
@@ -339,7 +356,7 @@ modparam("topoh", "event_mode", 2)
reparsing the outgoing SIP message for the cases when topology hiding
is not wanted.
- Example 1.14. Usage of event_route[topoh:msg-outgoing]
+ Example 1.15. Usage of event_route[topoh:msg-outgoing]
...
event_route[topoh:msg-outgoing] {
if($sndto(ip)=="10.1.1.10") {
@@ -358,7 +375,7 @@ event_route[topoh:msg-outgoing] {
$sndto(proto) point to the destination. The SIP message is the one to
be sent out.
- Example 1.15. Usage of event_route[topoh:msg-sending]
+ Example 1.16. Usage of event_route[topoh:msg-sending]
...
event_route[topoh:msg-sending] {
if(is_request() and $fU=="alice") {
Module: kamailio
Branch: master
Commit: 3cfbb8f8e2be64a2bec02ddc25ca8877c0f778f1
URL: https://github.com/kamailio/kamailio/commit/3cfbb8f8e2be64a2bec02ddc25ca887…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2023-01-20T12:22:55+01:00
topoh: added docs for use_mode parameter
---
Modified: src/modules/topoh/doc/topoh_admin.xml
---
Diff: https://github.com/kamailio/kamailio/commit/3cfbb8f8e2be64a2bec02ddc25ca887…
Patch: https://github.com/kamailio/kamailio/commit/3cfbb8f8e2be64a2bec02ddc25ca887…
---
diff --git a/src/modules/topoh/doc/topoh_admin.xml b/src/modules/topoh/doc/topoh_admin.xml
index c8718b81a79..b6fc2ab0286 100644
--- a/src/modules/topoh/doc/topoh_admin.xml
+++ b/src/modules/topoh/doc/topoh_admin.xml
@@ -352,6 +352,28 @@ end
...
modparam("topoh", "event_mode", 2)
...
+</programlisting>
+ </example>
+ </section>
+ <section id="topoh.p.use_mode">
+ <title><varname>use_mode</varname> (int)</title>
+ <para>
+ Control how the module is initialized. If set to 1, the module is
+ only initialized to be used as a library via inter-module API
+ functions. If set to 0, the module is initialized for SIP messages
+ processing.
+ </para>
+ <para>
+ <emphasis>
+ Default value is 0 (to process SIP messages).
+ </emphasis>
+ </para>
+ <example>
+ <title>Set <varname>use_mode</varname> parameter</title>
+ <programlisting format="linespecific">
+...
+modparam("topoh", "use_mode", 1)
+...
</programlisting>
</example>
</section>