https://github.com/tolik-punkoff/eval-security-bug-example
The example shows the danger of using the eval in bash. There is an example of dangerous and safe code.
https://github.com/tolik-punkoff/eval-security-bug-example
bug danger demo eval security
Last synced: about 1 month ago
JSON representation
The example shows the danger of using the eval in bash. There is an example of dangerous and safe code.
- Host: GitHub
- URL: https://github.com/tolik-punkoff/eval-security-bug-example
- Owner: tolik-punkoff
- License: other
- Created: 2020-01-24T21:20:05.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2020-02-07T22:28:48.000Z (over 6 years ago)
- Last Synced: 2025-01-12T10:07:51.069Z (over 1 year ago)
- Topics: bug, danger, demo, eval, security
- Language: Shell
- Size: 3.91 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# eval-security-bug-example
The example shows the danger of using the eval in bash. There is an example of dangerous and safe code.
## English
Files:
maketestdir - script for create test directories
testfile.txt - Test file. Danger fixed if you use single quotes in you code.
testfile2.txt - Test file. Danger fixed if you delete in code single quotes from input string and use single quotes in you code.
wrongcode - Script with no fix (using double quotes in code)
wrongcode - Script with first fix (using single quotes in code)
goodcode - Final fix. Code remove single quotes from input string and use single quotes in code
Using scripts:
script_name test_file
e.q.
wrongcode testfile2.txt
## Русский язык
Пример показывает опасность использования eval в bash. Имеется пример опасного и безопасного кода.
Файлы:
maketestdir - скрипт для создания тестовых каталогов.
testfile.txt - Тестовый файл. Ошибку безопасности можно обойти, заменив двойные кавычки одинарными в коде.
testfile2.txt - Замена двойных кавычек одинарными не поможет. Необходимо дополнительно удалять одинарные кавычки во входной строке.
wrongcode - файл без исправлений кода (в коде используются двойные кавычки)
wrongcode2 - только первое исправление (в коде используются одинарные кавычки)
goodcode - окончательно исправленный код (удаляются одинарные кавычки из входных строк).
Вызов скриптов: <скрипт> <тестовый файл>
Например:
wrongcode testfile2.txt