Learn Google Adsense And Earn.
Showing posts with label Adsense Tips. Show all posts
Showing posts with label Adsense Tips. Show all posts

Website Security for Webmasters


Website Security for Webmasters


Users are taught to protect themselves from malicious programs by installing sophisticated antivirus software, but often they may also entrust their private information to websites like yours, in which case it’s important to protect their data. It’s also very important to protect your own data; if you have an online store, you don’t want to be robbed.


Over the years companies and webmasters have learned—often the hard way—that web application security is not a joke; we’ve seen user passwords leaked due to SQL injection attacks, cookies stolen with XSS, and websites taken over by hackers due to negligent input validation.


Today we’ll show you some examples of how a web application can be exploited so you can learn from them; for this we’ll use Gruyere, an intentionally vulnerable application we use for security training internally, too. Do not probe others’ websites for vulnerabilities without permission as it may be perceived as hacking; but you’re welcome—nay, encouraged—to run tests on Gruyere.




Client state manipulation - What will happen if I alter the URL?


Let’s say you have an image hosting site and you’re using a PHP script to display the images users have uploaded:


http://www.example.com/showimage.php?imgloc=/garyillyes/kitten.jpg


So what will the application do if I alter the URL to something like this and userpasswords.txt is an actual file?


http://www.example.com/showimage.php?imgloc=/../../userpasswords.txt


Will I get the content of userpasswords.txt?


Another example of client state manipulation is when form fields are not validated. For instance, let’s say you have this form:






It seems that the username of the submitter is stored in a hidden input field. Well, that’s great! Does that mean that if I change the value of that field to another username, I can submit the form as that user? It may very well happen; the user input is apparently not authenticated with, for example, a token which can be verified on the server.
Imagine the situation if that form were part of your shopping cart and I modified the price of a $1000 item to $1, and then placed the order.


Protecting your application against this kind of attack is not easy; take a look at the third part of Gruyere to learn a few tips about how to defend your app.


Cross-site scripting (XSS) - User input can’t be trusted






A simple, harmless URL:
http://google-gruyere.appspot.com/611788451095/%3Cscript%3Ealert('0wn3d')%3C/script%3E
But is it truly harmless? If I decode the percent-encoded characters, I get:
<script>alert('0wn3d')</script>


Gruyere, just like many sites with custom error pages, is designed to include the path component in the HTML page. This can introduce security bugs, like XSS, as it introduces user input directly into the rendered HTML page of the web application. You might say, “It’s just an alert box, so what?” The thing is, if I can inject an alert box, I can most likely inject something else, too, and maybe steal your cookies which I could use to sign in to your site as you.


Another example is when the stored user input isn’t sanitized. Let’s say I write a comment on your blog; the comment is simple:
<a href=”javascript:alert(‘0wn3d’)”>Click here to see a kitten</a>


If other users click on my innocent link, I have their cookies:






You can learn how to find XSS vulnerabilities in your own web app and how to fix them in the second part of Gruyere; or, if you’re an advanced developer, take a look at the automatic escaping features in template systems we blogged about on our Online Security blog.


Cross-site request forgery (XSRF) - Should I trust requests from evil.com?


Oops, a broken picture. It can’t be dangerous--it’s broken, after all--which means that the URL of the image returns a 404 or it’s just malformed. Is that true in all of the cases?


No, it’s not! You can specify any URL as an image source, regardless of its content type. It can be an HTML page, a JavaScript file, or some other potentially malicious resource. In this case the image source was a simple page’s URL:






That page will only work if I’m logged in and I have some cookies set. Since I was actually logged in to the application, when the browser tried to fetch the image by accessing the image source URL, it also deleted my first snippet. This doesn’t sound particularly dangerous, but if I’m a bit familiar with the app, I could also invoke a URL which deletes a user’s profile or lets admins grant permissions for other users.


To protect your app against XSRF you should not allow state changing actions to be called via GET; the POST method was invented for this kind of state-changing request. This change alone may have mitigated the above attack, but usually it's not enough and you need to include an unpredictable value in all state changing requests to prevent XSRF. Please head to Gruyere if you want to learn more about XSRF.


Cross-site script inclusion (XSSI) - All your script are belong to us


Many sites today can dynamically update a page's content via asynchronous JavaScript requests that return JSON data. Sometimes, JSON can contain sensitive data, and if the correct precautions are not in place, it may be possible for an attacker to steal this sensitive information.


Let’s imagine the following scenario: I have created a standard HTML page and send you the link; since you trust me, you visit the link I sent you. The page contains only a few lines:
<script>function _feed(s) {alert("Your private snippet is: " + s['private_snippet']);}</script><script src="http://google-gruyere.appspot.com/611788451095/feed.gtl"></script>




Since you’re signed in to Gruyere and you have a private snippet, you’ll see an alert box on my page informing you about the contents of your snippet. As always, if I managed to fire up an alert box, I can do whatever else I want; in this case it was a simple snippet, but it could have been your biggest secret, too.


It’s not too hard to defend your app against XSSI, but it still requires careful thinking. You can use tokens as explained in the XSRF section, set your script to answer only POST requests, or simply start the JSON response with ‘\n’ to make sure the script is not executable.


SQL Injection - Still think user input is safe?


What will happen if I try to sign in to your app with a username like
JohnDoe’; DROP TABLE members;--


While this specific example won’t expose user data, it can cause great headaches because it has the potential to completely remove the SQL table where your app stores information about members.


Generally, you can protect your app from SQL injection with proactive thinking and input validation. First, are you sure the SQL user needs to have permission to execute “DROP TABLE members”? Wouldn’t it be enough to grant only SELECT rights? By setting the SQL user’s permissions carefully, you can avoid painful experiences and lots of troubles. You might also want to configure error reporting in such way that the database and its tables’ names aren’t exposed in the case of a failed query.
Second, as we learned in the XSS case, never trust user input: what looks like a login form to you, looks like a potential doorway to an attacker. Always sanitize and quotesafe the input that will be stored in a database, and whenever possible make use of statements generally referred to as prepared or parametrized statements available in most database programming interfaces.


Knowing how web applications can be exploited is the first step in understanding how to defend them. In light of this, we encourage you to take the Gruyere course, take other web security courses from the Google Code University and check out skipfish if you're looking for an automated web application security testing tool. If you have more questions please post them in our Webmaster Help Forum.


Written by Gary Illyes, Webmaster Trends Analyst

Read Users' Comments (0)

Validation: measuring and tracking code quality


Validation: measuring and tracking code quality


Google’s Webmaster Team is responsible for most of Google’s informational websites like Google’s Jobs site or Privacy Centers. Maintaining tens of thousands of pages and constantly releasing new Google sites requires more than just passion for the job: it requires quality management.


In this post we won’t talk about all the different tests that can be run to analyze a website; instead we’ll just talk about HTML and CSS validation, and tracking quality over time.


Why does validation matter? There are different perspectives on validation—at Google there are different approaches and priorities too—but the Webmaster Team considers validation a baseline quality attribute. It doesn’t guarantee accessibility, performance, or maintainability, but it reduces the number of possible issues that could arise and in many cases indicates appropriate use of technology.


While paying a lot of attention to validation, we’ve developed a system to use it as a quality metric to measure how we’re doing on our own pages. Here’s what we do: we give each of our pages a score from 0-10 points, where 0 is worst (pages with 10 or more HTML and CSS validation errors) and 10 is best (0 validation errors). We started doing this more than two years ago, first by taking samples, now monitoring all our pages.


Since the beginning we’ve been documenting the validation scores we were calculating so that we could actually see how we’re doing on average and where we’re headed: is our output improving, or is it getting worse?


Here’s what our data say:




Validation score development 2009-2011.




On average there are about three validation issues per page produced by the Webmaster Team (as we combine HTML and CSS validation in the scoring process, information about the origin gets lost), down from about four issues per page two years ago.


This information is valuable for us as it tells us how close we are to our goal of always shipping perfectly valid code, and it also tells us whether we’re on track or not. As you can see, with the exception of the 2nd quarter of 2009 and the 1st quarter of 2010, we are generally observing a positive trend.


What has to be kept in mind are issues with the integrity of the data, i.e. the sample size as well as “false positives” in the validators. We’re working with the W3C in several ways, including reporting and helping to fix issues in the validators; however, as software can never be perfect, sometimes pages get dinged for non-issues: see for example the border-radius issue that has recently been fixed. We know that this is negatively affecting the validation scores we’re determining, but we have no data yet to indicate how much.


Although we track more than just validation for quality control purposes, validation plays an important role in measuring the health of Google’s informational websites.


How do you use validation in your development process?

Read Users' Comments (0)

Preparing your site for a traffic spike


Preparing your site for a traffic spike



It’s a moment any site owner both looks forward to, and dreads: a huge
 surge in traffic to your site (yay!) can often cause your site to crash (boo!)
. Maybe you’ll create a piece of viral content, or get Slashdotted, or maybe
 Larry Page will get a tattoo and your site on tech tattoos will be suddenly in vogue.
Many people go online immediately after a noteworthy eventa politica
 debate, the death of a celebrity, or a natural disaster—to get news and
 information about that event. This can cause a rapid increase in traffic to
 websites that provide relevant information, and may even cause sites to
 crash at the moment they’re becoming most popular. While it’s not always 
possible to anticipate such events, you can prepare your site in a variety of
 ways so that you’ll be ready to handle a sudden surge in traffic if one should
 occur:
Prepare a lightweight version of your site.
Consider maintaining a lightweight version of your website; you
 can then switch all of your traffic over to this lightweight version if you
 start to experience a spike in traffic. One good way to do this is to have
 a mobile version of your site, and to make the mobile site available to desktop/PC
 users during periods of high traffic. Another low-effort option is to just maintain a
 lightweight version of your homepage, since the homepage is often the 
most-requested page of a site as visitors start there and then navigate out to
 the specific area of the site that they’re interested in. If a particular article or 
picture on your site has gone viral, you could similarly create a lightweight version 
of just that page.
A couple tips for creating lightweight pages:
Exclude decorative elements like images or Flash wherever possible; use text
 instead of images in the site navigation and chrome, and put most of the content 
in HTML.
Use static HTML pages rather than dynamic ones; the latter place more load 
on your servers. You can also cache the static output of dynamic pages to
 reduce server load.
Take advantage of stable third-party services.
Another alternative is to host a copy of your site on a third-party service that
 you know will be able to withstand a heavy stream of traffic. For example, 
you could create a copy of your site—or a pared-down version with a focus 
on information relevant to the spike—on a platform like Google Sites or Blogger;
 use services like Google Docs to host documents or forms; or use a content 
delivery network (CDN).
Use lightweight file formats.
If you offer downloadable information, try to make the downloaded files as small 
as possible by using lightweight file formats. For example, offering the same data
 as a plain text file rather than a PDF can allow users to download the exact same
 content at a fraction of the filesize (thereby lightening the load on your servers). 
Also keep in mind that, if it’s not possible to use plain text files, PDFs generated 
from textual content are more lightweight than PDFs with images in them
. Text-based PDFs are also easier for Google to understand and index fully.
Make tabular data available in CSV and XML formats.
If you offer numerical or tabular data (data displayed in tables), we recommend 
also providing it in CSV and/or XML format. These filetypes are relatively
 lightweight and make it easy for external developers to use your data in external
applications or services in cases where you want the data to reach as many people
 as possible, such as in the wake of a natural disaster.
We’d love to hear your tips and tricks for weathering traffic spikes—come join us in 
our Webmaster Help Forum.

Read Users' Comments (0)

Keeping your free hosting service valuable for searchers

Keeping your free hosting service valuable for searchers


Free web hosting services can be great! Many of these services
 have helped to lower costs and technical barriers for webmasters
 and they continue to enable beginner webmasters to start their 
adventure on the web. Unfortunately, sometimes these lower 
barriers (meant to encourage less techy audiences) can attract
 some dodgy characters like spammers who look for cheap and 
easy ways to set up dozens or hundreds of sites that add little or no value
 to the web. When it comes to automatically generated sites, our 
stance remains the same: if the sites do not add sufficient value,
 we generally consider them as spam and take appropriate steps
 to protect our users from exposure to such sites in our natural 
search results.
If a free hosting service begins to show patterns of spam, we make

 a strong effort to be granular and tackle only spammy pages or sites.
 However, in some cases, when the spammers have pretty much taken 
over the free web hosting service or a large fraction of the service, 
we may be forced to take more decisive steps to protect our users 
and remove the entire free web hosting service from our search results
. To prevent this from happening, we would like to help owners of free
 web hosting services by sharing what we think may help you save 
valuable resources like bandwidth and processing power, and also 
protect your hosting service from these spammers:
  • Publish a clear abuse policy and communicate it to your users
  • , for example during the sign-up process. This step will contribute
  •  to transparency on what you consider to be spammy activity.
  • In your sign-up form, consider using CAPTCHAs or
  •  similar verification tools to only allow human submissions
  •  and prevent automated scripts from generating a bunch of
  •  sites on your hosting service. While these methods may not
  •  be 100% foolproof, they can help to keep a lot of the bad actors
  •  out.
  • Try to monitor your free hosting service for other spam signals
  •  like redirections, large numbers of ad blocks, certain spammy
  •  keywords, large sections of escaped JavaScript code, etc. 
  • Using the site: operator query or Google Alerts may come in 
  • handy if you’re looking for a simple, cost efficient solution.
  • Keep a record of signups and try to identify typical spam patterns
  •  like form completion time, number of requests sent from the same
  •  IP address range, user-agents used during signup, user names 
  • or other form-submitted values chosen during signup, etc. Again
  • , these may not always be conclusive.
  • Keep an eye on your webserver log files for sudden traffic spikes,
  •  especially when a newly-created site is receiving this traffic, and
  •  try to identify why you are spending more bandwidth and processing
  •  power.
  • Try to monitor your free web hosting service for phishing and
  •  malware-infected pages. For example, you can use the
  •  Google Safe Browsing API to regularly test URLs from your 
  • service, or sign up to receive alerts for your AS.
  • Come up with a few sanity checks. For example, if you’re 
  • running a local Polish free web hosting service, what are the
  •  odds of thousands of new and legitimate sites in Japanese
  •  being created overnight on your service? There’s a number 
  • of tools you may find useful for language detection of newly
  •  created sites, for example language detection libraries or theGoogle Translate API v2.

Last but not least, if you run a free web hosting service be sure
 to monitor your services for sudden activity spikes that may 
indicate a spam attack in progress.

For more tips on running a quality hosting service, have a look 

at our previous post. Lastly, be sure to sign up and verify your
 site in Google Webmaster Tools so we may be able to notify 
you when needed or if we see issues.

Read Users' Comments (0)

Five common SEO mistakes (and six good ideas!)

Five common SEO mistakes (and six good ideas!)





Webmaster Level: Beginner to Intermediate


To help you avoid common mistakes webmasters face with regard to search engine optimization (SEO), I filmed a video outlining five common mistakes I’ve noticed in the SEO industry. Almost four years ago, we also gathered information from all of you (our readers) about your SEO recommendations and updated our related Help Center article given your feedback. Much of the same advice from 2008 still holds true today -- here’s to more years ahead building a great site!





If you’re short on time, here’s the gist:

Avoid these common mistakes

1. Having no value proposition: Try not to assume that a site should rank #1 without knowing why it’s helpful to searchers (and better than the competition :)

2. Segmented approach: Be wary of setting SEO-related goals without making sure they’re aligned with your company’s overall objectives and the goals of other departments. For example, in tandem with your work optimizing product pages (and the full user experience once they come to your site), also contribute your expertise to your Marketing team’s upcoming campaign. So if Marketing is launching new videos or a more interactive site, be sure that searchers can find their content, too.

3. Time-consuming workarounds: Avoid implementing a hack rather than researching new features or best practices that could simplify development (e.g., changing the timestamp on an updated URL so it’s crawled more quickly instead of easily submitting the URL through Fetch as Googlebot).

4. Caught in SEO trends: Consider spending less time obsessing about the latest “trick” to boost your rankings and instead focus on the fundamental tasks/efforts that will bring lasting visitors.

5. Slow iteration: Aim to be agile rather than promote an environment where the infrastructure and/or processes make improving your site, or even testing possible improvements, difficult.
Six fundamental SEO tips


1. Do something cool: Make sure your site stands out from the competition -- in a good way!

2. Include relevant words in your copy: Try to put yourself in the shoes of searchers. What would they query to find you? Your name/business name, location, products, etc., are important. It's also helpful to use the same terms in your site that your users might type (e.g., you might be a trained “flower designer” but most searchers might type [florist]), and to answer the questions they might have (e.g., store hours, product specs, reviews). It helps to know your customers.

3. Be smart about your tags and site architecture: Create unique title tags and meta descriptions; include Rich Snippets markup from schema.org where appropriate. Have intuitive navigation and good internal links.

4. Sign up for email forwarding in Webmaster Tools: Help us communicate with you, especially when we notice something awry with your site.

5. Attract buzz: Natural links, +1s, likes, follows... In every business there's something compelling, interesting, entertaining, or surprising that you can offer or share with your users. Provide a helpful service, tell fun stories, paint a vivid picture and users will share and reshare your content.

6. Stay fresh and relevant: Keep content up-to-date and consider options such as building a social media presence (if that’s where a potential audience exists) or creating an ideal mobile experience if your users are often on-the-go.
Good luck to everyone!

Read Users' Comments (0)