T09 · Insecure Skill Coding Practices
- Location
douyin.js:23- Finding
Unrestricted Outbound Requests Allow Blind Server-Side Request Forgery
- Content
View full analysis
{ const parsedUrl = new URL(url); const client = parsedUrl.protocol === 'https:' ? https : http; const opts = { method: options.method || 'GET', headers: { ...HEADERS, ...options.headers } }; const req = client.request(url, opts, (res) => { // Handle redirects if (res.statusCode >= 300 && res.statusCode < 400 && res.headers.location) { httpRequest(res.headers.location, options) .then(resolve) .catch(reject); return; } let data = ''; res.on('data', chunk => data += chunk); res.on('end', () => { resolve({ statusCode: res.statusCode, headers: res.headers, body: data, url: url }); }); }); req.on('error', reject); req.setTimeout(30000, () => { req.destroy(); reject(new Error('Request timeout')); }); if (options.body) { req.write(options.body); } req.end(); }); } ``` ```javascript async function parseShareUrl(shareText) { const modalIdMatch = shareText.match(/(?:modal_id[=:])?(\d{16,})/); if (modalIdMatch) { const modalId = modalIdMatch[1]; return await getVideoInfoByModalId(modalId); } const urlMatch = shareText.match(/https?:\/\/[^\s]+/); if (!urlMatch) { throw new Error('No valid share URL found'); } let shareUrl = urlMatch[0]; shareUrl = shareUrl.replace(/[\.,;!?,。!?]+$/g, ''); const response1 = await httpRequest(shareUrl); const finalUrl = response1.url; ``` ### Technical Analysis The Skill accepts the first HTTP or HTTPS URL found in caller-controlled input and s ...[truncated 2600 chars]- Remediation
View remediation
