Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7067773
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T05:14:33+00:00 2026-05-28T05:14:33+00:00

I am allowing users to embed a youtube or any other video source by

  • 0

I am allowing users to embed a youtube or any other video source by only asking them to submit the src of the embed code they receive. Then I save it into the database and load it through an iframe. However,f there is a source, for instance, src="http://innocent.com/hackingContent.php", then is my website vulenrable to an xss attack?

I am estimating that the user may have a malicious script in that src which will load as soon as the iframe embeds the source into my own html.

EDIT What if the src contains <script type="text/javascript" src="evilScript.js"></script> . Although I am using a preg_match just to make sure that its a url only.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T05:14:33+00:00Added an answer on May 28, 2026 at 5:14 am

    Yes, you are vulnerable. What’s preventing a bad user from linking to porn? Or a site that looks legit and harvests usernames and passwords.

    Why don’t you build a white list of video sources you will accept…validate submitted urls are on those domains and verify the url exists.

    That way people can’t insert completely random urls into your content.

    A “white list” is a list of values that you will accept. For example, on your server, when the user submits a url, you would accept anything from

    http://www.youtube.com….

    right? So you make a list of all the urls you will accept, and then make sure the user’s input matches an item from your list. If it doesn’t you reject it. (By match we mean ‘begins with’ or something like that — obviously not an exact match)

    A “Black list” would be the opposite. You would have a list, but its a list of things you won’t allow.

    White List == List of things you allow
    Black List == List of things you don’t allow

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Suppose I am allowing users to vote only if they are registered users. I
I'm allowing users to send requests to other users inviting them to use my
Hey guys, quick question for any experts out there. I am allowing users to
What's your preferred method of sanitizing embed code entered in a form? In other
I am considering allowing users to post to my site without having them register
I'm considering allowing users to input JavaScript in web pages and letting them share
I am allowing users to upvote an item. When they click the up arrow,
We deploy our .NET applications by putting them on the LAN, and allowing users
I am currently allowing users to upload CSV files, processing them, saving database entries
I am allowing users to rotate images using jQuery rotate. However, when they do

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.