Bug 49853 - UCR variables printed via @%@ execute python code
UCR variables printed via @%@ execute python code
Status: NEW
Product: UCS
Classification: Unclassified
Component: UCR
UCS 4.4
Other Linux
: P5 normal (vote)
: ---
Assigned To: UCS maintainers
UCS maintainers
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2019-07-16 10:33 CEST by Florian Best
Modified: 2019-07-16 11:44 CEST (History)
0 users

See Also:
What kind of report is it?: Development Internal
What type of bug is this?: ---
Who will be affected by this bug?: ---
How will those affected feel about the bug?: ---
User Pain:
Enterprise Customer affected?:
School Customer affected?:
ISV affected?:
Waiting Support:
Flags outvoted (downgraded) after PO Review:
Ticket number:
Bug group (optional): Cleanup, Security
Max CVSS v3 score:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Florian Best univentionstaff 2019-07-16 10:33:24 CEST
If a UCR template contains @%@foo@%@ the UCR variable "foo" might contain @!@...@!@ which would then be evaluated as python code.

Example:
# ucr set ldap/debug/level='@!@import os; os.system("id >> /tmp/executed");@!@'
Setting ldap/debug/level
Multifile: /etc/ldap/slapd.conf
# cat /tmp/executed
uid=0(root) gid=0(root) Gruppen=0(root)
uid=0(root) gid=0(root) Gruppen=0(root)
uid=0(root) gid=0(root) Gruppen=0(root)
uid=0(root) gid=0(root) Gruppen=0(root)
uid=0(root) gid=0(root) Gruppen=0(root)
uid=0(root) gid=0(root) Gruppen=0(root)
uid=0(root) gid=0(root) Gruppen=0(root)
uid=0(root) gid=0(root) Gruppen=0(root)
uid=0(root) gid=0(root) Gruppen=0(root)

The same applies for Code inside of @!@ which prints @!@-code.
Here is code which causes an endless loop:
# echo '@!@print(open('foo.tpl').read())@!@' > foo.tpl
# ucr filter < foo.tpl
… runs forever…

I think this is
1. bad and unexpected behavior
2. a potential security risk as ucr_filter() is e.g. used elsewhere, too
(e.g. in the appcenter without UCR variables)