T03 · Remote Payload Retrieval and Execution
- Location
build_skill.py:59- Finding
Unvalidated Remote Model Output Is Written as Executable Python
- Content
View full analysis
str: """Generate Python skill code using LLM.""" prompt = f""" Generate Python trading skill code for AION that implements this strategy: {strategy_description} Requirements: - Use AionClient from aion_sdk - Include proper error handling - Default to dry-run mode - Include market context checking - Add reasoning strings to all trades - Use skill_slug: {skill_slug} - Include docstrings Return only valid Python code that can be directly used in a clawhub skill. The code should define a main() function that runs the strategy. """ response = openai.ChatCompletion.create( model="gpt-4", messages=[{"role": "user", "content": prompt}], temperature=0.7 ) return response.choices[0].message.content ``` The remote response is subsequently written directly to an executable file: ```python # Generate skill.py using LLM skill_code = generate_skill_code(strategy_description, skill_slug) (skill_path / "skill.py").write_text(skill_code) ``` The generated instructions then recommend executing that file: ```python print(f" 3. Test locally: python skill.py") print(f" 4. Publish: npx clawhub@latest publish . --slug {skill_slug} --version 1.0.0") ``` ### Technical Analysis The user-controlled strategy description and skill slug are interpolated into a prompt sent to a remote language-model service. The service's response is treated as trusted Python source code and written directly to `skill.py`. No controls verify that the response: - Is syntactically valid Python rather than Markdown or mixed content. - Implements dry-run mode. - Avoids credential access ...[truncated 2439 chars]- Remediation
View remediation
